diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 5e6a377..034cac1 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,12 +1,9 @@ -.gitignore .php-cs-fixer.dist.php -README.md -composer.json docs/Api/BankAccountApi.md docs/Api/CurrencyApi.md docs/Api/DocumentApi.md +docs/Api/DocumentBlockApi.md docs/Api/DocumentExportApi.md -docs/Api/InventoryApi.md docs/Api/OrganizationApi.md docs/Api/PartnerApi.md docs/Api/ProductApi.md @@ -45,10 +42,8 @@ docs/Model/DocumentExportType.md docs/Model/DocumentForm.md docs/Model/DocumentFormat.md docs/Model/DocumentInsert.md -docs/Model/DocumentInsertInstantPaymentRequest.md docs/Model/DocumentInsertItemsInner.md docs/Model/DocumentInsertType.md -docs/Model/DocumentInstantPaymentRequest.md docs/Model/DocumentItem.md docs/Model/DocumentItemData.md docs/Model/DocumentLanguage.md @@ -56,22 +51,18 @@ docs/Model/DocumentList.md docs/Model/DocumentNotificationStatus.md docs/Model/DocumentOrganization.md docs/Model/DocumentPartner.md -docs/Model/DocumentPartnerPartnerShipping.md docs/Model/DocumentProductData.md docs/Model/DocumentPublicUrl.md docs/Model/DocumentSettings.md -docs/Model/DocumentSettingsDontSendToNavReason.md docs/Model/DocumentSummary.md docs/Model/DocumentType.md docs/Model/DocumentVatRateSummary.md -docs/Model/DontSendToNavReason.md docs/Model/Entitlement.md docs/Model/Feature.md docs/Model/Id.md docs/Model/InvoiceSettings.md docs/Model/LedgerNumberInformation.md docs/Model/ModificationDocumentInsert.md -docs/Model/Money.md docs/Model/OnlinePayment.md docs/Model/OnlineSzamlaStatus.md docs/Model/OnlineSzamlaStatusEnum.md @@ -79,12 +70,7 @@ docs/Model/OnlineSzamlaStatusMessage.md docs/Model/OrganizationData.md docs/Model/Partner.md docs/Model/PartnerCustomBillingSettings.md -docs/Model/PartnerGiroSettings.md docs/Model/PartnerList.md -docs/Model/PartnerPartnerShowType.md -docs/Model/PartnerShipping.md -docs/Model/PartnerShippingAddress.md -docs/Model/PartnerShowType.md docs/Model/PartnerTaxType.md docs/Model/PaymentHistory.md docs/Model/PaymentMethod.md @@ -92,7 +78,6 @@ docs/Model/PaymentStatus.md docs/Model/PaymentStatusSpending.md docs/Model/Product.md docs/Model/ProductList.md -docs/Model/ProductQuantity.md docs/Model/ReceiptInsert.md docs/Model/ReceiptInsertItemsInner.md docs/Model/ReceiptItemData.md @@ -102,7 +87,6 @@ docs/Model/SendDocument.md docs/Model/ServerError.md docs/Model/ServerErrorResponse.md docs/Model/ServerTime.md -docs/Model/ShippingMode.md docs/Model/Source.md docs/Model/Spending.md docs/Model/SpendingList.md @@ -118,241 +102,113 @@ docs/Model/UnitPriceType.md docs/Model/ValidationError.md docs/Model/ValidationErrorResponse.md docs/Model/Vat.md -lib/Api/BankAccountApi.php -lib/Api/CurrencyApi.php -lib/Api/DocumentApi.php -lib/Api/DocumentExportApi.php -lib/Api/InventoryApi.php -lib/Api/OrganizationApi.php -lib/Api/PartnerApi.php -lib/Api/ProductApi.php -lib/Api/SpendingApi.php -lib/Api/UtilApi.php -lib/ApiException.php -lib/Configuration.php -lib/HeaderSelector.php -lib/Model/Address.php -lib/Model/BankAccount.php -lib/Model/BankAccountList.php -lib/Model/Category.php -lib/Model/CheckTaxNumberMessage.php -lib/Model/ClientError.php -lib/Model/ClientErrorResponse.php -lib/Model/ConversationRate.php -lib/Model/CorrectionType.php -lib/Model/Country.php -lib/Model/CreateDocumentExport.php -lib/Model/Currency.php -lib/Model/DateType.php -lib/Model/Discount.php -lib/Model/DiscountType.php -lib/Model/Document.php -lib/Model/DocumentAncestor.php -lib/Model/DocumentBankAccount.php -lib/Model/DocumentBlock.php -lib/Model/DocumentBlockList.php -lib/Model/DocumentBlockType.php -lib/Model/DocumentCancellation.php -lib/Model/DocumentExportFilterExtra.php -lib/Model/DocumentExportId.php -lib/Model/DocumentExportOtherOptions.php -lib/Model/DocumentExportQueryType.php -lib/Model/DocumentExportSortBy.php -lib/Model/DocumentExportStatus.php -lib/Model/DocumentExportStatusState.php -lib/Model/DocumentExportType.php -lib/Model/DocumentForm.php -lib/Model/DocumentFormat.php -lib/Model/DocumentInsert.php -lib/Model/DocumentInsertInstantPaymentRequest.php -lib/Model/DocumentInsertItemsInner.php -lib/Model/DocumentInsertType.php -lib/Model/DocumentInstantPaymentRequest.php -lib/Model/DocumentItem.php -lib/Model/DocumentItemData.php -lib/Model/DocumentLanguage.php -lib/Model/DocumentList.php -lib/Model/DocumentNotificationStatus.php -lib/Model/DocumentOrganization.php -lib/Model/DocumentPartner.php -lib/Model/DocumentPartnerPartnerShipping.php -lib/Model/DocumentProductData.php -lib/Model/DocumentPublicUrl.php -lib/Model/DocumentSettings.php -lib/Model/DocumentSettingsDontSendToNavReason.php -lib/Model/DocumentSummary.php -lib/Model/DocumentType.php -lib/Model/DocumentVatRateSummary.php -lib/Model/DontSendToNavReason.php -lib/Model/Entitlement.php -lib/Model/Feature.php -lib/Model/Id.php -lib/Model/InvoiceSettings.php -lib/Model/LedgerNumberInformation.php -lib/Model/ModelInterface.php -lib/Model/ModificationDocumentInsert.php -lib/Model/Money.php -lib/Model/OnlinePayment.php -lib/Model/OnlineSzamlaStatus.php -lib/Model/OnlineSzamlaStatusEnum.php -lib/Model/OnlineSzamlaStatusMessage.php -lib/Model/OrganizationData.php -lib/Model/Partner.php -lib/Model/PartnerCustomBillingSettings.php -lib/Model/PartnerGiroSettings.php -lib/Model/PartnerList.php -lib/Model/PartnerPartnerShowType.php -lib/Model/PartnerShipping.php -lib/Model/PartnerShippingAddress.php -lib/Model/PartnerShowType.php -lib/Model/PartnerTaxType.php -lib/Model/PaymentHistory.php -lib/Model/PaymentMethod.php -lib/Model/PaymentStatus.php -lib/Model/PaymentStatusSpending.php -lib/Model/Product.php -lib/Model/ProductList.php -lib/Model/ProductQuantity.php -lib/Model/ReceiptInsert.php -lib/Model/ReceiptInsertItemsInner.php -lib/Model/ReceiptItemData.php -lib/Model/ReceiptProductData.php -lib/Model/Round.php -lib/Model/SendDocument.php -lib/Model/ServerError.php -lib/Model/ServerErrorResponse.php -lib/Model/ServerTime.php -lib/Model/ShippingMode.php -lib/Model/Source.php -lib/Model/Spending.php -lib/Model/SpendingList.php -lib/Model/SpendingListItem.php -lib/Model/SpendingPartner.php -lib/Model/SpendingPaymentMethod.php -lib/Model/SpendingSave.php -lib/Model/Subscription.php -lib/Model/SubscriptionErrorResponse.php -lib/Model/TaxNumber.php -lib/Model/TooManyRequestsResponse.php -lib/Model/UnitPriceType.php -lib/Model/ValidationError.php -lib/Model/ValidationErrorResponse.php -lib/Model/Vat.php -lib/ObjectSerializer.php phpunit.xml.dist -test/Api/BankAccountApiTest.php -test/Api/CurrencyApiTest.php -test/Api/DocumentApiTest.php -test/Api/DocumentExportApiTest.php -test/Api/InventoryApiTest.php -test/Api/OrganizationApiTest.php -test/Api/PartnerApiTest.php -test/Api/ProductApiTest.php -test/Api/SpendingApiTest.php -test/Api/UtilApiTest.php -test/Model/AddressTest.php -test/Model/BankAccountListTest.php -test/Model/BankAccountTest.php -test/Model/CategoryTest.php -test/Model/CheckTaxNumberMessageTest.php -test/Model/ClientErrorResponseTest.php -test/Model/ClientErrorTest.php -test/Model/ConversationRateTest.php -test/Model/CorrectionTypeTest.php -test/Model/CountryTest.php -test/Model/CreateDocumentExportTest.php -test/Model/CurrencyTest.php -test/Model/DateTypeTest.php -test/Model/DiscountTest.php -test/Model/DiscountTypeTest.php -test/Model/DocumentAncestorTest.php -test/Model/DocumentBankAccountTest.php -test/Model/DocumentBlockListTest.php -test/Model/DocumentBlockTest.php -test/Model/DocumentBlockTypeTest.php -test/Model/DocumentCancellationTest.php -test/Model/DocumentExportFilterExtraTest.php -test/Model/DocumentExportIdTest.php -test/Model/DocumentExportOtherOptionsTest.php -test/Model/DocumentExportQueryTypeTest.php -test/Model/DocumentExportSortByTest.php -test/Model/DocumentExportStatusStateTest.php -test/Model/DocumentExportStatusTest.php -test/Model/DocumentExportTypeTest.php -test/Model/DocumentFormTest.php -test/Model/DocumentFormatTest.php -test/Model/DocumentInsertInstantPaymentRequestTest.php -test/Model/DocumentInsertItemsInnerTest.php -test/Model/DocumentInsertTest.php -test/Model/DocumentInsertTypeTest.php -test/Model/DocumentInstantPaymentRequestTest.php -test/Model/DocumentItemDataTest.php -test/Model/DocumentItemTest.php -test/Model/DocumentLanguageTest.php -test/Model/DocumentListTest.php -test/Model/DocumentNotificationStatusTest.php -test/Model/DocumentOrganizationTest.php -test/Model/DocumentPartnerPartnerShippingTest.php -test/Model/DocumentPartnerTest.php -test/Model/DocumentProductDataTest.php -test/Model/DocumentPublicUrlTest.php -test/Model/DocumentSettingsDontSendToNavReasonTest.php -test/Model/DocumentSettingsTest.php -test/Model/DocumentSummaryTest.php -test/Model/DocumentTest.php -test/Model/DocumentTypeTest.php -test/Model/DocumentVatRateSummaryTest.php -test/Model/DontSendToNavReasonTest.php -test/Model/EntitlementTest.php -test/Model/FeatureTest.php -test/Model/IdTest.php -test/Model/InvoiceSettingsTest.php -test/Model/LedgerNumberInformationTest.php -test/Model/ModificationDocumentInsertTest.php -test/Model/MoneyTest.php -test/Model/OnlinePaymentTest.php -test/Model/OnlineSzamlaStatusEnumTest.php -test/Model/OnlineSzamlaStatusMessageTest.php -test/Model/OnlineSzamlaStatusTest.php -test/Model/OrganizationDataTest.php -test/Model/PartnerCustomBillingSettingsTest.php -test/Model/PartnerGiroSettingsTest.php -test/Model/PartnerListTest.php -test/Model/PartnerPartnerShowTypeTest.php -test/Model/PartnerShippingAddressTest.php -test/Model/PartnerShippingTest.php -test/Model/PartnerShowTypeTest.php -test/Model/PartnerTaxTypeTest.php -test/Model/PartnerTest.php -test/Model/PaymentHistoryTest.php -test/Model/PaymentMethodTest.php -test/Model/PaymentStatusSpendingTest.php -test/Model/PaymentStatusTest.php -test/Model/ProductListTest.php -test/Model/ProductQuantityTest.php -test/Model/ProductTest.php -test/Model/ReceiptInsertItemsInnerTest.php -test/Model/ReceiptInsertTest.php -test/Model/ReceiptItemDataTest.php -test/Model/ReceiptProductDataTest.php -test/Model/RoundTest.php -test/Model/SendDocumentTest.php -test/Model/ServerErrorResponseTest.php -test/Model/ServerErrorTest.php -test/Model/ServerTimeTest.php -test/Model/ShippingModeTest.php -test/Model/SourceTest.php -test/Model/SpendingListItemTest.php -test/Model/SpendingListTest.php -test/Model/SpendingPartnerTest.php -test/Model/SpendingPaymentMethodTest.php -test/Model/SpendingSaveTest.php -test/Model/SpendingTest.php -test/Model/SubscriptionErrorResponseTest.php -test/Model/SubscriptionTest.php -test/Model/TaxNumberTest.php -test/Model/TooManyRequestsResponseTest.php -test/Model/UnitPriceTypeTest.php -test/Model/ValidationErrorResponseTest.php -test/Model/ValidationErrorTest.php -test/Model/VatTest.php +src/Api/BankAccountApi.php +src/Api/CurrencyApi.php +src/Api/DocumentApi.php +src/Api/DocumentBlockApi.php +src/Api/DocumentExportApi.php +src/Api/OrganizationApi.php +src/Api/PartnerApi.php +src/Api/ProductApi.php +src/Api/SpendingApi.php +src/Api/UtilApi.php +src/ApiException.php +src/Configuration.php +src/HeaderSelector.php +src/Model/Address.php +src/Model/BankAccount.php +src/Model/BankAccountList.php +src/Model/Category.php +src/Model/CheckTaxNumberMessage.php +src/Model/ClientError.php +src/Model/ClientErrorResponse.php +src/Model/ConversationRate.php +src/Model/CorrectionType.php +src/Model/Country.php +src/Model/CreateDocumentExport.php +src/Model/Currency.php +src/Model/DateType.php +src/Model/Discount.php +src/Model/DiscountType.php +src/Model/Document.php +src/Model/DocumentAncestor.php +src/Model/DocumentBankAccount.php +src/Model/DocumentBlock.php +src/Model/DocumentBlockList.php +src/Model/DocumentBlockType.php +src/Model/DocumentCancellation.php +src/Model/DocumentExportFilterExtra.php +src/Model/DocumentExportId.php +src/Model/DocumentExportOtherOptions.php +src/Model/DocumentExportQueryType.php +src/Model/DocumentExportSortBy.php +src/Model/DocumentExportStatus.php +src/Model/DocumentExportStatusState.php +src/Model/DocumentExportType.php +src/Model/DocumentForm.php +src/Model/DocumentFormat.php +src/Model/DocumentInsert.php +src/Model/DocumentInsertItemsInner.php +src/Model/DocumentInsertType.php +src/Model/DocumentItem.php +src/Model/DocumentItemData.php +src/Model/DocumentLanguage.php +src/Model/DocumentList.php +src/Model/DocumentNotificationStatus.php +src/Model/DocumentOrganization.php +src/Model/DocumentPartner.php +src/Model/DocumentProductData.php +src/Model/DocumentPublicUrl.php +src/Model/DocumentSettings.php +src/Model/DocumentSummary.php +src/Model/DocumentType.php +src/Model/DocumentVatRateSummary.php +src/Model/Entitlement.php +src/Model/Feature.php +src/Model/Id.php +src/Model/InvoiceSettings.php +src/Model/LedgerNumberInformation.php +src/Model/ModelInterface.php +src/Model/ModificationDocumentInsert.php +src/Model/OnlinePayment.php +src/Model/OnlineSzamlaStatus.php +src/Model/OnlineSzamlaStatusEnum.php +src/Model/OnlineSzamlaStatusMessage.php +src/Model/OrganizationData.php +src/Model/Partner.php +src/Model/PartnerCustomBillingSettings.php +src/Model/PartnerList.php +src/Model/PartnerTaxType.php +src/Model/PaymentHistory.php +src/Model/PaymentMethod.php +src/Model/PaymentStatus.php +src/Model/PaymentStatusSpending.php +src/Model/Product.php +src/Model/ProductList.php +src/Model/ReceiptInsert.php +src/Model/ReceiptInsertItemsInner.php +src/Model/ReceiptItemData.php +src/Model/ReceiptProductData.php +src/Model/Round.php +src/Model/SendDocument.php +src/Model/ServerError.php +src/Model/ServerErrorResponse.php +src/Model/ServerTime.php +src/Model/Source.php +src/Model/Spending.php +src/Model/SpendingList.php +src/Model/SpendingListItem.php +src/Model/SpendingPartner.php +src/Model/SpendingPaymentMethod.php +src/Model/SpendingSave.php +src/Model/Subscription.php +src/Model/SubscriptionErrorResponse.php +src/Model/TaxNumber.php +src/Model/TooManyRequestsResponse.php +src/Model/UnitPriceType.php +src/Model/ValidationError.php +src/Model/ValidationErrorResponse.php +src/Model/Vat.php +src/ObjectSerializer.php +test/Api/DocumentBlockApiTest.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index cd802a1..3769235 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -6.6.0 \ No newline at end of file +7.1.0 \ No newline at end of file diff --git a/docs/Api/BankAccountApi.md b/docs/Api/BankAccountApi.md index 5558152..ceb6b40 100644 --- a/docs/Api/BankAccountApi.md +++ b/docs/Api/BankAccountApi.md @@ -14,7 +14,7 @@ All URIs are relative to https://api.billingo.hu/v3, except if the operation def ## `createBankAccount()` ```php -createBankAccount($bank_account): \Cone\Billingo\Model\BankAccount +createBankAccount($bankAccount): \Cone\Billingo\Model\BankAccount ``` Create a bank account @@ -40,10 +40,10 @@ $apiInstance = new Cone\Billingo\Api\BankAccountApi( new GuzzleHttp\Client(), $config ); -$bank_account = new \Cone\Billingo\Model\BankAccount(); // \Cone\Billingo\Model\BankAccount | BankAccount object that you would like to store. +$bankAccount = new \Cone\Billingo\Model\BankAccount(); // \Cone\Billingo\Model\BankAccount | BankAccount object that you would like to store. try { - $result = $apiInstance->createBankAccount($bank_account); + $result = $apiInstance->createBankAccount($bankAccount); print_r($result); } catch (Exception $e) { echo 'Exception when calling BankAccountApi->createBankAccount: ', $e->getMessage(), PHP_EOL; @@ -54,7 +54,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **bank_account** | [**\Cone\Billingo\Model\BankAccount**](../Model/BankAccount.md)| BankAccount object that you would like to store. | | +| **bankAccount** | [**\Cone\Billingo\Model\BankAccount**](../Model/BankAccount.md)| BankAccount object that you would like to store. | | ### Return type @@ -199,7 +199,7 @@ try { ## `listBankAccount()` ```php -listBankAccount($page, $per_page): \Cone\Billingo\Model\BankAccountList +listBankAccount($page, $perPage): \Cone\Billingo\Model\BankAccountList ``` List all bank account @@ -226,10 +226,10 @@ $apiInstance = new Cone\Billingo\Api\BankAccountApi( $config ); $page = 56; // int -$per_page = 25; // int +$perPage = 25; // int try { - $result = $apiInstance->listBankAccount($page, $per_page); + $result = $apiInstance->listBankAccount($page, $perPage); print_r($result); } catch (Exception $e) { echo 'Exception when calling BankAccountApi->listBankAccount: ', $e->getMessage(), PHP_EOL; @@ -241,7 +241,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **page** | **int**| | [optional] | -| **per_page** | **int**| | [optional] [default to 25] | +| **perPage** | **int**| | [optional] [default to 25] | ### Return type @@ -263,7 +263,7 @@ try { ## `updateBankAccount()` ```php -updateBankAccount($id, $bank_account): \Cone\Billingo\Model\BankAccount +updateBankAccount($id, $bankAccount): \Cone\Billingo\Model\BankAccount ``` Update a bank account @@ -290,10 +290,10 @@ $apiInstance = new Cone\Billingo\Api\BankAccountApi( $config ); $id = 56; // int -$bank_account = new \Cone\Billingo\Model\BankAccount(); // \Cone\Billingo\Model\BankAccount | Bank account object that you would like to update. +$bankAccount = new \Cone\Billingo\Model\BankAccount(); // \Cone\Billingo\Model\BankAccount | Bank account object that you would like to update. try { - $result = $apiInstance->updateBankAccount($id, $bank_account); + $result = $apiInstance->updateBankAccount($id, $bankAccount); print_r($result); } catch (Exception $e) { echo 'Exception when calling BankAccountApi->updateBankAccount: ', $e->getMessage(), PHP_EOL; @@ -305,7 +305,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **id** | **int**| | | -| **bank_account** | [**\Cone\Billingo\Model\BankAccount**](../Model/BankAccount.md)| Bank account object that you would like to update. | | +| **bankAccount** | [**\Cone\Billingo\Model\BankAccount**](../Model/BankAccount.md)| Bank account object that you would like to update. | | ### Return type diff --git a/docs/Api/DocumentApi.md b/docs/Api/DocumentApi.md index 27bda15..e41fbae 100644 --- a/docs/Api/DocumentApi.md +++ b/docs/Api/DocumentApi.md @@ -91,7 +91,7 @@ void (empty response body) ## `cancelDocument()` ```php -cancelDocument($id, $document_cancellation): \Cone\Billingo\Model\Document +cancelDocument($id, $documentCancellation): \Cone\Billingo\Model\Document ``` Cancel a document @@ -118,10 +118,10 @@ $apiInstance = new Cone\Billingo\Api\DocumentApi( $config ); $id = 56; // int -$document_cancellation = new \Cone\Billingo\Model\DocumentCancellation(); // \Cone\Billingo\Model\DocumentCancellation | Comment and notifiable email addresses - comma separated for multiple email addresses +$documentCancellation = new \Cone\Billingo\Model\DocumentCancellation(); // \Cone\Billingo\Model\DocumentCancellation | Comment and notifiable email addresses - comma separated for multiple email addresses try { - $result = $apiInstance->cancelDocument($id, $document_cancellation); + $result = $apiInstance->cancelDocument($id, $documentCancellation); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentApi->cancelDocument: ', $e->getMessage(), PHP_EOL; @@ -133,7 +133,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **id** | **int**| | | -| **document_cancellation** | [**\Cone\Billingo\Model\DocumentCancellation**](../Model/DocumentCancellation.md)| Comment and notifiable email addresses - comma separated for multiple email addresses | [optional] | +| **documentCancellation** | [**\Cone\Billingo\Model\DocumentCancellation**](../Model/DocumentCancellation.md)| Comment and notifiable email addresses - comma separated for multiple email addresses | [optional] | ### Return type @@ -155,7 +155,7 @@ try { ## `createDocument()` ```php -createDocument($document_insert): \Cone\Billingo\Model\Document +createDocument($documentInsert): \Cone\Billingo\Model\Document ``` Create a document @@ -181,10 +181,10 @@ $apiInstance = new Cone\Billingo\Api\DocumentApi( new GuzzleHttp\Client(), $config ); -$document_insert = new \Cone\Billingo\Model\DocumentInsert(); // \Cone\Billingo\Model\DocumentInsert | DocumentInsert object that you would like to store. +$documentInsert = new \Cone\Billingo\Model\DocumentInsert(); // \Cone\Billingo\Model\DocumentInsert | DocumentInsert object that you would like to store. try { - $result = $apiInstance->createDocument($document_insert); + $result = $apiInstance->createDocument($documentInsert); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentApi->createDocument: ', $e->getMessage(), PHP_EOL; @@ -195,7 +195,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **document_insert** | [**\Cone\Billingo\Model\DocumentInsert**](../Model/DocumentInsert.md)| DocumentInsert object that you would like to store. | | +| **documentInsert** | [**\Cone\Billingo\Model\DocumentInsert**](../Model/DocumentInsert.md)| DocumentInsert object that you would like to store. | | ### Return type @@ -217,7 +217,7 @@ try { ## `createDocumentFromDraft()` ```php -createDocumentFromDraft($id, $document_insert): \Cone\Billingo\Model\Document +createDocumentFromDraft($id, $documentInsert): \Cone\Billingo\Model\Document ``` Converts a draft to an invoice. @@ -244,10 +244,10 @@ $apiInstance = new Cone\Billingo\Api\DocumentApi( $config ); $id = 56; // int -$document_insert = new \Cone\Billingo\Model\DocumentInsert(); // \Cone\Billingo\Model\DocumentInsert | DocumentInsert object that you would like to store. +$documentInsert = new \Cone\Billingo\Model\DocumentInsert(); // \Cone\Billingo\Model\DocumentInsert | DocumentInsert object that you would like to store. try { - $result = $apiInstance->createDocumentFromDraft($id, $document_insert); + $result = $apiInstance->createDocumentFromDraft($id, $documentInsert); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentApi->createDocumentFromDraft: ', $e->getMessage(), PHP_EOL; @@ -259,7 +259,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **id** | **int**| | | -| **document_insert** | [**\Cone\Billingo\Model\DocumentInsert**](../Model/DocumentInsert.md)| DocumentInsert object that you would like to store. | | +| **documentInsert** | [**\Cone\Billingo\Model\DocumentInsert**](../Model/DocumentInsert.md)| DocumentInsert object that you would like to store. | | ### Return type @@ -281,7 +281,7 @@ try { ## `createDocumentFromProforma()` ```php -createDocumentFromProforma($id, $invoice_settings): \Cone\Billingo\Model\Document +createDocumentFromProforma($id, $invoiceSettings): \Cone\Billingo\Model\Document ``` Create a document from proforma. @@ -308,10 +308,10 @@ $apiInstance = new Cone\Billingo\Api\DocumentApi( $config ); $id = 56; // int -$invoice_settings = new \Cone\Billingo\Model\InvoiceSettings(); // \Cone\Billingo\Model\InvoiceSettings | InvoiceSettings object. +$invoiceSettings = new \Cone\Billingo\Model\InvoiceSettings(); // \Cone\Billingo\Model\InvoiceSettings | InvoiceSettings object. try { - $result = $apiInstance->createDocumentFromProforma($id, $invoice_settings); + $result = $apiInstance->createDocumentFromProforma($id, $invoiceSettings); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentApi->createDocumentFromProforma: ', $e->getMessage(), PHP_EOL; @@ -323,7 +323,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **id** | **int**| | | -| **invoice_settings** | [**\Cone\Billingo\Model\InvoiceSettings**](../Model/InvoiceSettings.md)| InvoiceSettings object. | [optional] | +| **invoiceSettings** | [**\Cone\Billingo\Model\InvoiceSettings**](../Model/InvoiceSettings.md)| InvoiceSettings object. | [optional] | ### Return type @@ -345,7 +345,7 @@ try { ## `createModificationDocument()` ```php -createModificationDocument($id, $modification_document_insert): \Cone\Billingo\Model\Document +createModificationDocument($id, $modificationDocumentInsert): \Cone\Billingo\Model\Document ``` Create a modification document. @@ -372,10 +372,10 @@ $apiInstance = new Cone\Billingo\Api\DocumentApi( $config ); $id = 56; // int -$modification_document_insert = new \Cone\Billingo\Model\ModificationDocumentInsert(); // \Cone\Billingo\Model\ModificationDocumentInsert | ModificationDocumentInsert object that you would like to store. +$modificationDocumentInsert = new \Cone\Billingo\Model\ModificationDocumentInsert(); // \Cone\Billingo\Model\ModificationDocumentInsert | ModificationDocumentInsert object that you would like to store. try { - $result = $apiInstance->createModificationDocument($id, $modification_document_insert); + $result = $apiInstance->createModificationDocument($id, $modificationDocumentInsert); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentApi->createModificationDocument: ', $e->getMessage(), PHP_EOL; @@ -387,7 +387,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **id** | **int**| | | -| **modification_document_insert** | [**\Cone\Billingo\Model\ModificationDocumentInsert**](../Model/ModificationDocumentInsert.md)| ModificationDocumentInsert object that you would like to store. | | +| **modificationDocumentInsert** | [**\Cone\Billingo\Model\ModificationDocumentInsert**](../Model/ModificationDocumentInsert.md)| ModificationDocumentInsert object that you would like to store. | | ### Return type @@ -409,7 +409,7 @@ try { ## `createReceipt()` ```php -createReceipt($receipt_insert): \Cone\Billingo\Model\Document +createReceipt($receiptInsert): \Cone\Billingo\Model\Document ``` Create a receipt @@ -435,10 +435,10 @@ $apiInstance = new Cone\Billingo\Api\DocumentApi( new GuzzleHttp\Client(), $config ); -$receipt_insert = new \Cone\Billingo\Model\ReceiptInsert(); // \Cone\Billingo\Model\ReceiptInsert | ReceiptInsert object that you would like to store. +$receiptInsert = new \Cone\Billingo\Model\ReceiptInsert(); // \Cone\Billingo\Model\ReceiptInsert | ReceiptInsert object that you would like to store. try { - $result = $apiInstance->createReceipt($receipt_insert); + $result = $apiInstance->createReceipt($receiptInsert); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentApi->createReceipt: ', $e->getMessage(), PHP_EOL; @@ -449,7 +449,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **receipt_insert** | [**\Cone\Billingo\Model\ReceiptInsert**](../Model/ReceiptInsert.md)| ReceiptInsert object that you would like to store. | | +| **receiptInsert** | [**\Cone\Billingo\Model\ReceiptInsert**](../Model/ReceiptInsert.md)| ReceiptInsert object that you would like to store. | | ### Return type @@ -471,7 +471,7 @@ try { ## `createReceiptFromDraft()` ```php -createReceiptFromDraft($id, $receipt_insert): \Cone\Billingo\Model\Document +createReceiptFromDraft($id, $receiptInsert): \Cone\Billingo\Model\Document ``` Converts a draft to a receipt. @@ -498,10 +498,10 @@ $apiInstance = new Cone\Billingo\Api\DocumentApi( $config ); $id = 56; // int -$receipt_insert = new \Cone\Billingo\Model\ReceiptInsert(); // \Cone\Billingo\Model\ReceiptInsert | ReceiptInsert object that you would like to store. +$receiptInsert = new \Cone\Billingo\Model\ReceiptInsert(); // \Cone\Billingo\Model\ReceiptInsert | ReceiptInsert object that you would like to store. try { - $result = $apiInstance->createReceiptFromDraft($id, $receipt_insert); + $result = $apiInstance->createReceiptFromDraft($id, $receiptInsert); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentApi->createReceiptFromDraft: ', $e->getMessage(), PHP_EOL; @@ -513,7 +513,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **id** | **int**| | | -| **receipt_insert** | [**\Cone\Billingo\Model\ReceiptInsert**](../Model/ReceiptInsert.md)| ReceiptInsert object that you would like to store. | | +| **receiptInsert** | [**\Cone\Billingo\Model\ReceiptInsert**](../Model/ReceiptInsert.md)| ReceiptInsert object that you would like to store. | | ### Return type @@ -844,7 +844,7 @@ try { ## `getDocumentByVendorId()` ```php -getDocumentByVendorId($vendor_id): \Cone\Billingo\Model\Document +getDocumentByVendorId($vendorId): \Cone\Billingo\Model\Document ``` Retrieve a document by vendor id @@ -870,10 +870,10 @@ $apiInstance = new Cone\Billingo\Api\DocumentApi( new GuzzleHttp\Client(), $config ); -$vendor_id = 'vendor_id_example'; // string +$vendorId = 'vendorId_example'; // string try { - $result = $apiInstance->getDocumentByVendorId($vendor_id); + $result = $apiInstance->getDocumentByVendorId($vendorId); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentApi->getDocumentByVendorId: ', $e->getMessage(), PHP_EOL; @@ -884,7 +884,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **vendor_id** | **string**| | | +| **vendorId** | **string**| | | ### Return type @@ -1092,7 +1092,7 @@ try { ## `listDocument()` ```php -listDocument($page, $per_page, $block_id, $partner_id, $payment_method, $payment_status, $start_date, $end_date, $start_number, $end_number, $start_year, $end_year, $type, $query, $paid_start_date, $paid_end_date, $fulfillment_start_date, $fulfillment_end_date, $last_modified_date): \Cone\Billingo\Model\DocumentList +listDocument($page, $perPage, $blockId, $partnerId, $paymentMethod, $paymentStatus, $startDate, $endDate, $startNumber, $endNumber, $startYear, $endYear, $type, $query, $paidStartDate, $paidEndDate, $fulfillmentStartDate, $fulfillmentEndDate, $lastModifiedDate): \Cone\Billingo\Model\DocumentList ``` List all documents @@ -1119,27 +1119,27 @@ $apiInstance = new Cone\Billingo\Api\DocumentApi( $config ); $page = 56; // int -$per_page = 25; // int -$block_id = 56; // int | Filter documents by the identifier of your DocumentBlock. -$partner_id = 56; // int | Filter documents by the identifier of your Partner. -$payment_method = cash; // PaymentMethod | Filter documents by PaymentMethod value. -$payment_status = paid; // PaymentStatus | Filter documents by PaymentStatus value. -$start_date = 2020-05-15; // \DateTime | Filter documents by their invoice date. -$end_date = 2020-05-15; // \DateTime | Filter documents by their invoice date. -$start_number = 1; // int | Starting number of the document, should not contain year or any other formatting. Required if `start_year` given -$end_number = 10; // int | Ending number of the document, should not contain year or any other formatting. Required if `end_year` given -$start_year = 2020; // int | Year for `start_number` parameter. Required if `start_number` given. -$end_year = 2020; // int | Year for `end_number` parameter. Required if `end_number` given. +$perPage = 25; // int +$blockId = 56; // int | Filter documents by the identifier of your DocumentBlock. +$partnerId = 56; // int | Filter documents by the identifier of your Partner. +$paymentMethod = cash; // PaymentMethod | Filter documents by PaymentMethod value. +$paymentStatus = paid; // PaymentStatus | Filter documents by PaymentStatus value. +$startDate = 2020-05-15; // \DateTime | Filter documents by their invoice date. +$endDate = 2020-05-15; // \DateTime | Filter documents by their invoice date. +$startNumber = 1; // int | Starting number of the document, should not contain year or any other formatting. Required if `start_year` given +$endNumber = 10; // int | Ending number of the document, should not contain year or any other formatting. Required if `end_year` given +$startYear = 2020; // int | Year for `start_number` parameter. Required if `start_number` given. +$endYear = 2020; // int | Year for `end_number` parameter. Required if `end_number` given. $type = invoice; // DocumentType | Filter documents by type $query = 'query_example'; // string | Filter documents by the given text -$paid_start_date = 2020-05-15; // \DateTime | Filter documents by their payment date. -$paid_end_date = 2020-05-15; // \DateTime | Filter documents by their payment date. -$fulfillment_start_date = 2020-05-15; // \DateTime | Filter documents by their fulfillment date. -$fulfillment_end_date = 2020-05-15; // \DateTime | Filter documents by their fulfillment date. -$last_modified_date = 2021-09-03 11:27:00; // string | Filter documents by their last modified date. +$paidStartDate = 2020-05-15; // \DateTime | Filter documents by their payment date. +$paidEndDate = 2020-05-15; // \DateTime | Filter documents by their payment date. +$fulfillmentStartDate = 2020-05-15; // \DateTime | Filter documents by their fulfillment date. +$fulfillmentEndDate = 2020-05-15; // \DateTime | Filter documents by their fulfillment date. +$lastModifiedDate = 2021-09-03 11:27:00; // string | Filter documents by their last modified date. try { - $result = $apiInstance->listDocument($page, $per_page, $block_id, $partner_id, $payment_method, $payment_status, $start_date, $end_date, $start_number, $end_number, $start_year, $end_year, $type, $query, $paid_start_date, $paid_end_date, $fulfillment_start_date, $fulfillment_end_date, $last_modified_date); + $result = $apiInstance->listDocument($page, $perPage, $blockId, $partnerId, $paymentMethod, $paymentStatus, $startDate, $endDate, $startNumber, $endNumber, $startYear, $endYear, $type, $query, $paidStartDate, $paidEndDate, $fulfillmentStartDate, $fulfillmentEndDate, $lastModifiedDate); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentApi->listDocument: ', $e->getMessage(), PHP_EOL; @@ -1151,24 +1151,24 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **page** | **int**| | [optional] | -| **per_page** | **int**| | [optional] [default to 25] | -| **block_id** | **int**| Filter documents by the identifier of your DocumentBlock. | [optional] | -| **partner_id** | **int**| Filter documents by the identifier of your Partner. | [optional] | -| **payment_method** | [**PaymentMethod**](../Model/.md)| Filter documents by PaymentMethod value. | [optional] | -| **payment_status** | [**PaymentStatus**](../Model/.md)| Filter documents by PaymentStatus value. | [optional] | -| **start_date** | **\DateTime**| Filter documents by their invoice date. | [optional] | -| **end_date** | **\DateTime**| Filter documents by their invoice date. | [optional] | -| **start_number** | **int**| Starting number of the document, should not contain year or any other formatting. Required if `start_year` given | [optional] | -| **end_number** | **int**| Ending number of the document, should not contain year or any other formatting. Required if `end_year` given | [optional] | -| **start_year** | **int**| Year for `start_number` parameter. Required if `start_number` given. | [optional] | -| **end_year** | **int**| Year for `end_number` parameter. Required if `end_number` given. | [optional] | +| **perPage** | **int**| | [optional] [default to 25] | +| **blockId** | **int**| Filter documents by the identifier of your DocumentBlock. | [optional] | +| **partnerId** | **int**| Filter documents by the identifier of your Partner. | [optional] | +| **paymentMethod** | [**PaymentMethod**](../Model/.md)| Filter documents by PaymentMethod value. | [optional] | +| **paymentStatus** | [**PaymentStatus**](../Model/.md)| Filter documents by PaymentStatus value. | [optional] | +| **startDate** | **\DateTime**| Filter documents by their invoice date. | [optional] | +| **endDate** | **\DateTime**| Filter documents by their invoice date. | [optional] | +| **startNumber** | **int**| Starting number of the document, should not contain year or any other formatting. Required if `start_year` given | [optional] | +| **endNumber** | **int**| Ending number of the document, should not contain year or any other formatting. Required if `end_year` given | [optional] | +| **startYear** | **int**| Year for `start_number` parameter. Required if `start_number` given. | [optional] | +| **endYear** | **int**| Year for `end_number` parameter. Required if `end_number` given. | [optional] | | **type** | [**DocumentType**](../Model/.md)| Filter documents by type | [optional] | | **query** | **string**| Filter documents by the given text | [optional] | -| **paid_start_date** | **\DateTime**| Filter documents by their payment date. | [optional] | -| **paid_end_date** | **\DateTime**| Filter documents by their payment date. | [optional] | -| **fulfillment_start_date** | **\DateTime**| Filter documents by their fulfillment date. | [optional] | -| **fulfillment_end_date** | **\DateTime**| Filter documents by their fulfillment date. | [optional] | -| **last_modified_date** | **string**| Filter documents by their last modified date. | [optional] | +| **paidStartDate** | **\DateTime**| Filter documents by their payment date. | [optional] | +| **paidEndDate** | **\DateTime**| Filter documents by their payment date. | [optional] | +| **fulfillmentStartDate** | **\DateTime**| Filter documents by their fulfillment date. | [optional] | +| **fulfillmentEndDate** | **\DateTime**| Filter documents by their fulfillment date. | [optional] | +| **lastModifiedDate** | **string**| Filter documents by their last modified date. | [optional] | ### Return type @@ -1254,7 +1254,7 @@ try { ## `sendDocument()` ```php -sendDocument($id, $send_document): \Cone\Billingo\Model\SendDocument +sendDocument($id, $sendDocument): \Cone\Billingo\Model\SendDocument ``` Send invoice to given email adresses. @@ -1281,10 +1281,10 @@ $apiInstance = new Cone\Billingo\Api\DocumentApi( $config ); $id = 56; // int -$send_document = new \Cone\Billingo\Model\SendDocument(); // \Cone\Billingo\Model\SendDocument | List of email-s where you want to send the invoice. +$sendDocument = new \Cone\Billingo\Model\SendDocument(); // \Cone\Billingo\Model\SendDocument | List of email-s where you want to send the invoice. try { - $result = $apiInstance->sendDocument($id, $send_document); + $result = $apiInstance->sendDocument($id, $sendDocument); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentApi->sendDocument: ', $e->getMessage(), PHP_EOL; @@ -1296,7 +1296,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **id** | **int**| | | -| **send_document** | [**\Cone\Billingo\Model\SendDocument**](../Model/SendDocument.md)| List of email-s where you want to send the invoice. | [optional] | +| **sendDocument** | [**\Cone\Billingo\Model\SendDocument**](../Model/SendDocument.md)| List of email-s where you want to send the invoice. | [optional] | ### Return type @@ -1318,7 +1318,7 @@ try { ## `updatePayment()` ```php -updatePayment($id, $payment_history): \Cone\Billingo\Model\PaymentHistory[] +updatePayment($id, $paymentHistory): \Cone\Billingo\Model\PaymentHistory[] ``` Update payment history @@ -1345,10 +1345,10 @@ $apiInstance = new Cone\Billingo\Api\DocumentApi( $config ); $id = 56; // int -$payment_history = array(new \Cone\Billingo\Model\PaymentHistory()); // \Cone\Billingo\Model\PaymentHistory[] | Payment history object that you would like to update. +$paymentHistory = array(new \Cone\Billingo\Model\PaymentHistory()); // \Cone\Billingo\Model\PaymentHistory[] | Payment history object that you would like to update. try { - $result = $apiInstance->updatePayment($id, $payment_history); + $result = $apiInstance->updatePayment($id, $paymentHistory); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentApi->updatePayment: ', $e->getMessage(), PHP_EOL; @@ -1360,7 +1360,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **id** | **int**| | | -| **payment_history** | [**\Cone\Billingo\Model\PaymentHistory[]**](../Model/PaymentHistory.md)| Payment history object that you would like to update. | | +| **paymentHistory** | [**\Cone\Billingo\Model\PaymentHistory[]**](../Model/PaymentHistory.md)| Payment history object that you would like to update. | | ### Return type diff --git a/docs/Api/DocumentBlockApi.md b/docs/Api/DocumentBlockApi.md new file mode 100644 index 0000000..0ec6103 --- /dev/null +++ b/docs/Api/DocumentBlockApi.md @@ -0,0 +1,74 @@ +# Cone\Billingo\DocumentBlockApi + +All URIs are relative to https://api.billingo.hu/v3, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**listDocumentBlock()**](DocumentBlockApi.md#listDocumentBlock) | **GET** /document-blocks | List all document blocks | + + +## `listDocumentBlock()` + +```php +listDocumentBlock($page, $perPage, $type): \Cone\Billingo\Model\DocumentBlockList +``` + +List all document blocks + +Returns a list of your document blocks. The document blocks are returned sorted by creation date, with the most recent document blocks appearing first. + +### Example + +```php +setApiKey('X-API-KEY', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Cone\Billingo\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer'); + + +$apiInstance = new Cone\Billingo\Api\DocumentBlockApi( + // 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 +); +$page = 56; // int +$perPage = 25; // int +$type = invoice; // DocumentBlockType | Filter document blocks by type + +try { + $result = $apiInstance->listDocumentBlock($page, $perPage, $type); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DocumentBlockApi->listDocumentBlock: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **page** | **int**| | [optional] | +| **perPage** | **int**| | [optional] [default to 25] | +| **type** | [**DocumentBlockType**](../Model/.md)| Filter document blocks by type | [optional] | + +### Return type + +[**\Cone\Billingo\Model\DocumentBlockList**](../Model/DocumentBlockList.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### 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/DocumentExportApi.md b/docs/Api/DocumentExportApi.md index 1b07518..cbbf66e 100644 --- a/docs/Api/DocumentExportApi.md +++ b/docs/Api/DocumentExportApi.md @@ -12,7 +12,7 @@ All URIs are relative to https://api.billingo.hu/v3, except if the operation def ## `create()` ```php -create($create_document_export): \Cone\Billingo\Model\DocumentExportId +create($createDocumentExport): \Cone\Billingo\Model\DocumentExportId ``` Create document export. @@ -38,10 +38,10 @@ $apiInstance = new Cone\Billingo\Api\DocumentExportApi( new GuzzleHttp\Client(), $config ); -$create_document_export = new \Cone\Billingo\Model\CreateDocumentExport(); // \Cone\Billingo\Model\CreateDocumentExport | Create document export body. +$createDocumentExport = new \Cone\Billingo\Model\CreateDocumentExport(); // \Cone\Billingo\Model\CreateDocumentExport | Create document export body. try { - $result = $apiInstance->create($create_document_export); + $result = $apiInstance->create($createDocumentExport); print_r($result); } catch (Exception $e) { echo 'Exception when calling DocumentExportApi->create: ', $e->getMessage(), PHP_EOL; @@ -52,7 +52,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **create_document_export** | [**\Cone\Billingo\Model\CreateDocumentExport**](../Model/CreateDocumentExport.md)| Create document export body. | | +| **createDocumentExport** | [**\Cone\Billingo\Model\CreateDocumentExport**](../Model/CreateDocumentExport.md)| Create document export body. | | ### Return type diff --git a/docs/Api/PartnerApi.md b/docs/Api/PartnerApi.md index c3cb8dd..ac1e28e 100644 --- a/docs/Api/PartnerApi.md +++ b/docs/Api/PartnerApi.md @@ -5,7 +5,10 @@ All URIs are relative to https://api.billingo.hu/v3, except if the operation def | Method | HTTP request | Description | | ------------- | ------------- | ------------- | | [**createPartner()**](PartnerApi.md#createPartner) | **POST** /partners | Create a partner | +| [**deletePartner()**](PartnerApi.md#deletePartner) | **DELETE** /partners/{id} | Delete a partner | +| [**getPartner()**](PartnerApi.md#getPartner) | **GET** /partners/{id} | Retrieve a partner | | [**listPartner()**](PartnerApi.md#listPartner) | **GET** /partners | List all partners | +| [**updatePartner()**](PartnerApi.md#updatePartner) | **PUT** /partners/{id} | Update a partner | ## `createPartner()` @@ -70,10 +73,133 @@ try { [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `deletePartner()` + +```php +deletePartner($id) +``` + +Delete a partner + +Delete an existing partner. + +### Example + +```php +setApiKey('X-API-KEY', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Cone\Billingo\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer'); + + +$apiInstance = new Cone\Billingo\Api\PartnerApi( + // 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 { + $apiInstance->deletePartner($id); +} catch (Exception $e) { + echo 'Exception when calling PartnerApi->deletePartner: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| | | + +### Return type + +void (empty response body) + +### Authorization + +[api_key](../../README.md#api_key) + +### 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) + +## `getPartner()` + +```php +getPartner($id): \Cone\Billingo\Model\Partner +``` + +Retrieve a partner + +Retrieves the details of an existing partner. + +### Example + +```php +setApiKey('X-API-KEY', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Cone\Billingo\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer'); + + +$apiInstance = new Cone\Billingo\Api\PartnerApi( + // 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->getPartner($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PartnerApi->getPartner: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| | | + +### Return type + +[**\Cone\Billingo\Model\Partner**](../Model/Partner.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### 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) + ## `listPartner()` ```php -listPartner($page, $per_page, $query): \Cone\Billingo\Model\PartnerList +listPartner($page, $perPage, $query): \Cone\Billingo\Model\PartnerList ``` List all partners @@ -100,11 +226,11 @@ $apiInstance = new Cone\Billingo\Api\PartnerApi( $config ); $page = 56; // int -$per_page = 25; // int +$perPage = 25; // int $query = 'query_example'; // string try { - $result = $apiInstance->listPartner($page, $per_page, $query); + $result = $apiInstance->listPartner($page, $perPage, $query); print_r($result); } catch (Exception $e) { echo 'Exception when calling PartnerApi->listPartner: ', $e->getMessage(), PHP_EOL; @@ -116,7 +242,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **page** | **int**| | [optional] | -| **per_page** | **int**| | [optional] [default to 25] | +| **perPage** | **int**| | [optional] [default to 25] | | **query** | **string**| | [optional] | ### Return type @@ -135,3 +261,67 @@ try { [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) + +## `updatePartner()` + +```php +updatePartner($id, $partner): \Cone\Billingo\Model\Partner +``` + +Update a partner + +Update an existing partner. Returns a partner object if the update is succeded. + +### Example + +```php +setApiKey('X-API-KEY', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Cone\Billingo\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer'); + + +$apiInstance = new Cone\Billingo\Api\PartnerApi( + // 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 +$partner = new \Cone\Billingo\Model\Partner(); // \Cone\Billingo\Model\Partner | Partner object that you would like to update. + +try { + $result = $apiInstance->updatePartner($id, $partner); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PartnerApi->updatePartner: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| | | +| **partner** | [**\Cone\Billingo\Model\Partner**](../Model/Partner.md)| Partner object that you would like to update. | | + +### Return type + +[**\Cone\Billingo\Model\Partner**](../Model/Partner.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### 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) diff --git a/docs/Api/ProductApi.md b/docs/Api/ProductApi.md index a5a4729..3a4b678 100644 --- a/docs/Api/ProductApi.md +++ b/docs/Api/ProductApi.md @@ -199,7 +199,7 @@ try { ## `listProduct()` ```php -listProduct($page, $per_page, $query): \Cone\Billingo\Model\ProductList +listProduct($page, $perPage, $query): \Cone\Billingo\Model\ProductList ``` List all product @@ -226,11 +226,11 @@ $apiInstance = new Cone\Billingo\Api\ProductApi( $config ); $page = 56; // int -$per_page = 25; // int +$perPage = 25; // int $query = 'query_example'; // string try { - $result = $apiInstance->listProduct($page, $per_page, $query); + $result = $apiInstance->listProduct($page, $perPage, $query); print_r($result); } catch (Exception $e) { echo 'Exception when calling ProductApi->listProduct: ', $e->getMessage(), PHP_EOL; @@ -242,7 +242,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **page** | **int**| | [optional] | -| **per_page** | **int**| | [optional] [default to 25] | +| **perPage** | **int**| | [optional] [default to 25] | | **query** | **string**| | [optional] | ### Return type diff --git a/docs/Api/SpendingApi.md b/docs/Api/SpendingApi.md index 4710645..de23800 100644 --- a/docs/Api/SpendingApi.md +++ b/docs/Api/SpendingApi.md @@ -75,7 +75,7 @@ void (empty response body) ## `spendingList()` ```php -spendingList($q, $page, $per_page, $spending_date, $start_date, $end_date, $payment_status, $spending_type, $categories, $currencies, $payment_methods): \Cone\Billingo\Model\SpendingList +spendingList($q, $page, $perPage, $spendingDate, $startDate, $endDate, $paymentStatus, $spendingType, $categories, $currencies, $paymentMethods): \Cone\Billingo\Model\SpendingList ``` Lists all spending @@ -103,18 +103,18 @@ $apiInstance = new Cone\Billingo\Api\SpendingApi( ); $q = ''; // string $page = 1; // int -$per_page = 25; // int -$spending_date = invoice_date; // DateType -$start_date = 2021-01-01; // string -$end_date = 2021-01-31; // string -$payment_status = paid; // PaymentStatusSpending -$spending_type = manual; // Source +$perPage = 25; // int +$spendingDate = invoice_date; // DateType +$startDate = 2021-01-01; // string +$endDate = 2021-01-31; // string +$paymentStatus = paid; // PaymentStatusSpending +$spendingType = manual; // Source $categories = overheads; // Category $currencies = HUF; // Currency -$payment_methods = cash; // PaymentMethod +$paymentMethods = cash; // PaymentMethod try { - $result = $apiInstance->spendingList($q, $page, $per_page, $spending_date, $start_date, $end_date, $payment_status, $spending_type, $categories, $currencies, $payment_methods); + $result = $apiInstance->spendingList($q, $page, $perPage, $spendingDate, $startDate, $endDate, $paymentStatus, $spendingType, $categories, $currencies, $paymentMethods); print_r($result); } catch (Exception $e) { echo 'Exception when calling SpendingApi->spendingList: ', $e->getMessage(), PHP_EOL; @@ -127,15 +127,15 @@ try { | ------------- | ------------- | ------------- | ------------- | | **q** | **string**| | [optional] [default to ''] | | **page** | **int**| | [optional] [default to 1] | -| **per_page** | **int**| | [optional] [default to 25] | -| **spending_date** | [**DateType**](../Model/.md)| | [optional] | -| **start_date** | **string**| | [optional] | -| **end_date** | **string**| | [optional] | -| **payment_status** | [**PaymentStatusSpending**](../Model/.md)| | [optional] | -| **spending_type** | [**Source**](../Model/.md)| | [optional] | +| **perPage** | **int**| | [optional] [default to 25] | +| **spendingDate** | [**DateType**](../Model/.md)| | [optional] | +| **startDate** | **string**| | [optional] | +| **endDate** | **string**| | [optional] | +| **paymentStatus** | [**PaymentStatusSpending**](../Model/.md)| | [optional] | +| **spendingType** | [**Source**](../Model/.md)| | [optional] | | **categories** | [**Category**](../Model/.md)| | [optional] | | **currencies** | [**Currency**](../Model/.md)| | [optional] | -| **payment_methods** | [**PaymentMethod**](../Model/.md)| | [optional] | +| **paymentMethods** | [**PaymentMethod**](../Model/.md)| | [optional] | ### Return type @@ -157,7 +157,7 @@ try { ## `spendingSave()` ```php -spendingSave($spending_save): \Cone\Billingo\Model\Spending +spendingSave($spendingSave): \Cone\Billingo\Model\Spending ``` Creates a new spending. @@ -181,10 +181,10 @@ $apiInstance = new Cone\Billingo\Api\SpendingApi( new GuzzleHttp\Client(), $config ); -$spending_save = new \Cone\Billingo\Model\SpendingSave(); // \Cone\Billingo\Model\SpendingSave +$spendingSave = new \Cone\Billingo\Model\SpendingSave(); // \Cone\Billingo\Model\SpendingSave try { - $result = $apiInstance->spendingSave($spending_save); + $result = $apiInstance->spendingSave($spendingSave); print_r($result); } catch (Exception $e) { echo 'Exception when calling SpendingApi->spendingSave: ', $e->getMessage(), PHP_EOL; @@ -195,7 +195,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **spending_save** | [**\Cone\Billingo\Model\SpendingSave**](../Model/SpendingSave.md)| | [optional] | +| **spendingSave** | [**\Cone\Billingo\Model\SpendingSave**](../Model/SpendingSave.md)| | [optional] | ### Return type @@ -279,7 +279,7 @@ try { ## `spendingUpdate()` ```php -spendingUpdate($id, $spending_save): \Cone\Billingo\Model\Spending +spendingUpdate($id, $spendingSave): \Cone\Billingo\Model\Spending ``` Updates a spending item. @@ -306,10 +306,10 @@ $apiInstance = new Cone\Billingo\Api\SpendingApi( $config ); $id = 56; // int -$spending_save = new \Cone\Billingo\Model\SpendingSave(); // \Cone\Billingo\Model\SpendingSave +$spendingSave = new \Cone\Billingo\Model\SpendingSave(); // \Cone\Billingo\Model\SpendingSave try { - $result = $apiInstance->spendingUpdate($id, $spending_save); + $result = $apiInstance->spendingUpdate($id, $spendingSave); print_r($result); } catch (Exception $e) { echo 'Exception when calling SpendingApi->spendingUpdate: ', $e->getMessage(), PHP_EOL; @@ -321,7 +321,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **id** | **int**| | | -| **spending_save** | [**\Cone\Billingo\Model\SpendingSave**](../Model/SpendingSave.md)| | [optional] | +| **spendingSave** | [**\Cone\Billingo\Model\SpendingSave**](../Model/SpendingSave.md)| | [optional] | ### Return type diff --git a/docs/Api/UtilApi.md b/docs/Api/UtilApi.md index c1d68dc..70f43ed 100644 --- a/docs/Api/UtilApi.md +++ b/docs/Api/UtilApi.md @@ -12,7 +12,7 @@ All URIs are relative to https://api.billingo.hu/v3, except if the operation def ## `checkTaxNumber()` ```php -checkTaxNumber($tax_number): \Cone\Billingo\Model\TaxNumber +checkTaxNumber($taxNumber): \Cone\Billingo\Model\TaxNumber ``` Check tax number. @@ -38,10 +38,10 @@ $apiInstance = new Cone\Billingo\Api\UtilApi( new GuzzleHttp\Client(), $config ); -$tax_number = 'tax_number_example'; // string +$taxNumber = 'taxNumber_example'; // string try { - $result = $apiInstance->checkTaxNumber($tax_number); + $result = $apiInstance->checkTaxNumber($taxNumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling UtilApi->checkTaxNumber: ', $e->getMessage(), PHP_EOL; @@ -52,7 +52,7 @@ try { | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **tax_number** | **string**| | | +| **taxNumber** | **string**| | | ### Return type diff --git a/docs/Model/Address.md b/docs/Model/Address.md index 6e70105..8364626 100644 --- a/docs/Model/Address.md +++ b/docs/Model/Address.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**country_code** | [**\Cone\Billingo\Model\Country**](Country.md) | | -**post_code** | **string** | | +**countryCode** | [**\Cone\Billingo\Model\Country**](Country.md) | | +**postCode** | **string** | | **city** | **string** | | **address** | **string** | | diff --git a/docs/Model/BankAccount.md b/docs/Model/BankAccount.md index f640630..63c3ce3 100644 --- a/docs/Model/BankAccount.md +++ b/docs/Model/BankAccount.md @@ -6,10 +6,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] [readonly] **name** | **string** | | -**account_number** | **string** | | -**account_number_iban** | **string** | | [optional] +**accountNumber** | **string** | | +**accountNumberIban** | **string** | | [optional] **swift** | **string** | | [optional] **currency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | -**need_qr** | **bool** | | [optional] [default to false] +**needQr** | **bool** | | [optional] [default to false] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BankAccountList.md b/docs/Model/BankAccountList.md index 5bdaec8..f1afc8d 100644 --- a/docs/Model/BankAccountList.md +++ b/docs/Model/BankAccountList.md @@ -6,10 +6,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **data** | [**\Cone\Billingo\Model\BankAccount[]**](BankAccount.md) | | [optional] **total** | **int** | | [optional] -**per_page** | **int** | | [optional] -**current_page** | **int** | | [optional] -**last_page** | **int** | | [optional] -**prev_page_url** | **string** | | [optional] -**next_page_url** | **string** | | [optional] +**perPage** | **int** | | [optional] +**currentPage** | **int** | | [optional] +**lastPage** | **int** | | [optional] +**prevPageUrl** | **string** | | [optional] +**nextPageUrl** | **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/ConversationRate.md b/docs/Model/ConversationRate.md index 60fc5e7..19130e2 100644 --- a/docs/Model/ConversationRate.md +++ b/docs/Model/ConversationRate.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**from_currency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | [optional] -**to_currency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | [optional] -**conversation_rate** | **float** | | [optional] +**fromCurrency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | [optional] +**toCurrency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | [optional] +**conversationRate** | **float** | | [optional] **date** | **\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/CreateDocumentExport.md b/docs/Model/CreateDocumentExport.md index 6f856f7..1678bac 100644 --- a/docs/Model/CreateDocumentExport.md +++ b/docs/Model/CreateDocumentExport.md @@ -4,18 +4,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**query_type** | [**\Cone\Billingo\Model\DocumentExportQueryType**](DocumentExportQueryType.md) | | -**start_date** | **\DateTime** | | -**end_date** | **\DateTime** | | -**document_block_id** | **int** | | [optional] -**export_type** | [**\Cone\Billingo\Model\DocumentExportType**](DocumentExportType.md) | | -**number_start_year** | **int** | | [optional] -**number_start_sequence** | **int** | | [optional] -**number_end_year** | **int** | | [optional] -**number_end_sequence** | **int** | | [optional] -**payment_method** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | [optional] -**sort_by** | [**\Cone\Billingo\Model\DocumentExportSortBy**](DocumentExportSortBy.md) | | [optional] -**other_options** | [**\Cone\Billingo\Model\DocumentExportOtherOptions**](DocumentExportOtherOptions.md) | | [optional] -**filter_extra** | [**\Cone\Billingo\Model\DocumentExportFilterExtra**](DocumentExportFilterExtra.md) | | [optional] +**queryType** | [**\Cone\Billingo\Model\DocumentExportQueryType**](DocumentExportQueryType.md) | | +**startDate** | **\DateTime** | | +**endDate** | **\DateTime** | | +**documentBlockId** | **int** | | [optional] +**exportType** | [**\Cone\Billingo\Model\DocumentExportType**](DocumentExportType.md) | | +**numberStartYear** | **int** | | [optional] +**numberStartSequence** | **int** | | [optional] +**numberEndYear** | **int** | | [optional] +**numberEndSequence** | **int** | | [optional] +**paymentMethod** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | [optional] +**sortBy** | [**\Cone\Billingo\Model\DocumentExportSortBy**](DocumentExportSortBy.md) | | [optional] +**otherOptions** | [**\Cone\Billingo\Model\DocumentExportOtherOptions**](DocumentExportOtherOptions.md) | | [optional] +**filterExtra** | [**\Cone\Billingo\Model\DocumentExportFilterExtra**](DocumentExportFilterExtra.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/Discount.md b/docs/Model/Discount.md index abe2a3e..dd8cc98 100644 --- a/docs/Model/Discount.md +++ b/docs/Model/Discount.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | [**\Cone\Billingo\Model\DiscountType**](DiscountType.md) | | [optional] -**value** | **float** | | [optional] +**value** | **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/Document.md b/docs/Model/Document.md index 6d9044b..c94f551 100644 --- a/docs/Model/Document.md +++ b/docs/Model/Document.md @@ -5,34 +5,33 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | The document's unique identifier. | [optional] -**invoice_number** | **string** | The document's invoice number. | [optional] +**invoiceNumber** | **string** | The document's invoice number. | [optional] **type** | [**\Cone\Billingo\Model\DocumentType**](DocumentType.md) | | [optional] **cancelled** | **bool** | | [optional] -**block_id** | **int** | DocumentBlock's identifier. | [optional] -**payment_status** | [**\Cone\Billingo\Model\PaymentStatus**](PaymentStatus.md) | | [optional] -**payment_method** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | [optional] -**gross_total** | **float** | The document's gross total price. | [optional] +**blockId** | **int** | DocumentBlock's identifier. | [optional] +**paymentStatus** | [**\Cone\Billingo\Model\PaymentStatus**](PaymentStatus.md) | | [optional] +**paymentMethod** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | [optional] +**grossTotal** | **float** | The document's gross total price. | [optional] **currency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | [optional] -**conversion_rate** | **float** | | [optional] -**invoice_date** | **\DateTime** | | [optional] -**fulfillment_date** | **\DateTime** | | [optional] -**due_date** | **\DateTime** | | [optional] -**paid_date** | **\DateTime** | If payment_status equals 'paid' or 'partially_paid', it will show the paid date otherwise the current date. | [optional] +**conversionRate** | **float** | | [optional] +**invoiceDate** | **\DateTime** | | [optional] +**fulfillmentDate** | **\DateTime** | | [optional] +**dueDate** | **\DateTime** | | [optional] +**paidDate** | **\DateTime** | | [optional] **organization** | [**\Cone\Billingo\Model\DocumentOrganization**](DocumentOrganization.md) | | [optional] **partner** | [**\Cone\Billingo\Model\Partner**](Partner.md) | | [optional] -**document_partner** | [**\Cone\Billingo\Model\DocumentPartner**](DocumentPartner.md) | | [optional] +**documentPartner** | [**\Cone\Billingo\Model\DocumentPartner**](DocumentPartner.md) | | [optional] **electronic** | **bool** | | [optional] **comment** | **string** | | [optional] **tags** | **string[]** | | [optional] -**notification_status** | [**\Cone\Billingo\Model\DocumentNotificationStatus**](DocumentNotificationStatus.md) | | [optional] +**notificationStatus** | [**\Cone\Billingo\Model\DocumentNotificationStatus**](DocumentNotificationStatus.md) | | [optional] **language** | [**\Cone\Billingo\Model\DocumentLanguage**](DocumentLanguage.md) | | [optional] **items** | [**\Cone\Billingo\Model\DocumentItem[]**](DocumentItem.md) | | [optional] **summary** | [**\Cone\Billingo\Model\DocumentSummary**](DocumentSummary.md) | | [optional] **settings** | [**\Cone\Billingo\Model\DocumentSettings**](DocumentSettings.md) | | [optional] -**online_szamla_status** | [**\Cone\Billingo\Model\OnlineSzamlaStatusEnum**](OnlineSzamlaStatusEnum.md) | | [optional] -**related_documents** | [**\Cone\Billingo\Model\DocumentAncestor[]**](DocumentAncestor.md) | | [optional] +**onlineSzamlaStatus** | [**\Cone\Billingo\Model\OnlineSzamlaStatusEnum**](OnlineSzamlaStatusEnum.md) | | [optional] +**relatedDocuments** | [**\Cone\Billingo\Model\DocumentAncestor[]**](DocumentAncestor.md) | | [optional] **discount** | [**\Cone\Billingo\Model\Discount**](Discount.md) | | [optional] -**correction_type** | [**\Cone\Billingo\Model\CorrectionType**](CorrectionType.md) | | [optional] -**recurring_id** | **int** | | [optional] +**correctionType** | [**\Cone\Billingo\Model\CorrectionType**](CorrectionType.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/DocumentAncestor.md b/docs/Model/DocumentAncestor.md index 855b1c0..ae74de0 100644 --- a/docs/Model/DocumentAncestor.md +++ b/docs/Model/DocumentAncestor.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | Unique identifier of the related document. | [optional] -**invoice_number** | **string** | Invoice number of the related document. | [optional] +**invoiceNumber** | **string** | Invoice number of the related document. | [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/DocumentBankAccount.md b/docs/Model/DocumentBankAccount.md index 5930976..086030d 100644 --- a/docs/Model/DocumentBankAccount.md +++ b/docs/Model/DocumentBankAccount.md @@ -6,8 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] [readonly] **name** | **string** | | -**account_number** | **string** | | -**account_number_iban** | **string** | | [optional] +**accountNumber** | **string** | | +**accountNumberIban** | **string** | | [optional] **swift** | **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/DocumentBlock.md b/docs/Model/DocumentBlock.md index 731efd0..ba7b480 100644 --- a/docs/Model/DocumentBlock.md +++ b/docs/Model/DocumentBlock.md @@ -7,8 +7,8 @@ Name | Type | Description | Notes **id** | **int** | | [optional] **name** | **string** | | [optional] **prefix** | **string** | | [optional] -**custom_field1** | **string** | | [optional] -**custom_field2** | **string** | | [optional] +**customField1** | **string** | | [optional] +**customField2** | **string** | | [optional] **type** | [**\Cone\Billingo\Model\DocumentBlockType**](DocumentBlockType.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/DocumentBlockList.md b/docs/Model/DocumentBlockList.md index 24e9e21..ad09637 100644 --- a/docs/Model/DocumentBlockList.md +++ b/docs/Model/DocumentBlockList.md @@ -6,10 +6,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **data** | [**\Cone\Billingo\Model\DocumentBlock[]**](DocumentBlock.md) | | [optional] **total** | **int** | | [optional] -**per_page** | **int** | | [optional] -**current_page** | **int** | | [optional] -**last_page** | **int** | | [optional] -**prev_page_url** | **string** | | [optional] -**next_page_url** | **string** | | [optional] +**perPage** | **int** | | [optional] +**currentPage** | **int** | | [optional] +**lastPage** | **int** | | [optional] +**prevPageUrl** | **string** | | [optional] +**nextPageUrl** | **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/DocumentCancellation.md b/docs/Model/DocumentCancellation.md index db3f888..6f2ff81 100644 --- a/docs/Model/DocumentCancellation.md +++ b/docs/Model/DocumentCancellation.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**cancellation_reason** | **string** | | [optional] -**cancellation_recipients** | **string** | | [optional] +**cancellationReason** | **string** | | [optional] +**cancellationRecipients** | **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/DocumentExportFilterExtra.md b/docs/Model/DocumentExportFilterExtra.md index b699fae..680e4b2 100644 --- a/docs/Model/DocumentExportFilterExtra.md +++ b/docs/Model/DocumentExportFilterExtra.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**tensoft_vkod** | **string** | | [optional] -**ledger_number** | [**\Cone\Billingo\Model\LedgerNumberInformation**](LedgerNumberInformation.md) | | [optional] -**forintsoft_konyvelesi_naplo_szam** | **string** | | [optional] -**positive_ledger_number** | **string** | | [optional] -**negative_ledger_number** | **string** | | [optional] -**rlb_kata** | **bool** | | [optional] -**rlb_note** | **string** | | [optional] -**novitax_naplokod** | **string** | | [optional] -**use_gross_values** | **bool** | | [optional] +**tensoftVkod** | **string** | | [optional] +**ledgerNumber** | [**\Cone\Billingo\Model\LedgerNumberInformation**](LedgerNumberInformation.md) | | [optional] +**forintsoftKonyvelesiNaploSzam** | **string** | | [optional] +**positiveLedgerNumber** | **string** | | [optional] +**negativeLedgerNumber** | **string** | | [optional] +**rlbKata** | **bool** | | [optional] +**rlbNote** | **string** | | [optional] +**novitaxNaplokod** | **string** | | [optional] +**useGrossValues** | **bool** | | [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/DocumentInsert.md b/docs/Model/DocumentInsert.md index 85416cf..0fa5c03 100644 --- a/docs/Model/DocumentInsert.md +++ b/docs/Model/DocumentInsert.md @@ -4,25 +4,24 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**vendor_id** | **string** | | [optional] -**partner_id** | **int** | | -**block_id** | **int** | | -**bank_account_id** | **int** | | [optional] +**vendorId** | **string** | | [optional] +**partnerId** | **int** | | +**blockId** | **int** | | +**bankAccountId** | **int** | | [optional] **type** | [**\Cone\Billingo\Model\DocumentInsertType**](DocumentInsertType.md) | | -**fulfillment_date** | **\DateTime** | | -**due_date** | **\DateTime** | | -**payment_method** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | +**fulfillmentDate** | **\DateTime** | | +**dueDate** | **\DateTime** | | +**paymentMethod** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | **language** | [**\Cone\Billingo\Model\DocumentLanguage**](DocumentLanguage.md) | | **currency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | -**conversion_rate** | **float** | | [optional] +**conversionRate** | **float** | | [optional] **electronic** | **bool** | | [optional] [default to false] **paid** | **bool** | | [optional] [default to false] **items** | [**\Cone\Billingo\Model\DocumentInsertItemsInner[]**](DocumentInsertItemsInner.md) | | [optional] **comment** | **string** | | [optional] **settings** | [**\Cone\Billingo\Model\DocumentSettings**](DocumentSettings.md) | | [optional] -**advance_invoice** | **int[]** | | [optional] +**advanceInvoice** | **int[]** | | [optional] **discount** | [**\Cone\Billingo\Model\Discount**](Discount.md) | | [optional] -**instant_payment** | **bool** | | [optional] -**instant_payment_request** | [**\Cone\Billingo\Model\DocumentInsertInstantPaymentRequest**](DocumentInsertInstantPaymentRequest.md) | | [optional] +**instantPayment** | **bool** | | [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/DocumentInsertItemsInner.md b/docs/Model/DocumentInsertItemsInner.md index 5c950a5..974ee53 100644 --- a/docs/Model/DocumentInsertItemsInner.md +++ b/docs/Model/DocumentInsertItemsInner.md @@ -4,15 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**product_id** | **int** | | +**productId** | **int** | | **quantity** | **float** | | **comment** | **string** | | [optional] **name** | **string** | | -**unit_price** | **float** | | -**unit_price_type** | [**\Cone\Billingo\Model\UnitPriceType**](UnitPriceType.md) | | +**unitPrice** | **float** | | +**unitPriceType** | [**\Cone\Billingo\Model\UnitPriceType**](UnitPriceType.md) | | **unit** | **string** | | **vat** | [**\Cone\Billingo\Model\Vat**](Vat.md) | | **entitlement** | [**\Cone\Billingo\Model\Entitlement**](Entitlement.md) | | [optional] -**sku** | **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/DocumentItem.md b/docs/Model/DocumentItem.md index c0638a9..dd8c16c 100644 --- a/docs/Model/DocumentItem.md +++ b/docs/Model/DocumentItem.md @@ -4,17 +4,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**product_id** | **int** | | [optional] +**productId** | **int** | | [optional] **name** | **string** | | [optional] -**net_unit_amount** | **float** | | [optional] +**netUnitAmount** | **float** | | [optional] **quantity** | **float** | | [optional] **unit** | **string** | | [optional] -**net_amount** | **float** | | [optional] -**gross_amount** | **float** | | [optional] +**netAmount** | **float** | | [optional] +**grossAmount** | **float** | | [optional] **vat** | [**\Cone\Billingo\Model\Vat**](Vat.md) | | [optional] -**vat_amount** | **float** | | [optional] +**vatAmount** | **float** | | [optional] **entitlement** | [**\Cone\Billingo\Model\Entitlement**](Entitlement.md) | | [optional] **comment** | **string** | | [optional] -**sku** | **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/DocumentItemData.md b/docs/Model/DocumentItemData.md index 43b9f5e..513c6a8 100644 --- a/docs/Model/DocumentItemData.md +++ b/docs/Model/DocumentItemData.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**product_id** | **int** | | +**productId** | **int** | | **quantity** | **float** | | **comment** | **string** | | [optional] diff --git a/docs/Model/DocumentList.md b/docs/Model/DocumentList.md index dfa8bd9..61d4793 100644 --- a/docs/Model/DocumentList.md +++ b/docs/Model/DocumentList.md @@ -6,10 +6,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **data** | [**\Cone\Billingo\Model\Document[]**](Document.md) | | [optional] **total** | **int** | | [optional] -**per_page** | **int** | | [optional] -**current_page** | **int** | | [optional] -**last_page** | **int** | | [optional] -**prev_page_url** | **string** | | [optional] -**next_page_url** | **string** | | [optional] +**perPage** | **int** | | [optional] +**currentPage** | **int** | | [optional] +**lastPage** | **int** | | [optional] +**prevPageUrl** | **string** | | [optional] +**nextPageUrl** | **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/DocumentOrganization.md b/docs/Model/DocumentOrganization.md index 9477d72..6305a1c 100644 --- a/docs/Model/DocumentOrganization.md +++ b/docs/Model/DocumentOrganization.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **string** | | [optional] -**tax_number** | **string** | | [optional] -**bank_account** | [**\Cone\Billingo\Model\DocumentBankAccount**](DocumentBankAccount.md) | | [optional] +**taxNumber** | **string** | | [optional] +**bankAccount** | [**\Cone\Billingo\Model\DocumentBankAccount**](DocumentBankAccount.md) | | [optional] **address** | [**\Cone\Billingo\Model\Address**](Address.md) | | [optional] -**small_taxpayer** | **bool** | | [optional] -**ev_number** | **string** | | [optional] -**eu_tax_number** | **string** | | [optional] -**cash_settled** | **bool** | | [optional] +**smallTaxpayer** | **bool** | | [optional] +**evNumber** | **string** | | [optional] +**euTaxNumber** | **string** | | [optional] +**cashSettled** | **bool** | | [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/DocumentPartner.md b/docs/Model/DocumentPartner.md index b449a6a..110bb4a 100644 --- a/docs/Model/DocumentPartner.md +++ b/docs/Model/DocumentPartner.md @@ -11,9 +11,8 @@ Name | Type | Description | Notes **taxcode** | **string** | | [optional] **iban** | **string** | | [optional] **swift** | **string** | | [optional] -**account_number** | **string** | | [optional] +**accountNumber** | **string** | | [optional] **phone** | **string** | | [optional] -**tax_type** | [**\Cone\Billingo\Model\PartnerTaxType**](PartnerTaxType.md) | | [optional] -**partner_shipping** | [**\Cone\Billingo\Model\DocumentPartnerPartnerShipping**](DocumentPartnerPartnerShipping.md) | | [optional] +**taxType** | [**\Cone\Billingo\Model\PartnerTaxType**](PartnerTaxType.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/DocumentProductData.md b/docs/Model/DocumentProductData.md index 1b44c4d..704358c 100644 --- a/docs/Model/DocumentProductData.md +++ b/docs/Model/DocumentProductData.md @@ -5,13 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **string** | | -**unit_price** | **float** | | -**unit_price_type** | [**\Cone\Billingo\Model\UnitPriceType**](UnitPriceType.md) | | +**unitPrice** | **float** | | +**unitPriceType** | [**\Cone\Billingo\Model\UnitPriceType**](UnitPriceType.md) | | **quantity** | **float** | | **unit** | **string** | | **vat** | [**\Cone\Billingo\Model\Vat**](Vat.md) | | **comment** | **string** | | [optional] **entitlement** | [**\Cone\Billingo\Model\Entitlement**](Entitlement.md) | | [optional] -**sku** | **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/DocumentPublicUrl.md b/docs/Model/DocumentPublicUrl.md index fe8fbe9..822c772 100644 --- a/docs/Model/DocumentPublicUrl.md +++ b/docs/Model/DocumentPublicUrl.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**public_url** | **string** | | [optional] +**publicUrl** | **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/DocumentSettings.md b/docs/Model/DocumentSettings.md index 9d45018..ba2153e 100644 --- a/docs/Model/DocumentSettings.md +++ b/docs/Model/DocumentSettings.md @@ -4,17 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**mediated_service** | **bool** | | [optional] [default to false] -**without_financial_fulfillment** | **bool** | | [optional] [default to false] -**online_payment** | [**\Cone\Billingo\Model\OnlinePayment**](OnlinePayment.md) | | [optional] -**should_send_email** | **bool** | | [optional] [default to false] +**mediatedService** | **bool** | | [optional] [default to false] +**withoutFinancialFulfillment** | **bool** | | [optional] [default to false] +**onlinePayment** | [**\Cone\Billingo\Model\OnlinePayment**](OnlinePayment.md) | | [optional] **round** | [**\Cone\Billingo\Model\Round**](Round.md) | | [optional] -**no_send_onlineszamla_by_user** | **bool** | | [optional] -**dont_send_to_nav_reason** | [**\Cone\Billingo\Model\DocumentSettingsDontSendToNavReason**](DocumentSettingsDontSendToNavReason.md) | | [optional] -**order_number** | **string** | | [optional] -**place_id** | **int** | | [optional] -**instant_payment** | **bool** | | [optional] -**selected_type** | [**\Cone\Billingo\Model\DocumentType**](DocumentType.md) | | [optional] -**instant_payment_request** | [**\Cone\Billingo\Model\DocumentInsertInstantPaymentRequest**](DocumentInsertInstantPaymentRequest.md) | | [optional] +**noSendOnlineszamlaByUser** | **bool** | | [optional] +**orderNumber** | **string** | | [optional] +**placeId** | **int** | | [optional] +**instantPayment** | **bool** | | [optional] +**selectedType** | [**\Cone\Billingo\Model\DocumentType**](DocumentType.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/DocumentSummary.md b/docs/Model/DocumentSummary.md index f078b45..d6a50be 100644 --- a/docs/Model/DocumentSummary.md +++ b/docs/Model/DocumentSummary.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**net_amount** | **float** | | [optional] -**net_amount_local** | **float** | | [optional] -**gross_amount_local** | **float** | | [optional] -**vat_amount** | **float** | | [optional] -**vat_amount_local** | **float** | | [optional] -**vat_rate_summary** | [**\Cone\Billingo\Model\DocumentVatRateSummary[]**](DocumentVatRateSummary.md) | | [optional] +**netAmount** | **float** | | [optional] +**netAmountLocal** | **float** | | [optional] +**grossAmountLocal** | **float** | | [optional] +**vatAmount** | **float** | | [optional] +**vatAmountLocal** | **float** | | [optional] +**vatRateSummary** | [**\Cone\Billingo\Model\DocumentVatRateSummary[]**](DocumentVatRateSummary.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/DocumentVatRateSummary.md b/docs/Model/DocumentVatRateSummary.md index 28985c0..f26423e 100644 --- a/docs/Model/DocumentVatRateSummary.md +++ b/docs/Model/DocumentVatRateSummary.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**vat_name** | **string** | | [optional] -**vat_percentage** | **float** | | [optional] -**vat_rate_net_amount** | **float** | | [optional] -**vat_rate_vat_amount** | **float** | | [optional] -**vat_rate_vat_amount_local** | **float** | | [optional] -**vat_rate_gross_amount** | **float** | | [optional] +**vatName** | **string** | | [optional] +**vatPercentage** | **float** | | [optional] +**vatRateNetAmount** | **float** | | [optional] +**vatRateVatAmount** | **float** | | [optional] +**vatRateVatAmountLocal** | **float** | | [optional] +**vatRateGrossAmount** | **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/Id.md b/docs/Model/Id.md index 66c5a6f..8a996e0 100644 --- a/docs/Model/Id.md +++ b/docs/Model/Id.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] -**legacy_id** | **int** | | [optional] +**legacyId** | **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/InvoiceSettings.md b/docs/Model/InvoiceSettings.md index 116eb2d..ed67dad 100644 --- a/docs/Model/InvoiceSettings.md +++ b/docs/Model/InvoiceSettings.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**document_type** | [**\Cone\Billingo\Model\DocumentType**](DocumentType.md) | | [optional] -**fulfillment_date** | **\DateTime** | | [optional] -**due_date** | **\DateTime** | | [optional] -**document_format** | [**\Cone\Billingo\Model\DocumentFormat**](DocumentFormat.md) | | [optional] +**documentType** | [**\Cone\Billingo\Model\DocumentType**](DocumentType.md) | | [optional] +**fulfillmentDate** | **\DateTime** | | [optional] +**dueDate** | **\DateTime** | | [optional] +**documentFormat** | [**\Cone\Billingo\Model\DocumentFormat**](DocumentFormat.md) | | [optional] **comment** | **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/ModificationDocumentInsert.md b/docs/Model/ModificationDocumentInsert.md index 0c35f0d..eff1054 100644 --- a/docs/Model/ModificationDocumentInsert.md +++ b/docs/Model/ModificationDocumentInsert.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**due_date** | **\DateTime** | | [optional] +**dueDate** | **\DateTime** | | [optional] **comment** | **string** | | [optional] -**payment_method** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | [optional] -**without_financial_fulfillment** | **bool** | | [optional] [default to false] +**paymentMethod** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | [optional] +**withoutFinancialFulfillment** | **bool** | | [optional] [default to false] **items** | [**\Cone\Billingo\Model\DocumentInsertItemsInner[]**](DocumentInsertItemsInner.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/OnlineSzamlaStatus.md b/docs/Model/OnlineSzamlaStatus.md index df60520..c9b2501 100644 --- a/docs/Model/OnlineSzamlaStatus.md +++ b/docs/Model/OnlineSzamlaStatus.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**transaction_id** | **string** | | [optional] +**transactionId** | **string** | | [optional] **status** | **string** | | [optional] **messages** | [**\Cone\Billingo\Model\OnlineSzamlaStatusMessage[]**](OnlineSzamlaStatusMessage.md) | | [optional] diff --git a/docs/Model/OnlineSzamlaStatusMessage.md b/docs/Model/OnlineSzamlaStatusMessage.md index 2f3c71a..96c5fd2 100644 --- a/docs/Model/OnlineSzamlaStatusMessage.md +++ b/docs/Model/OnlineSzamlaStatusMessage.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**validation_result_code** | **string** | | [optional] -**validation_error_code** | **string** | | [optional] -**human_readable_message** | **string** | | [optional] +**validationResultCode** | **string** | | [optional] +**validationErrorCode** | **string** | | [optional] +**humanReadableMessage** | **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/OrganizationData.md b/docs/Model/OrganizationData.md index 8c2f1c0..650e4dd 100644 --- a/docs/Model/OrganizationData.md +++ b/docs/Model/OrganizationData.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**tax_code** | **string** | | [optional] +**taxCode** | **string** | | [optional] **subscription** | [**\Cone\Billingo\Model\Subscription**](Subscription.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/Partner.md b/docs/Model/Partner.md index d4d9c21..44c2fde 100644 --- a/docs/Model/Partner.md +++ b/docs/Model/Partner.md @@ -11,15 +11,11 @@ Name | Type | Description | Notes **taxcode** | **string** | | [optional] **iban** | **string** | | [optional] **swift** | **string** | | [optional] -**account_number** | **string** | | [optional] +**accountNumber** | **string** | | [optional] **phone** | **string** | | [optional] -**general_ledger_number** | **string** | | [optional] -**tax_type** | [**\Cone\Billingo\Model\PartnerTaxType**](PartnerTaxType.md) | | [optional] -**custom_billing_settings** | [**\Cone\Billingo\Model\PartnerCustomBillingSettings**](PartnerCustomBillingSettings.md) | | [optional] -**group_member_tax_number** | **string** | The tax number of group member. Send tax number for update. Send empty string for delete. Ignored if omitted. | [optional] -**giro_settings** | [**\Cone\Billingo\Model\PartnerGiroSettings**](PartnerGiroSettings.md) | | [optional] -**partner_shipping** | [**\Cone\Billingo\Model\DocumentPartnerPartnerShipping**](DocumentPartnerPartnerShipping.md) | | [optional] -**internal_comment** | **string** | | [optional] -**partner_show_type** | [**\Cone\Billingo\Model\PartnerPartnerShowType**](PartnerPartnerShowType.md) | | [optional] +**generalLedgerNumber** | **string** | | [optional] +**taxType** | [**\Cone\Billingo\Model\PartnerTaxType**](PartnerTaxType.md) | | [optional] +**customBillingSettings** | [**\Cone\Billingo\Model\PartnerCustomBillingSettings**](PartnerCustomBillingSettings.md) | | [optional] +**groupMemberTaxNumber** | **string** | The tax number of group member. Send tax number for update. Send empty string for delete. Ignored if omitted. | [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/PartnerCustomBillingSettings.md b/docs/Model/PartnerCustomBillingSettings.md index b7393ce..194708a 100644 --- a/docs/Model/PartnerCustomBillingSettings.md +++ b/docs/Model/PartnerCustomBillingSettings.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**payment_method** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | [optional] -**document_form** | [**\Cone\Billingo\Model\DocumentForm**](DocumentForm.md) | | [optional] -**due_days** | **int** | | [optional] -**document_currency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | [optional] -**template_language_code** | [**\Cone\Billingo\Model\DocumentLanguage**](DocumentLanguage.md) | | [optional] +**paymentMethod** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | [optional] +**documentForm** | [**\Cone\Billingo\Model\DocumentForm**](DocumentForm.md) | | [optional] +**dueDays** | **int** | | [optional] +**documentCurrency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | [optional] +**templateLanguageCode** | [**\Cone\Billingo\Model\DocumentLanguage**](DocumentLanguage.md) | | [optional] **discount** | [**\Cone\Billingo\Model\Discount**](Discount.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/PartnerList.md b/docs/Model/PartnerList.md index cb874a1..d75f9f2 100644 --- a/docs/Model/PartnerList.md +++ b/docs/Model/PartnerList.md @@ -6,10 +6,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **data** | [**\Cone\Billingo\Model\Partner[]**](Partner.md) | | [optional] **total** | **int** | | [optional] -**per_page** | **int** | | [optional] -**current_page** | **int** | | [optional] -**last_page** | **int** | | [optional] -**prev_page_url** | **string** | | [optional] -**next_page_url** | **string** | | [optional] +**perPage** | **int** | | [optional] +**currentPage** | **int** | | [optional] +**lastPage** | **int** | | [optional] +**prevPageUrl** | **string** | | [optional] +**nextPageUrl** | **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/PaymentHistory.md b/docs/Model/PaymentHistory.md index b4bdb2c..0377a39 100644 --- a/docs/Model/PaymentHistory.md +++ b/docs/Model/PaymentHistory.md @@ -6,8 +6,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **date** | **\DateTime** | | **price** | **float** | | -**payment_method** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | -**voucher_number** | **string** | | [optional] -**conversion_rate** | **float** | | [optional] +**paymentMethod** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | +**voucherNumber** | **string** | | [optional] +**conversionRate** | **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/Product.md b/docs/Model/Product.md index d9efb91..4d544f1 100644 --- a/docs/Model/Product.md +++ b/docs/Model/Product.md @@ -9,15 +9,10 @@ Name | Type | Description | Notes **comment** | **string** | | [optional] **currency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | **vat** | [**\Cone\Billingo\Model\Vat**](Vat.md) | | -**net_unit_price** | **float** | | [optional] -**gross_unit_price** | **float** | | [optional] +**netUnitPrice** | **float** | | [optional] **unit** | **string** | | -**general_ledger_number** | **string** | | [optional] -**general_ledger_taxcode** | **string** | | [optional] +**generalLedgerNumber** | **string** | | [optional] +**generalLedgerTaxcode** | **string** | | [optional] **entitlement** | [**\Cone\Billingo\Model\Entitlement**](Entitlement.md) | | [optional] -**ean** | **string** | | [optional] -**sku** | **string** | | [optional] -**is_manage** | **bool** | | [optional] -**purchase_price** | **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/ProductList.md b/docs/Model/ProductList.md index cf07d59..90dea52 100644 --- a/docs/Model/ProductList.md +++ b/docs/Model/ProductList.md @@ -6,10 +6,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **data** | [**\Cone\Billingo\Model\Product[]**](Product.md) | | [optional] **total** | **int** | | [optional] -**per_page** | **int** | | [optional] -**current_page** | **int** | | [optional] -**last_page** | **int** | | [optional] -**prev_page_url** | **string** | | [optional] -**next_page_url** | **string** | | [optional] +**perPage** | **int** | | [optional] +**currentPage** | **int** | | [optional] +**lastPage** | **int** | | [optional] +**prevPageUrl** | **string** | | [optional] +**nextPageUrl** | **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/ReceiptInsert.md b/docs/Model/ReceiptInsert.md index e13b5ec..c9c16d0 100644 --- a/docs/Model/ReceiptInsert.md +++ b/docs/Model/ReceiptInsert.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**vendor_id** | **string** | | [optional] -**partner_id** | **int** | | [optional] +**vendorId** | **string** | | [optional] +**partnerId** | **int** | | [optional] **name** | **string** | | [optional] **emails** | **string[]** | | [optional] -**block_id** | **int** | | +**blockId** | **int** | | **type** | [**\Cone\Billingo\Model\DocumentType**](DocumentType.md) | | -**payment_method** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | +**paymentMethod** | [**\Cone\Billingo\Model\PaymentMethod**](PaymentMethod.md) | | **currency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | -**conversion_rate** | **float** | | [optional] +**conversionRate** | **float** | | [optional] **electronic** | **bool** | | [optional] [default to false] **items** | [**\Cone\Billingo\Model\ReceiptInsertItemsInner[]**](ReceiptInsertItemsInner.md) | | [optional] diff --git a/docs/Model/ReceiptInsertItemsInner.md b/docs/Model/ReceiptInsertItemsInner.md index ee211c4..1b7e6ed 100644 --- a/docs/Model/ReceiptInsertItemsInner.md +++ b/docs/Model/ReceiptInsertItemsInner.md @@ -4,9 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**product_id** | **int** | | +**productId** | **int** | | **name** | **string** | | [optional] -**unit_price** | **float** | | +**unitPrice** | **float** | | **vat** | [**\Cone\Billingo\Model\Vat**](Vat.md) | | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ReceiptItemData.md b/docs/Model/ReceiptItemData.md index b139798..3512028 100644 --- a/docs/Model/ReceiptItemData.md +++ b/docs/Model/ReceiptItemData.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**product_id** | **int** | | +**productId** | **int** | | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ReceiptProductData.md b/docs/Model/ReceiptProductData.md index 172ac44..768a082 100644 --- a/docs/Model/ReceiptProductData.md +++ b/docs/Model/ReceiptProductData.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **string** | | [optional] -**unit_price** | **float** | | +**unitPrice** | **float** | | **vat** | [**\Cone\Billingo\Model\Vat**](Vat.md) | | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ServerError.md b/docs/Model/ServerError.md index 5e4a604..644f58f 100644 --- a/docs/Model/ServerError.md +++ b/docs/Model/ServerError.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **message** | **string** | | [optional] -**trace_id** | **string** | You should send us this ID to investigate the issue. | [optional] +**traceId** | **string** | You should send us this ID to investigate the issue. | [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/Spending.md b/docs/Model/Spending.md index 7902268..d88a30a 100644 --- a/docs/Model/Spending.md +++ b/docs/Model/Spending.md @@ -5,21 +5,21 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] -**organization_id** | **int** | | [optional] +**organizationId** | **int** | | [optional] **category** | [**\Cone\Billingo\Model\Category**](Category.md) | | [optional] -**paid_at** | **\DateTime** | | [optional] -**fulfillment_date** | **\DateTime** | | [optional] +**paidAt** | **\DateTime** | | [optional] +**fulfillmentDate** | **\DateTime** | | [optional] **partner** | [**\Cone\Billingo\Model\SpendingPartner**](SpendingPartner.md) | | [optional] -**invoice_number** | **string** | | [optional] +**invoiceNumber** | **string** | | [optional] **currency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | [optional] -**conversion_rate** | **float** | | [optional] -**total_gross** | **float** | | [optional] -**total_gross_local** | **float** | | [optional] -**total_vat_amount** | **float** | | [optional] -**total_vat_amount_local** | **float** | | [optional] -**invoice_date** | **\DateTime** | | [optional] -**due_date** | **\DateTime** | | [optional] -**payment_method** | [**\Cone\Billingo\Model\SpendingPaymentMethod**](SpendingPaymentMethod.md) | | [optional] +**conversionRate** | **float** | | [optional] +**totalGross** | **float** | | [optional] +**totalGrossLocal** | **float** | | [optional] +**totalVatAmount** | **float** | | [optional] +**totalVatAmountLocal** | **float** | | [optional] +**invoiceDate** | **\DateTime** | | [optional] +**dueDate** | **\DateTime** | | [optional] +**paymentMethod** | [**\Cone\Billingo\Model\SpendingPaymentMethod**](SpendingPaymentMethod.md) | | [optional] **comment** | **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/SpendingList.md b/docs/Model/SpendingList.md index ee12344..7880879 100644 --- a/docs/Model/SpendingList.md +++ b/docs/Model/SpendingList.md @@ -6,10 +6,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **data** | [**\Cone\Billingo\Model\SpendingListItem[]**](SpendingListItem.md) | | [optional] **total** | **int** | | [optional] -**per_page** | **int** | | [optional] -**current_page** | **int** | | [optional] -**last_page** | **int** | | [optional] -**prev_page_url** | **string** | | [optional] -**next_page_url** | **string** | | [optional] +**perPage** | **int** | | [optional] +**currentPage** | **int** | | [optional] +**lastPage** | **int** | | [optional] +**prevPageUrl** | **string** | | [optional] +**nextPageUrl** | **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/SpendingListItem.md b/docs/Model/SpendingListItem.md index 5ba1172..e4491c5 100644 --- a/docs/Model/SpendingListItem.md +++ b/docs/Model/SpendingListItem.md @@ -5,22 +5,22 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] -**organization_id** | **int** | | [optional] +**organizationId** | **int** | | [optional] **category** | [**\Cone\Billingo\Model\Category**](Category.md) | | [optional] -**paid_at** | **\DateTime** | | [optional] -**fulfillment_date** | **\DateTime** | | [optional] +**paidAt** | **\DateTime** | | [optional] +**fulfillmentDate** | **\DateTime** | | [optional] **partner** | [**\Cone\Billingo\Model\SpendingPartner**](SpendingPartner.md) | | [optional] -**invoice_number** | **string** | | [optional] +**invoiceNumber** | **string** | | [optional] **currency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | [optional] -**conversion_rate** | **float** | | [optional] -**total_gross** | **float** | | [optional] -**total_gross_local** | **float** | | [optional] -**total_vat_amount** | **float** | | [optional] -**total_vat_amount_local** | **float** | | [optional] -**invoice_date** | **\DateTime** | | [optional] -**due_date** | **\DateTime** | | [optional] -**payment_method** | [**\Cone\Billingo\Model\SpendingPaymentMethod**](SpendingPaymentMethod.md) | | [optional] +**conversionRate** | **float** | | [optional] +**totalGross** | **float** | | [optional] +**totalGrossLocal** | **float** | | [optional] +**totalVatAmount** | **float** | | [optional] +**totalVatAmountLocal** | **float** | | [optional] +**invoiceDate** | **\DateTime** | | [optional] +**dueDate** | **\DateTime** | | [optional] +**paymentMethod** | [**\Cone\Billingo\Model\SpendingPaymentMethod**](SpendingPaymentMethod.md) | | [optional] **comment** | **string** | | [optional] -**is_created_by_nav** | **bool** | | [optional] +**isCreatedByNav** | **bool** | | [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/SpendingPartner.md b/docs/Model/SpendingPartner.md index f4d9eb6..6be25cc 100644 --- a/docs/Model/SpendingPartner.md +++ b/docs/Model/SpendingPartner.md @@ -6,13 +6,13 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | | [optional] **name** | **string** | | [optional] -**tax_code** | **string** | | [optional] +**taxCode** | **string** | | [optional] **address** | [**\Cone\Billingo\Model\Address**](Address.md) | | [optional] **iban** | **string** | | [optional] **swift** | **string** | | [optional] -**account_number** | **string** | | [optional] +**accountNumber** | **string** | | [optional] **phone** | **string** | | [optional] -**internal_comment** | **string** | | [optional] -**group_member_tax_number** | **string** | | [optional] +**internalComment** | **string** | | [optional] +**groupMemberTaxNumber** | **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/SpendingSave.md b/docs/Model/SpendingSave.md index 03788eb..5393f47 100644 --- a/docs/Model/SpendingSave.md +++ b/docs/Model/SpendingSave.md @@ -5,19 +5,19 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **currency** | [**\Cone\Billingo\Model\Currency**](Currency.md) | | -**conversion_rate** | **float** | | [optional] -**total_gross** | **float** | | -**total_gross_huf** | **float** | | -**total_vat_amount** | **float** | | -**total_vat_amount_huf** | **float** | | -**fulfillment_date** | **\DateTime** | | -**paid_at** | **\DateTime** | | [optional] +**conversionRate** | **float** | | [optional] +**totalGross** | **float** | | +**totalGrossHuf** | **float** | | +**totalVatAmount** | **float** | | +**totalVatAmountHuf** | **float** | | +**fulfillmentDate** | **\DateTime** | | +**paidAt** | **\DateTime** | | [optional] **category** | [**\Cone\Billingo\Model\Category**](Category.md) | | **comment** | **string** | | [optional] -**invoice_number** | **string** | | [optional] -**invoice_date** | **\DateTime** | | [optional] -**due_date** | **\DateTime** | | [optional] -**payment_method** | [**\Cone\Billingo\Model\SpendingPaymentMethod**](SpendingPaymentMethod.md) | | -**partner_id** | **int** | | [optional] +**invoiceNumber** | **string** | | [optional] +**invoiceDate** | **\DateTime** | | [optional] +**dueDate** | **\DateTime** | | [optional] +**paymentMethod** | [**\Cone\Billingo\Model\SpendingPaymentMethod**](SpendingPaymentMethod.md) | | +**partnerId** | **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/Subscription.md b/docs/Model/Subscription.md index 8781fd1..ba7afd7 100644 --- a/docs/Model/Subscription.md +++ b/docs/Model/Subscription.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**expiration_date** | **\DateTime** | | [optional] +**expirationDate** | **\DateTime** | | [optional] **features** | [**\Cone\Billingo\Model\Feature[]**](Feature.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/TaxNumber.md b/docs/Model/TaxNumber.md index dae3f7b..5ee3b8b 100644 --- a/docs/Model/TaxNumber.md +++ b/docs/Model/TaxNumber.md @@ -4,7 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**tax_number** | **string** | | [optional] +**taxNumber** | **string** | | [optional] **result** | [**\Cone\Billingo\Model\CheckTaxNumberMessage**](CheckTaxNumberMessage.md) | | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7ecb997..b04c85f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,11 @@ - - + + + + ./src/Api + ./src/Model + + ./test/Api @@ -10,10 +15,4 @@ - - - ./lib/Api - ./lib/Model - - diff --git a/src/Api/BankAccountApi.php b/src/Api/BankAccountApi.php new file mode 100644 index 0000000..d9d1b41 --- /dev/null +++ b/src/Api/BankAccountApi.php @@ -0,0 +1,2708 @@ + [ + 'application/json', + ], + 'deleteBankAccount' => [ + 'application/json', + ], + 'getBankAccount' => [ + 'application/json', + ], + 'listBankAccount' => [ + 'application/json', + ], + 'updateBankAccount' => [ + '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, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $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 createBankAccount + * + * Create a bank account + * + * @param \Cone\Billingo\Model\BankAccount $bankAccount BankAccount object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBankAccount'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\BankAccount|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function createBankAccount($bankAccount, string $contentType = self::contentTypes['createBankAccount'][0]) + { + list($response) = $this->createBankAccountWithHttpInfo($bankAccount, $contentType); + return $response; + } + + /** + * Operation createBankAccountWithHttpInfo + * + * Create a bank account + * + * @param \Cone\Billingo\Model\BankAccount $bankAccount BankAccount object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBankAccount'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\BankAccount|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createBankAccountWithHttpInfo($bankAccount, string $contentType = self::contentTypes['createBankAccount'][0]) + { + $request = $this->createBankAccountRequest($bankAccount, $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(); + + 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() + ); + } + + switch($statusCode) { + case 201: + if ('\Cone\Billingo\Model\BankAccount' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\BankAccount' !== '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, '\Cone\Billingo\Model\BankAccount', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\BankAccount'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\BankAccount', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createBankAccountAsync + * + * Create a bank account + * + * @param \Cone\Billingo\Model\BankAccount $bankAccount BankAccount object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createBankAccountAsync($bankAccount, string $contentType = self::contentTypes['createBankAccount'][0]) + { + return $this->createBankAccountAsyncWithHttpInfo($bankAccount, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createBankAccountAsyncWithHttpInfo + * + * Create a bank account + * + * @param \Cone\Billingo\Model\BankAccount $bankAccount BankAccount object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createBankAccountAsyncWithHttpInfo($bankAccount, string $contentType = self::contentTypes['createBankAccount'][0]) + { + $returnType = '\Cone\Billingo\Model\BankAccount'; + $request = $this->createBankAccountRequest($bankAccount, $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 'createBankAccount' + * + * @param \Cone\Billingo\Model\BankAccount $bankAccount BankAccount object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createBankAccountRequest($bankAccount, string $contentType = self::contentTypes['createBankAccount'][0]) + { + + // verify the required parameter 'bankAccount' is set + if ($bankAccount === null || (is_array($bankAccount) && count($bankAccount) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $bankAccount when calling createBankAccount' + ); + } + + + $resourcePath = '/bank-accounts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($bankAccount)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($bankAccount)); + } else { + $httpBody = $bankAccount; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 deleteBankAccount + * + * Delete a bank account + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteBankAccount'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function deleteBankAccount($id, string $contentType = self::contentTypes['deleteBankAccount'][0]) + { + $this->deleteBankAccountWithHttpInfo($id, $contentType); + } + + /** + * Operation deleteBankAccountWithHttpInfo + * + * Delete a bank account + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteBankAccount'] to see the possible values for this operation + * + * @throws \Cone\Billingo\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 deleteBankAccountWithHttpInfo($id, string $contentType = self::contentTypes['deleteBankAccount'][0]) + { + $request = $this->deleteBankAccountRequest($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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteBankAccountAsync + * + * Delete a bank account + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteBankAccountAsync($id, string $contentType = self::contentTypes['deleteBankAccount'][0]) + { + return $this->deleteBankAccountAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteBankAccountAsyncWithHttpInfo + * + * Delete a bank account + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteBankAccountAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteBankAccount'][0]) + { + $returnType = ''; + $request = $this->deleteBankAccountRequest($id, $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 'deleteBankAccount' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteBankAccountRequest($id, string $contentType = self::contentTypes['deleteBankAccount'][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 deleteBankAccount' + ); + } + + + $resourcePath = '/bank-accounts/{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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getBankAccount + * + * Retrieve a bank account + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBankAccount'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\BankAccount|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function getBankAccount($id, string $contentType = self::contentTypes['getBankAccount'][0]) + { + list($response) = $this->getBankAccountWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getBankAccountWithHttpInfo + * + * Retrieve a bank account + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBankAccount'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\BankAccount|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getBankAccountWithHttpInfo($id, string $contentType = self::contentTypes['getBankAccount'][0]) + { + $request = $this->getBankAccountRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\BankAccount' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\BankAccount' !== '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, '\Cone\Billingo\Model\BankAccount', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\BankAccount'; + 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(), + '\Cone\Billingo\Model\BankAccount', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getBankAccountAsync + * + * Retrieve a bank account + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBankAccountAsync($id, string $contentType = self::contentTypes['getBankAccount'][0]) + { + return $this->getBankAccountAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getBankAccountAsyncWithHttpInfo + * + * Retrieve a bank account + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getBankAccountAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getBankAccount'][0]) + { + $returnType = '\Cone\Billingo\Model\BankAccount'; + $request = $this->getBankAccountRequest($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 'getBankAccount' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getBankAccountRequest($id, string $contentType = self::contentTypes['getBankAccount'][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 getBankAccount' + ); + } + + + $resourcePath = '/bank-accounts/{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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 listBankAccount + * + * List all bank account + * + * @param int $page page (optional) + * @param int $perPage perPage (optional, default to 25) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBankAccount'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\BankAccountList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function listBankAccount($page = null, $perPage = 25, string $contentType = self::contentTypes['listBankAccount'][0]) + { + list($response) = $this->listBankAccountWithHttpInfo($page, $perPage, $contentType); + return $response; + } + + /** + * Operation listBankAccountWithHttpInfo + * + * List all bank account + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBankAccount'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\BankAccountList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function listBankAccountWithHttpInfo($page = null, $perPage = 25, string $contentType = self::contentTypes['listBankAccount'][0]) + { + $request = $this->listBankAccountRequest($page, $perPage, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\BankAccountList' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\BankAccountList' !== '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, '\Cone\Billingo\Model\BankAccountList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\BankAccountList'; + 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(), + '\Cone\Billingo\Model\BankAccountList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listBankAccountAsync + * + * List all bank account + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listBankAccountAsync($page = null, $perPage = 25, string $contentType = self::contentTypes['listBankAccount'][0]) + { + return $this->listBankAccountAsyncWithHttpInfo($page, $perPage, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listBankAccountAsyncWithHttpInfo + * + * List all bank account + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listBankAccountAsyncWithHttpInfo($page = null, $perPage = 25, string $contentType = self::contentTypes['listBankAccount'][0]) + { + $returnType = '\Cone\Billingo\Model\BankAccountList'; + $request = $this->listBankAccountRequest($page, $perPage, $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 'listBankAccount' + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listBankAccountRequest($page = null, $perPage = 25, string $contentType = self::contentTypes['listBankAccount'][0]) + { + + + if ($perPage !== null && $perPage > 100) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling BankAccountApi.listBankAccount, must be smaller than or equal to 100.'); + } + if ($perPage !== null && $perPage < 1) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling BankAccountApi.listBankAccount, must be bigger than or equal to 1.'); + } + + + $resourcePath = '/bank-accounts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // 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( + $perPage, + 'per_page', // 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 updateBankAccount + * + * Update a bank account + * + * @param int $id id (required) + * @param \Cone\Billingo\Model\BankAccount $bankAccount Bank account object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBankAccount'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\BankAccount|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function updateBankAccount($id, $bankAccount, string $contentType = self::contentTypes['updateBankAccount'][0]) + { + list($response) = $this->updateBankAccountWithHttpInfo($id, $bankAccount, $contentType); + return $response; + } + + /** + * Operation updateBankAccountWithHttpInfo + * + * Update a bank account + * + * @param int $id (required) + * @param \Cone\Billingo\Model\BankAccount $bankAccount Bank account object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBankAccount'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\BankAccount|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function updateBankAccountWithHttpInfo($id, $bankAccount, string $contentType = self::contentTypes['updateBankAccount'][0]) + { + $request = $this->updateBankAccountRequest($id, $bankAccount, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\BankAccount' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\BankAccount' !== '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, '\Cone\Billingo\Model\BankAccount', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\BankAccount'; + 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(), + '\Cone\Billingo\Model\BankAccount', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateBankAccountAsync + * + * Update a bank account + * + * @param int $id (required) + * @param \Cone\Billingo\Model\BankAccount $bankAccount Bank account object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateBankAccountAsync($id, $bankAccount, string $contentType = self::contentTypes['updateBankAccount'][0]) + { + return $this->updateBankAccountAsyncWithHttpInfo($id, $bankAccount, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateBankAccountAsyncWithHttpInfo + * + * Update a bank account + * + * @param int $id (required) + * @param \Cone\Billingo\Model\BankAccount $bankAccount Bank account object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateBankAccountAsyncWithHttpInfo($id, $bankAccount, string $contentType = self::contentTypes['updateBankAccount'][0]) + { + $returnType = '\Cone\Billingo\Model\BankAccount'; + $request = $this->updateBankAccountRequest($id, $bankAccount, $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 'updateBankAccount' + * + * @param int $id (required) + * @param \Cone\Billingo\Model\BankAccount $bankAccount Bank account object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateBankAccount'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateBankAccountRequest($id, $bankAccount, string $contentType = self::contentTypes['updateBankAccount'][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 updateBankAccount' + ); + } + + // verify the required parameter 'bankAccount' is set + if ($bankAccount === null || (is_array($bankAccount) && count($bankAccount) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $bankAccount when calling updateBankAccount' + ); + } + + + $resourcePath = '/bank-accounts/{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 (isset($bankAccount)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($bankAccount)); + } else { + $httpBody = $bankAccount; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'PUT', + $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/src/Api/CurrencyApi.php b/src/Api/CurrencyApi.php new file mode 100644 index 0000000..ada4667 --- /dev/null +++ b/src/Api/CurrencyApi.php @@ -0,0 +1,703 @@ + [ + '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, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $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 getConversionRate + * + * Get currencies exchange rate. + * + * @param Currency $from from (required) + * @param Currency $to to (required) + * @param \DateTime $date date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConversionRate'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\ConversationRate|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function getConversionRate($from, $to, $date = null, string $contentType = self::contentTypes['getConversionRate'][0]) + { + list($response) = $this->getConversionRateWithHttpInfo($from, $to, $date, $contentType); + return $response; + } + + /** + * Operation getConversionRateWithHttpInfo + * + * Get currencies exchange rate. + * + * @param Currency $from (required) + * @param Currency $to (required) + * @param \DateTime $date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConversionRate'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\ConversationRate|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getConversionRateWithHttpInfo($from, $to, $date = null, string $contentType = self::contentTypes['getConversionRate'][0]) + { + $request = $this->getConversionRateRequest($from, $to, $date, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\ConversationRate' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ConversationRate' !== '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, '\Cone\Billingo\Model\ConversationRate', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\ConversationRate'; + 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(), + '\Cone\Billingo\Model\ConversationRate', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getConversionRateAsync + * + * Get currencies exchange rate. + * + * @param Currency $from (required) + * @param Currency $to (required) + * @param \DateTime $date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConversionRate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getConversionRateAsync($from, $to, $date = null, string $contentType = self::contentTypes['getConversionRate'][0]) + { + return $this->getConversionRateAsyncWithHttpInfo($from, $to, $date, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getConversionRateAsyncWithHttpInfo + * + * Get currencies exchange rate. + * + * @param Currency $from (required) + * @param Currency $to (required) + * @param \DateTime $date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConversionRate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getConversionRateAsyncWithHttpInfo($from, $to, $date = null, string $contentType = self::contentTypes['getConversionRate'][0]) + { + $returnType = '\Cone\Billingo\Model\ConversationRate'; + $request = $this->getConversionRateRequest($from, $to, $date, $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 'getConversionRate' + * + * @param Currency $from (required) + * @param Currency $to (required) + * @param \DateTime $date (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getConversionRate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getConversionRateRequest($from, $to, $date = null, string $contentType = self::contentTypes['getConversionRate'][0]) + { + + // verify the required parameter 'from' is set + if ($from === null || (is_array($from) && count($from) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from when calling getConversionRate' + ); + } + + // verify the required parameter 'to' is set + if ($to === null || (is_array($to) && count($to) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to when calling getConversionRate' + ); + } + + + + $resourcePath = '/currencies'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $from, + 'from', // param base name + 'Currency', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $to, + 'to', // param base name + 'Currency', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $date, + 'date', // param base name + 'string', // 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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/src/Api/DocumentApi.php b/src/Api/DocumentApi.php new file mode 100644 index 0000000..c8b9074 --- /dev/null +++ b/src/Api/DocumentApi.php @@ -0,0 +1,12025 @@ + [ + 'application/json', + ], + 'cancelDocument' => [ + 'application/json', + ], + 'createDocument' => [ + 'application/json', + ], + 'createDocumentFromDraft' => [ + 'application/json', + ], + 'createDocumentFromProforma' => [ + 'application/json', + ], + 'createModificationDocument' => [ + 'application/json', + ], + 'createReceipt' => [ + 'application/json', + ], + 'createReceiptFromDraft' => [ + 'application/json', + ], + 'deleteDocument' => [ + 'application/json', + ], + 'deletePayment' => [ + 'application/json', + ], + 'documentCopy' => [ + 'application/json', + ], + 'downloadDocument' => [ + 'application/json', + ], + 'getDocument' => [ + 'application/json', + ], + 'getDocumentByVendorId' => [ + 'application/json', + ], + 'getOnlineSzamlaStatus' => [ + 'application/json', + ], + 'getPayment' => [ + 'application/json', + ], + 'getPublicUrl' => [ + 'application/json', + ], + 'listDocument' => [ + 'application/json', + ], + 'posPrint' => [ + 'application/json', + ], + 'sendDocument' => [ + 'application/json', + ], + 'updatePayment' => [ + '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, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $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 archiveDocument + * + * Archive a proforma document. + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function archiveDocument($id, string $contentType = self::contentTypes['archiveDocument'][0]) + { + $this->archiveDocumentWithHttpInfo($id, $contentType); + } + + /** + * Operation archiveDocumentWithHttpInfo + * + * Archive a proforma document. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\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 archiveDocumentWithHttpInfo($id, string $contentType = self::contentTypes['archiveDocument'][0]) + { + $request = $this->archiveDocumentRequest($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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation archiveDocumentAsync + * + * Archive a proforma document. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveDocumentAsync($id, string $contentType = self::contentTypes['archiveDocument'][0]) + { + return $this->archiveDocumentAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation archiveDocumentAsyncWithHttpInfo + * + * Archive a proforma document. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function archiveDocumentAsyncWithHttpInfo($id, string $contentType = self::contentTypes['archiveDocument'][0]) + { + $returnType = ''; + $request = $this->archiveDocumentRequest($id, $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 'archiveDocument' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['archiveDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function archiveDocumentRequest($id, string $contentType = self::contentTypes['archiveDocument'][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 archiveDocument' + ); + } + + + $resourcePath = '/documents/{id}/archive'; + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cancelDocument + * + * Cancel a document + * + * @param int $id id (required) + * @param \Cone\Billingo\Model\DocumentCancellation $documentCancellation Comment and notifiable email addresses - comma separated for multiple email addresses (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function cancelDocument($id, $documentCancellation = null, string $contentType = self::contentTypes['cancelDocument'][0]) + { + list($response) = $this->cancelDocumentWithHttpInfo($id, $documentCancellation, $contentType); + return $response; + } + + /** + * Operation cancelDocumentWithHttpInfo + * + * Cancel a document + * + * @param int $id (required) + * @param \Cone\Billingo\Model\DocumentCancellation $documentCancellation Comment and notifiable email addresses - comma separated for multiple email addresses (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function cancelDocumentWithHttpInfo($id, $documentCancellation = null, string $contentType = self::contentTypes['cancelDocument'][0]) + { + $request = $this->cancelDocumentRequest($id, $documentCancellation, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Document' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Document' !== '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, '\Cone\Billingo\Model\Document', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Document'; + 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(), + '\Cone\Billingo\Model\Document', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation cancelDocumentAsync + * + * Cancel a document + * + * @param int $id (required) + * @param \Cone\Billingo\Model\DocumentCancellation $documentCancellation Comment and notifiable email addresses - comma separated for multiple email addresses (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelDocumentAsync($id, $documentCancellation = null, string $contentType = self::contentTypes['cancelDocument'][0]) + { + return $this->cancelDocumentAsyncWithHttpInfo($id, $documentCancellation, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelDocumentAsyncWithHttpInfo + * + * Cancel a document + * + * @param int $id (required) + * @param \Cone\Billingo\Model\DocumentCancellation $documentCancellation Comment and notifiable email addresses - comma separated for multiple email addresses (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelDocumentAsyncWithHttpInfo($id, $documentCancellation = null, string $contentType = self::contentTypes['cancelDocument'][0]) + { + $returnType = '\Cone\Billingo\Model\Document'; + $request = $this->cancelDocumentRequest($id, $documentCancellation, $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 'cancelDocument' + * + * @param int $id (required) + * @param \Cone\Billingo\Model\DocumentCancellation $documentCancellation Comment and notifiable email addresses - comma separated for multiple email addresses (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function cancelDocumentRequest($id, $documentCancellation = null, string $contentType = self::contentTypes['cancelDocument'][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 cancelDocument' + ); + } + + + + $resourcePath = '/documents/{id}/cancel'; + $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 (isset($documentCancellation)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($documentCancellation)); + } else { + $httpBody = $documentCancellation; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 createDocument + * + * Create a document + * + * @param \Cone\Billingo\Model\DocumentInsert $documentInsert DocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function createDocument($documentInsert, string $contentType = self::contentTypes['createDocument'][0]) + { + list($response) = $this->createDocumentWithHttpInfo($documentInsert, $contentType); + return $response; + } + + /** + * Operation createDocumentWithHttpInfo + * + * Create a document + * + * @param \Cone\Billingo\Model\DocumentInsert $documentInsert DocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createDocumentWithHttpInfo($documentInsert, string $contentType = self::contentTypes['createDocument'][0]) + { + $request = $this->createDocumentRequest($documentInsert, $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(); + + 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() + ); + } + + switch($statusCode) { + case 201: + if ('\Cone\Billingo\Model\Document' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Document' !== '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, '\Cone\Billingo\Model\Document', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Document'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\Document', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createDocumentAsync + * + * Create a document + * + * @param \Cone\Billingo\Model\DocumentInsert $documentInsert DocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDocumentAsync($documentInsert, string $contentType = self::contentTypes['createDocument'][0]) + { + return $this->createDocumentAsyncWithHttpInfo($documentInsert, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createDocumentAsyncWithHttpInfo + * + * Create a document + * + * @param \Cone\Billingo\Model\DocumentInsert $documentInsert DocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDocumentAsyncWithHttpInfo($documentInsert, string $contentType = self::contentTypes['createDocument'][0]) + { + $returnType = '\Cone\Billingo\Model\Document'; + $request = $this->createDocumentRequest($documentInsert, $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 'createDocument' + * + * @param \Cone\Billingo\Model\DocumentInsert $documentInsert DocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createDocumentRequest($documentInsert, string $contentType = self::contentTypes['createDocument'][0]) + { + + // verify the required parameter 'documentInsert' is set + if ($documentInsert === null || (is_array($documentInsert) && count($documentInsert) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $documentInsert when calling createDocument' + ); + } + + + $resourcePath = '/documents'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($documentInsert)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($documentInsert)); + } else { + $httpBody = $documentInsert; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 createDocumentFromDraft + * + * Converts a draft to an invoice. + * + * @param int $id id (required) + * @param \Cone\Billingo\Model\DocumentInsert $documentInsert DocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocumentFromDraft'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function createDocumentFromDraft($id, $documentInsert, string $contentType = self::contentTypes['createDocumentFromDraft'][0]) + { + list($response) = $this->createDocumentFromDraftWithHttpInfo($id, $documentInsert, $contentType); + return $response; + } + + /** + * Operation createDocumentFromDraftWithHttpInfo + * + * Converts a draft to an invoice. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\DocumentInsert $documentInsert DocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocumentFromDraft'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createDocumentFromDraftWithHttpInfo($id, $documentInsert, string $contentType = self::contentTypes['createDocumentFromDraft'][0]) + { + $request = $this->createDocumentFromDraftRequest($id, $documentInsert, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Document' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Document' !== '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, '\Cone\Billingo\Model\Document', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Document'; + 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(), + '\Cone\Billingo\Model\Document', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createDocumentFromDraftAsync + * + * Converts a draft to an invoice. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\DocumentInsert $documentInsert DocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocumentFromDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDocumentFromDraftAsync($id, $documentInsert, string $contentType = self::contentTypes['createDocumentFromDraft'][0]) + { + return $this->createDocumentFromDraftAsyncWithHttpInfo($id, $documentInsert, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createDocumentFromDraftAsyncWithHttpInfo + * + * Converts a draft to an invoice. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\DocumentInsert $documentInsert DocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocumentFromDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDocumentFromDraftAsyncWithHttpInfo($id, $documentInsert, string $contentType = self::contentTypes['createDocumentFromDraft'][0]) + { + $returnType = '\Cone\Billingo\Model\Document'; + $request = $this->createDocumentFromDraftRequest($id, $documentInsert, $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 'createDocumentFromDraft' + * + * @param int $id (required) + * @param \Cone\Billingo\Model\DocumentInsert $documentInsert DocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocumentFromDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createDocumentFromDraftRequest($id, $documentInsert, string $contentType = self::contentTypes['createDocumentFromDraft'][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 createDocumentFromDraft' + ); + } + + // verify the required parameter 'documentInsert' is set + if ($documentInsert === null || (is_array($documentInsert) && count($documentInsert) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $documentInsert when calling createDocumentFromDraft' + ); + } + + + $resourcePath = '/documents/{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 (isset($documentInsert)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($documentInsert)); + } else { + $httpBody = $documentInsert; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createDocumentFromProforma + * + * Create a document from proforma. + * + * @param int $id id (required) + * @param \Cone\Billingo\Model\InvoiceSettings $invoiceSettings InvoiceSettings object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocumentFromProforma'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function createDocumentFromProforma($id, $invoiceSettings = null, string $contentType = self::contentTypes['createDocumentFromProforma'][0]) + { + list($response) = $this->createDocumentFromProformaWithHttpInfo($id, $invoiceSettings, $contentType); + return $response; + } + + /** + * Operation createDocumentFromProformaWithHttpInfo + * + * Create a document from proforma. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\InvoiceSettings $invoiceSettings InvoiceSettings object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocumentFromProforma'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createDocumentFromProformaWithHttpInfo($id, $invoiceSettings = null, string $contentType = self::contentTypes['createDocumentFromProforma'][0]) + { + $request = $this->createDocumentFromProformaRequest($id, $invoiceSettings, $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(); + + 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() + ); + } + + switch($statusCode) { + case 201: + if ('\Cone\Billingo\Model\Document' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Document' !== '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, '\Cone\Billingo\Model\Document', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Document'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\Document', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createDocumentFromProformaAsync + * + * Create a document from proforma. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\InvoiceSettings $invoiceSettings InvoiceSettings object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocumentFromProforma'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDocumentFromProformaAsync($id, $invoiceSettings = null, string $contentType = self::contentTypes['createDocumentFromProforma'][0]) + { + return $this->createDocumentFromProformaAsyncWithHttpInfo($id, $invoiceSettings, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createDocumentFromProformaAsyncWithHttpInfo + * + * Create a document from proforma. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\InvoiceSettings $invoiceSettings InvoiceSettings object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocumentFromProforma'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createDocumentFromProformaAsyncWithHttpInfo($id, $invoiceSettings = null, string $contentType = self::contentTypes['createDocumentFromProforma'][0]) + { + $returnType = '\Cone\Billingo\Model\Document'; + $request = $this->createDocumentFromProformaRequest($id, $invoiceSettings, $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 'createDocumentFromProforma' + * + * @param int $id (required) + * @param \Cone\Billingo\Model\InvoiceSettings $invoiceSettings InvoiceSettings object. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createDocumentFromProforma'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createDocumentFromProformaRequest($id, $invoiceSettings = null, string $contentType = self::contentTypes['createDocumentFromProforma'][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 createDocumentFromProforma' + ); + } + + + + $resourcePath = '/documents/{id}/create-from-proforma'; + $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 (isset($invoiceSettings)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($invoiceSettings)); + } else { + $httpBody = $invoiceSettings; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 createModificationDocument + * + * Create a modification document. + * + * @param int $id id (required) + * @param \Cone\Billingo\Model\ModificationDocumentInsert $modificationDocumentInsert ModificationDocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createModificationDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function createModificationDocument($id, $modificationDocumentInsert, string $contentType = self::contentTypes['createModificationDocument'][0]) + { + list($response) = $this->createModificationDocumentWithHttpInfo($id, $modificationDocumentInsert, $contentType); + return $response; + } + + /** + * Operation createModificationDocumentWithHttpInfo + * + * Create a modification document. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\ModificationDocumentInsert $modificationDocumentInsert ModificationDocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createModificationDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createModificationDocumentWithHttpInfo($id, $modificationDocumentInsert, string $contentType = self::contentTypes['createModificationDocument'][0]) + { + $request = $this->createModificationDocumentRequest($id, $modificationDocumentInsert, $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(); + + 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() + ); + } + + switch($statusCode) { + case 201: + if ('\Cone\Billingo\Model\Document' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Document' !== '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, '\Cone\Billingo\Model\Document', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Document'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\Document', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createModificationDocumentAsync + * + * Create a modification document. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\ModificationDocumentInsert $modificationDocumentInsert ModificationDocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createModificationDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createModificationDocumentAsync($id, $modificationDocumentInsert, string $contentType = self::contentTypes['createModificationDocument'][0]) + { + return $this->createModificationDocumentAsyncWithHttpInfo($id, $modificationDocumentInsert, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createModificationDocumentAsyncWithHttpInfo + * + * Create a modification document. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\ModificationDocumentInsert $modificationDocumentInsert ModificationDocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createModificationDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createModificationDocumentAsyncWithHttpInfo($id, $modificationDocumentInsert, string $contentType = self::contentTypes['createModificationDocument'][0]) + { + $returnType = '\Cone\Billingo\Model\Document'; + $request = $this->createModificationDocumentRequest($id, $modificationDocumentInsert, $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 'createModificationDocument' + * + * @param int $id (required) + * @param \Cone\Billingo\Model\ModificationDocumentInsert $modificationDocumentInsert ModificationDocumentInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createModificationDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createModificationDocumentRequest($id, $modificationDocumentInsert, string $contentType = self::contentTypes['createModificationDocument'][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 createModificationDocument' + ); + } + + // verify the required parameter 'modificationDocumentInsert' is set + if ($modificationDocumentInsert === null || (is_array($modificationDocumentInsert) && count($modificationDocumentInsert) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $modificationDocumentInsert when calling createModificationDocument' + ); + } + + + $resourcePath = '/documents/{id}/create-modification-document'; + $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 (isset($modificationDocumentInsert)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($modificationDocumentInsert)); + } else { + $httpBody = $modificationDocumentInsert; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 createReceipt + * + * Create a receipt + * + * @param \Cone\Billingo\Model\ReceiptInsert $receiptInsert ReceiptInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReceipt'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function createReceipt($receiptInsert, string $contentType = self::contentTypes['createReceipt'][0]) + { + list($response) = $this->createReceiptWithHttpInfo($receiptInsert, $contentType); + return $response; + } + + /** + * Operation createReceiptWithHttpInfo + * + * Create a receipt + * + * @param \Cone\Billingo\Model\ReceiptInsert $receiptInsert ReceiptInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReceipt'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createReceiptWithHttpInfo($receiptInsert, string $contentType = self::contentTypes['createReceipt'][0]) + { + $request = $this->createReceiptRequest($receiptInsert, $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(); + + 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() + ); + } + + switch($statusCode) { + case 201: + if ('\Cone\Billingo\Model\Document' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Document' !== '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, '\Cone\Billingo\Model\Document', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Document'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\Document', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createReceiptAsync + * + * Create a receipt + * + * @param \Cone\Billingo\Model\ReceiptInsert $receiptInsert ReceiptInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReceipt'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createReceiptAsync($receiptInsert, string $contentType = self::contentTypes['createReceipt'][0]) + { + return $this->createReceiptAsyncWithHttpInfo($receiptInsert, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createReceiptAsyncWithHttpInfo + * + * Create a receipt + * + * @param \Cone\Billingo\Model\ReceiptInsert $receiptInsert ReceiptInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReceipt'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createReceiptAsyncWithHttpInfo($receiptInsert, string $contentType = self::contentTypes['createReceipt'][0]) + { + $returnType = '\Cone\Billingo\Model\Document'; + $request = $this->createReceiptRequest($receiptInsert, $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 'createReceipt' + * + * @param \Cone\Billingo\Model\ReceiptInsert $receiptInsert ReceiptInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReceipt'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createReceiptRequest($receiptInsert, string $contentType = self::contentTypes['createReceipt'][0]) + { + + // verify the required parameter 'receiptInsert' is set + if ($receiptInsert === null || (is_array($receiptInsert) && count($receiptInsert) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $receiptInsert when calling createReceipt' + ); + } + + + $resourcePath = '/documents/receipt'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($receiptInsert)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($receiptInsert)); + } else { + $httpBody = $receiptInsert; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 createReceiptFromDraft + * + * Converts a draft to a receipt. + * + * @param int $id id (required) + * @param \Cone\Billingo\Model\ReceiptInsert $receiptInsert ReceiptInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReceiptFromDraft'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function createReceiptFromDraft($id, $receiptInsert, string $contentType = self::contentTypes['createReceiptFromDraft'][0]) + { + list($response) = $this->createReceiptFromDraftWithHttpInfo($id, $receiptInsert, $contentType); + return $response; + } + + /** + * Operation createReceiptFromDraftWithHttpInfo + * + * Converts a draft to a receipt. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\ReceiptInsert $receiptInsert ReceiptInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReceiptFromDraft'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createReceiptFromDraftWithHttpInfo($id, $receiptInsert, string $contentType = self::contentTypes['createReceiptFromDraft'][0]) + { + $request = $this->createReceiptFromDraftRequest($id, $receiptInsert, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Document' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Document' !== '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, '\Cone\Billingo\Model\Document', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Document'; + 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(), + '\Cone\Billingo\Model\Document', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createReceiptFromDraftAsync + * + * Converts a draft to a receipt. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\ReceiptInsert $receiptInsert ReceiptInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReceiptFromDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createReceiptFromDraftAsync($id, $receiptInsert, string $contentType = self::contentTypes['createReceiptFromDraft'][0]) + { + return $this->createReceiptFromDraftAsyncWithHttpInfo($id, $receiptInsert, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createReceiptFromDraftAsyncWithHttpInfo + * + * Converts a draft to a receipt. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\ReceiptInsert $receiptInsert ReceiptInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReceiptFromDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createReceiptFromDraftAsyncWithHttpInfo($id, $receiptInsert, string $contentType = self::contentTypes['createReceiptFromDraft'][0]) + { + $returnType = '\Cone\Billingo\Model\Document'; + $request = $this->createReceiptFromDraftRequest($id, $receiptInsert, $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 'createReceiptFromDraft' + * + * @param int $id (required) + * @param \Cone\Billingo\Model\ReceiptInsert $receiptInsert ReceiptInsert object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createReceiptFromDraft'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createReceiptFromDraftRequest($id, $receiptInsert, string $contentType = self::contentTypes['createReceiptFromDraft'][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 createReceiptFromDraft' + ); + } + + // verify the required parameter 'receiptInsert' is set + if ($receiptInsert === null || (is_array($receiptInsert) && count($receiptInsert) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $receiptInsert when calling createReceiptFromDraft' + ); + } + + + $resourcePath = '/documents/receipt/{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 (isset($receiptInsert)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($receiptInsert)); + } else { + $httpBody = $receiptInsert; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteDocument + * + * Delete a draft. + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function deleteDocument($id, string $contentType = self::contentTypes['deleteDocument'][0]) + { + $this->deleteDocumentWithHttpInfo($id, $contentType); + } + + /** + * Operation deleteDocumentWithHttpInfo + * + * Delete a draft. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\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 deleteDocumentWithHttpInfo($id, string $contentType = self::contentTypes['deleteDocument'][0]) + { + $request = $this->deleteDocumentRequest($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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteDocumentAsync + * + * Delete a draft. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteDocumentAsync($id, string $contentType = self::contentTypes['deleteDocument'][0]) + { + return $this->deleteDocumentAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteDocumentAsyncWithHttpInfo + * + * Delete a draft. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteDocumentAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteDocument'][0]) + { + $returnType = ''; + $request = $this->deleteDocumentRequest($id, $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 'deleteDocument' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteDocumentRequest($id, string $contentType = self::contentTypes['deleteDocument'][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 deleteDocument' + ); + } + + + $resourcePath = '/documents/{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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deletePayment + * + * Delete all payment history on document + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePayment'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\PaymentHistory[]|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function deletePayment($id, string $contentType = self::contentTypes['deletePayment'][0]) + { + list($response) = $this->deletePaymentWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation deletePaymentWithHttpInfo + * + * Delete all payment history on document + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePayment'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\PaymentHistory[]|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function deletePaymentWithHttpInfo($id, string $contentType = self::contentTypes['deletePayment'][0]) + { + $request = $this->deletePaymentRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\PaymentHistory[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\PaymentHistory[]' !== '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, '\Cone\Billingo\Model\PaymentHistory[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\PaymentHistory[]'; + 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(), + '\Cone\Billingo\Model\PaymentHistory[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deletePaymentAsync + * + * Delete all payment history on document + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePaymentAsync($id, string $contentType = self::contentTypes['deletePayment'][0]) + { + return $this->deletePaymentAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deletePaymentAsyncWithHttpInfo + * + * Delete all payment history on document + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePaymentAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deletePayment'][0]) + { + $returnType = '\Cone\Billingo\Model\PaymentHistory[]'; + $request = $this->deletePaymentRequest($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 'deletePayment' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deletePaymentRequest($id, string $contentType = self::contentTypes['deletePayment'][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 deletePayment' + ); + } + + + $resourcePath = '/documents/{id}/payments'; + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation documentCopy + * + * Copy a document + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentCopy'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function documentCopy($id, string $contentType = self::contentTypes['documentCopy'][0]) + { + list($response) = $this->documentCopyWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation documentCopyWithHttpInfo + * + * Copy a document + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentCopy'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function documentCopyWithHttpInfo($id, string $contentType = self::contentTypes['documentCopy'][0]) + { + $request = $this->documentCopyRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Document' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Document' !== '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, '\Cone\Billingo\Model\Document', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Document'; + 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(), + '\Cone\Billingo\Model\Document', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation documentCopyAsync + * + * Copy a document + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentCopy'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function documentCopyAsync($id, string $contentType = self::contentTypes['documentCopy'][0]) + { + return $this->documentCopyAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation documentCopyAsyncWithHttpInfo + * + * Copy a document + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentCopy'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function documentCopyAsyncWithHttpInfo($id, string $contentType = self::contentTypes['documentCopy'][0]) + { + $returnType = '\Cone\Billingo\Model\Document'; + $request = $this->documentCopyRequest($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 'documentCopy' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['documentCopy'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function documentCopyRequest($id, string $contentType = self::contentTypes['documentCopy'][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 documentCopy' + ); + } + + + $resourcePath = '/documents/{id}/copy'; + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 downloadDocument + * + * Download a document in PDF format. + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \SplFileObject|\Cone\Billingo\Model\ClientError|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function downloadDocument($id, string $contentType = self::contentTypes['downloadDocument'][0]) + { + list($response) = $this->downloadDocumentWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation downloadDocumentWithHttpInfo + * + * Download a document in PDF format. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \SplFileObject|\Cone\Billingo\Model\ClientError|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function downloadDocumentWithHttpInfo($id, string $contentType = self::contentTypes['downloadDocument'][0]) + { + $request = $this->downloadDocumentRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\SplFileObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\SplFileObject' !== '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, '\SplFileObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 202: + if ('\Cone\Billingo\Model\ClientError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientError' !== '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, '\Cone\Billingo\Model\ClientError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\SplFileObject'; + 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(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation downloadDocumentAsync + * + * Download a document in PDF format. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadDocumentAsync($id, string $contentType = self::contentTypes['downloadDocument'][0]) + { + return $this->downloadDocumentAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation downloadDocumentAsyncWithHttpInfo + * + * Download a document in PDF format. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadDocumentAsyncWithHttpInfo($id, string $contentType = self::contentTypes['downloadDocument'][0]) + { + $returnType = '\SplFileObject'; + $request = $this->downloadDocumentRequest($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 'downloadDocument' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['downloadDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function downloadDocumentRequest($id, string $contentType = self::contentTypes['downloadDocument'][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 downloadDocument' + ); + } + + + $resourcePath = '/documents/{id}/download'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/pdf', '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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 getDocument + * + * Retrieve a document + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function getDocument($id, string $contentType = self::contentTypes['getDocument'][0]) + { + list($response) = $this->getDocumentWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getDocumentWithHttpInfo + * + * Retrieve a document + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getDocumentWithHttpInfo($id, string $contentType = self::contentTypes['getDocument'][0]) + { + $request = $this->getDocumentRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Document' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Document' !== '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, '\Cone\Billingo\Model\Document', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Document'; + 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(), + '\Cone\Billingo\Model\Document', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDocumentAsync + * + * Retrieve a document + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDocumentAsync($id, string $contentType = self::contentTypes['getDocument'][0]) + { + return $this->getDocumentAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDocumentAsyncWithHttpInfo + * + * Retrieve a document + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDocumentAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getDocument'][0]) + { + $returnType = '\Cone\Billingo\Model\Document'; + $request = $this->getDocumentRequest($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 'getDocument' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getDocumentRequest($id, string $contentType = self::contentTypes['getDocument'][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 getDocument' + ); + } + + + $resourcePath = '/documents/{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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 getDocumentByVendorId + * + * Retrieve a document by vendor id + * + * @param string $vendorId vendorId (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDocumentByVendorId'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function getDocumentByVendorId($vendorId, string $contentType = self::contentTypes['getDocumentByVendorId'][0]) + { + list($response) = $this->getDocumentByVendorIdWithHttpInfo($vendorId, $contentType); + return $response; + } + + /** + * Operation getDocumentByVendorIdWithHttpInfo + * + * Retrieve a document by vendor id + * + * @param string $vendorId (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDocumentByVendorId'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Document|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getDocumentByVendorIdWithHttpInfo($vendorId, string $contentType = self::contentTypes['getDocumentByVendorId'][0]) + { + $request = $this->getDocumentByVendorIdRequest($vendorId, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Document' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Document' !== '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, '\Cone\Billingo\Model\Document', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Document'; + 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(), + '\Cone\Billingo\Model\Document', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getDocumentByVendorIdAsync + * + * Retrieve a document by vendor id + * + * @param string $vendorId (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDocumentByVendorId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDocumentByVendorIdAsync($vendorId, string $contentType = self::contentTypes['getDocumentByVendorId'][0]) + { + return $this->getDocumentByVendorIdAsyncWithHttpInfo($vendorId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getDocumentByVendorIdAsyncWithHttpInfo + * + * Retrieve a document by vendor id + * + * @param string $vendorId (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDocumentByVendorId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getDocumentByVendorIdAsyncWithHttpInfo($vendorId, string $contentType = self::contentTypes['getDocumentByVendorId'][0]) + { + $returnType = '\Cone\Billingo\Model\Document'; + $request = $this->getDocumentByVendorIdRequest($vendorId, $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 'getDocumentByVendorId' + * + * @param string $vendorId (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getDocumentByVendorId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getDocumentByVendorIdRequest($vendorId, string $contentType = self::contentTypes['getDocumentByVendorId'][0]) + { + + // verify the required parameter 'vendorId' is set + if ($vendorId === null || (is_array($vendorId) && count($vendorId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $vendorId when calling getDocumentByVendorId' + ); + } + + + $resourcePath = '/documents/vendor/{vendor_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($vendorId !== null) { + $resourcePath = str_replace( + '{' . 'vendor_id' . '}', + ObjectSerializer::toPathValue($vendorId), + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 getOnlineSzamlaStatus + * + * Retrieve a document Online Számla status + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOnlineSzamlaStatus'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\OnlineSzamlaStatus|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function getOnlineSzamlaStatus($id, string $contentType = self::contentTypes['getOnlineSzamlaStatus'][0]) + { + list($response) = $this->getOnlineSzamlaStatusWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getOnlineSzamlaStatusWithHttpInfo + * + * Retrieve a document Online Számla status + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOnlineSzamlaStatus'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\OnlineSzamlaStatus|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getOnlineSzamlaStatusWithHttpInfo($id, string $contentType = self::contentTypes['getOnlineSzamlaStatus'][0]) + { + $request = $this->getOnlineSzamlaStatusRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\OnlineSzamlaStatus' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\OnlineSzamlaStatus' !== '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, '\Cone\Billingo\Model\OnlineSzamlaStatus', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\OnlineSzamlaStatus'; + 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(), + '\Cone\Billingo\Model\OnlineSzamlaStatus', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getOnlineSzamlaStatusAsync + * + * Retrieve a document Online Számla status + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOnlineSzamlaStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOnlineSzamlaStatusAsync($id, string $contentType = self::contentTypes['getOnlineSzamlaStatus'][0]) + { + return $this->getOnlineSzamlaStatusAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOnlineSzamlaStatusAsyncWithHttpInfo + * + * Retrieve a document Online Számla status + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOnlineSzamlaStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOnlineSzamlaStatusAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getOnlineSzamlaStatus'][0]) + { + $returnType = '\Cone\Billingo\Model\OnlineSzamlaStatus'; + $request = $this->getOnlineSzamlaStatusRequest($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 'getOnlineSzamlaStatus' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOnlineSzamlaStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getOnlineSzamlaStatusRequest($id, string $contentType = self::contentTypes['getOnlineSzamlaStatus'][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 getOnlineSzamlaStatus' + ); + } + + + $resourcePath = '/documents/{id}/online-szamla'; + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 getPayment + * + * Retrieve a payment histroy + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayment'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\PaymentHistory[]|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function getPayment($id, string $contentType = self::contentTypes['getPayment'][0]) + { + list($response) = $this->getPaymentWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getPaymentWithHttpInfo + * + * Retrieve a payment histroy + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayment'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\PaymentHistory[]|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getPaymentWithHttpInfo($id, string $contentType = self::contentTypes['getPayment'][0]) + { + $request = $this->getPaymentRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\PaymentHistory[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\PaymentHistory[]' !== '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, '\Cone\Billingo\Model\PaymentHistory[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\PaymentHistory[]'; + 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(), + '\Cone\Billingo\Model\PaymentHistory[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPaymentAsync + * + * Retrieve a payment histroy + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentAsync($id, string $contentType = self::contentTypes['getPayment'][0]) + { + return $this->getPaymentAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPaymentAsyncWithHttpInfo + * + * Retrieve a payment histroy + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPaymentAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getPayment'][0]) + { + $returnType = '\Cone\Billingo\Model\PaymentHistory[]'; + $request = $this->getPaymentRequest($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 'getPayment' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPaymentRequest($id, string $contentType = self::contentTypes['getPayment'][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 getPayment' + ); + } + + + $resourcePath = '/documents/{id}/payments'; + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 getPublicUrl + * + * Retrieve a document download public url. + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPublicUrl'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\DocumentPublicUrl|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function getPublicUrl($id, string $contentType = self::contentTypes['getPublicUrl'][0]) + { + list($response) = $this->getPublicUrlWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getPublicUrlWithHttpInfo + * + * Retrieve a document download public url. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPublicUrl'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\DocumentPublicUrl|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getPublicUrlWithHttpInfo($id, string $contentType = self::contentTypes['getPublicUrl'][0]) + { + $request = $this->getPublicUrlRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\DocumentPublicUrl' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\DocumentPublicUrl' !== '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, '\Cone\Billingo\Model\DocumentPublicUrl', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\DocumentPublicUrl'; + 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(), + '\Cone\Billingo\Model\DocumentPublicUrl', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPublicUrlAsync + * + * Retrieve a document download public url. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPublicUrl'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPublicUrlAsync($id, string $contentType = self::contentTypes['getPublicUrl'][0]) + { + return $this->getPublicUrlAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPublicUrlAsyncWithHttpInfo + * + * Retrieve a document download public url. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPublicUrl'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPublicUrlAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getPublicUrl'][0]) + { + $returnType = '\Cone\Billingo\Model\DocumentPublicUrl'; + $request = $this->getPublicUrlRequest($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 'getPublicUrl' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPublicUrl'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPublicUrlRequest($id, string $contentType = self::contentTypes['getPublicUrl'][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 getPublicUrl' + ); + } + + + $resourcePath = '/documents/{id}/public-url'; + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 listDocument + * + * List all documents + * + * @param int $page page (optional) + * @param int $perPage perPage (optional, default to 25) + * @param int $blockId Filter documents by the identifier of your DocumentBlock. (optional) + * @param int $partnerId Filter documents by the identifier of your Partner. (optional) + * @param PaymentMethod $paymentMethod Filter documents by PaymentMethod value. (optional) + * @param PaymentStatus $paymentStatus Filter documents by PaymentStatus value. (optional) + * @param \DateTime $startDate Filter documents by their invoice date. (optional) + * @param \DateTime $endDate Filter documents by their invoice date. (optional) + * @param int $startNumber Starting number of the document, should not contain year or any other formatting. Required if `start_year` given (optional) + * @param int $endNumber Ending number of the document, should not contain year or any other formatting. Required if `end_year` given (optional) + * @param int $startYear Year for `start_number` parameter. Required if `start_number` given. (optional) + * @param int $endYear Year for `end_number` parameter. Required if `end_number` given. (optional) + * @param DocumentType $type Filter documents by type (optional) + * @param string $query Filter documents by the given text (optional) + * @param \DateTime $paidStartDate Filter documents by their payment date. (optional) + * @param \DateTime $paidEndDate Filter documents by their payment date. (optional) + * @param \DateTime $fulfillmentStartDate Filter documents by their fulfillment date. (optional) + * @param \DateTime $fulfillmentEndDate Filter documents by their fulfillment date. (optional) + * @param string $lastModifiedDate Filter documents by their last modified date. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\DocumentList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function listDocument($page = null, $perPage = 25, $blockId = null, $partnerId = null, $paymentMethod = null, $paymentStatus = null, $startDate = null, $endDate = null, $startNumber = null, $endNumber = null, $startYear = null, $endYear = null, $type = null, $query = null, $paidStartDate = null, $paidEndDate = null, $fulfillmentStartDate = null, $fulfillmentEndDate = null, $lastModifiedDate = null, string $contentType = self::contentTypes['listDocument'][0]) + { + list($response) = $this->listDocumentWithHttpInfo($page, $perPage, $blockId, $partnerId, $paymentMethod, $paymentStatus, $startDate, $endDate, $startNumber, $endNumber, $startYear, $endYear, $type, $query, $paidStartDate, $paidEndDate, $fulfillmentStartDate, $fulfillmentEndDate, $lastModifiedDate, $contentType); + return $response; + } + + /** + * Operation listDocumentWithHttpInfo + * + * List all documents + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param int $blockId Filter documents by the identifier of your DocumentBlock. (optional) + * @param int $partnerId Filter documents by the identifier of your Partner. (optional) + * @param PaymentMethod $paymentMethod Filter documents by PaymentMethod value. (optional) + * @param PaymentStatus $paymentStatus Filter documents by PaymentStatus value. (optional) + * @param \DateTime $startDate Filter documents by their invoice date. (optional) + * @param \DateTime $endDate Filter documents by their invoice date. (optional) + * @param int $startNumber Starting number of the document, should not contain year or any other formatting. Required if `start_year` given (optional) + * @param int $endNumber Ending number of the document, should not contain year or any other formatting. Required if `end_year` given (optional) + * @param int $startYear Year for `start_number` parameter. Required if `start_number` given. (optional) + * @param int $endYear Year for `end_number` parameter. Required if `end_number` given. (optional) + * @param DocumentType $type Filter documents by type (optional) + * @param string $query Filter documents by the given text (optional) + * @param \DateTime $paidStartDate Filter documents by their payment date. (optional) + * @param \DateTime $paidEndDate Filter documents by their payment date. (optional) + * @param \DateTime $fulfillmentStartDate Filter documents by their fulfillment date. (optional) + * @param \DateTime $fulfillmentEndDate Filter documents by their fulfillment date. (optional) + * @param string $lastModifiedDate Filter documents by their last modified date. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\DocumentList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function listDocumentWithHttpInfo($page = null, $perPage = 25, $blockId = null, $partnerId = null, $paymentMethod = null, $paymentStatus = null, $startDate = null, $endDate = null, $startNumber = null, $endNumber = null, $startYear = null, $endYear = null, $type = null, $query = null, $paidStartDate = null, $paidEndDate = null, $fulfillmentStartDate = null, $fulfillmentEndDate = null, $lastModifiedDate = null, string $contentType = self::contentTypes['listDocument'][0]) + { + $request = $this->listDocumentRequest($page, $perPage, $blockId, $partnerId, $paymentMethod, $paymentStatus, $startDate, $endDate, $startNumber, $endNumber, $startYear, $endYear, $type, $query, $paidStartDate, $paidEndDate, $fulfillmentStartDate, $fulfillmentEndDate, $lastModifiedDate, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\DocumentList' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\DocumentList' !== '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, '\Cone\Billingo\Model\DocumentList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\DocumentList'; + 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(), + '\Cone\Billingo\Model\DocumentList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listDocumentAsync + * + * List all documents + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param int $blockId Filter documents by the identifier of your DocumentBlock. (optional) + * @param int $partnerId Filter documents by the identifier of your Partner. (optional) + * @param PaymentMethod $paymentMethod Filter documents by PaymentMethod value. (optional) + * @param PaymentStatus $paymentStatus Filter documents by PaymentStatus value. (optional) + * @param \DateTime $startDate Filter documents by their invoice date. (optional) + * @param \DateTime $endDate Filter documents by their invoice date. (optional) + * @param int $startNumber Starting number of the document, should not contain year or any other formatting. Required if `start_year` given (optional) + * @param int $endNumber Ending number of the document, should not contain year or any other formatting. Required if `end_year` given (optional) + * @param int $startYear Year for `start_number` parameter. Required if `start_number` given. (optional) + * @param int $endYear Year for `end_number` parameter. Required if `end_number` given. (optional) + * @param DocumentType $type Filter documents by type (optional) + * @param string $query Filter documents by the given text (optional) + * @param \DateTime $paidStartDate Filter documents by their payment date. (optional) + * @param \DateTime $paidEndDate Filter documents by their payment date. (optional) + * @param \DateTime $fulfillmentStartDate Filter documents by their fulfillment date. (optional) + * @param \DateTime $fulfillmentEndDate Filter documents by their fulfillment date. (optional) + * @param string $lastModifiedDate Filter documents by their last modified date. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listDocumentAsync($page = null, $perPage = 25, $blockId = null, $partnerId = null, $paymentMethod = null, $paymentStatus = null, $startDate = null, $endDate = null, $startNumber = null, $endNumber = null, $startYear = null, $endYear = null, $type = null, $query = null, $paidStartDate = null, $paidEndDate = null, $fulfillmentStartDate = null, $fulfillmentEndDate = null, $lastModifiedDate = null, string $contentType = self::contentTypes['listDocument'][0]) + { + return $this->listDocumentAsyncWithHttpInfo($page, $perPage, $blockId, $partnerId, $paymentMethod, $paymentStatus, $startDate, $endDate, $startNumber, $endNumber, $startYear, $endYear, $type, $query, $paidStartDate, $paidEndDate, $fulfillmentStartDate, $fulfillmentEndDate, $lastModifiedDate, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listDocumentAsyncWithHttpInfo + * + * List all documents + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param int $blockId Filter documents by the identifier of your DocumentBlock. (optional) + * @param int $partnerId Filter documents by the identifier of your Partner. (optional) + * @param PaymentMethod $paymentMethod Filter documents by PaymentMethod value. (optional) + * @param PaymentStatus $paymentStatus Filter documents by PaymentStatus value. (optional) + * @param \DateTime $startDate Filter documents by their invoice date. (optional) + * @param \DateTime $endDate Filter documents by their invoice date. (optional) + * @param int $startNumber Starting number of the document, should not contain year or any other formatting. Required if `start_year` given (optional) + * @param int $endNumber Ending number of the document, should not contain year or any other formatting. Required if `end_year` given (optional) + * @param int $startYear Year for `start_number` parameter. Required if `start_number` given. (optional) + * @param int $endYear Year for `end_number` parameter. Required if `end_number` given. (optional) + * @param DocumentType $type Filter documents by type (optional) + * @param string $query Filter documents by the given text (optional) + * @param \DateTime $paidStartDate Filter documents by their payment date. (optional) + * @param \DateTime $paidEndDate Filter documents by their payment date. (optional) + * @param \DateTime $fulfillmentStartDate Filter documents by their fulfillment date. (optional) + * @param \DateTime $fulfillmentEndDate Filter documents by their fulfillment date. (optional) + * @param string $lastModifiedDate Filter documents by their last modified date. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listDocumentAsyncWithHttpInfo($page = null, $perPage = 25, $blockId = null, $partnerId = null, $paymentMethod = null, $paymentStatus = null, $startDate = null, $endDate = null, $startNumber = null, $endNumber = null, $startYear = null, $endYear = null, $type = null, $query = null, $paidStartDate = null, $paidEndDate = null, $fulfillmentStartDate = null, $fulfillmentEndDate = null, $lastModifiedDate = null, string $contentType = self::contentTypes['listDocument'][0]) + { + $returnType = '\Cone\Billingo\Model\DocumentList'; + $request = $this->listDocumentRequest($page, $perPage, $blockId, $partnerId, $paymentMethod, $paymentStatus, $startDate, $endDate, $startNumber, $endNumber, $startYear, $endYear, $type, $query, $paidStartDate, $paidEndDate, $fulfillmentStartDate, $fulfillmentEndDate, $lastModifiedDate, $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 'listDocument' + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param int $blockId Filter documents by the identifier of your DocumentBlock. (optional) + * @param int $partnerId Filter documents by the identifier of your Partner. (optional) + * @param PaymentMethod $paymentMethod Filter documents by PaymentMethod value. (optional) + * @param PaymentStatus $paymentStatus Filter documents by PaymentStatus value. (optional) + * @param \DateTime $startDate Filter documents by their invoice date. (optional) + * @param \DateTime $endDate Filter documents by their invoice date. (optional) + * @param int $startNumber Starting number of the document, should not contain year or any other formatting. Required if `start_year` given (optional) + * @param int $endNumber Ending number of the document, should not contain year or any other formatting. Required if `end_year` given (optional) + * @param int $startYear Year for `start_number` parameter. Required if `start_number` given. (optional) + * @param int $endYear Year for `end_number` parameter. Required if `end_number` given. (optional) + * @param DocumentType $type Filter documents by type (optional) + * @param string $query Filter documents by the given text (optional) + * @param \DateTime $paidStartDate Filter documents by their payment date. (optional) + * @param \DateTime $paidEndDate Filter documents by their payment date. (optional) + * @param \DateTime $fulfillmentStartDate Filter documents by their fulfillment date. (optional) + * @param \DateTime $fulfillmentEndDate Filter documents by their fulfillment date. (optional) + * @param string $lastModifiedDate Filter documents by their last modified date. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listDocumentRequest($page = null, $perPage = 25, $blockId = null, $partnerId = null, $paymentMethod = null, $paymentStatus = null, $startDate = null, $endDate = null, $startNumber = null, $endNumber = null, $startYear = null, $endYear = null, $type = null, $query = null, $paidStartDate = null, $paidEndDate = null, $fulfillmentStartDate = null, $fulfillmentEndDate = null, $lastModifiedDate = null, string $contentType = self::contentTypes['listDocument'][0]) + { + + + if ($perPage !== null && $perPage > 100) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling DocumentApi.listDocument, must be smaller than or equal to 100.'); + } + if ($perPage !== null && $perPage < 1) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling DocumentApi.listDocument, must be bigger than or equal to 1.'); + } + + + + + + + + + + + + + + + + + + + + $resourcePath = '/documents'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // 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( + $perPage, + 'per_page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $blockId, + 'block_id', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $partnerId, + 'partner_id', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $paymentMethod, + 'payment_method', // param base name + 'PaymentMethod', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $paymentStatus, + 'payment_status', // param base name + 'PaymentStatus', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startNumber, + 'start_number', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endNumber, + 'end_number', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startYear, + 'start_year', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endYear, + 'end_year', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'DocumentType', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $query, + 'query', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $paidStartDate, + 'paid_start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $paidEndDate, + 'paid_end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $fulfillmentStartDate, + 'fulfillment_start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $fulfillmentEndDate, + 'fulfillment_end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $lastModifiedDate, + 'last_modified_date', // param base name + 'string', // 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 posPrint + * + * Returns a printable POS PDF + * + * @param int $id id (required) + * @param float $size In which size the POS PDF should be rendered. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['posPrint'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \SplFileObject|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function posPrint($id, $size, string $contentType = self::contentTypes['posPrint'][0]) + { + list($response) = $this->posPrintWithHttpInfo($id, $size, $contentType); + return $response; + } + + /** + * Operation posPrintWithHttpInfo + * + * Returns a printable POS PDF + * + * @param int $id (required) + * @param float $size In which size the POS PDF should be rendered. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['posPrint'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \SplFileObject|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function posPrintWithHttpInfo($id, $size, string $contentType = self::contentTypes['posPrint'][0]) + { + $request = $this->posPrintRequest($id, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\SplFileObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\SplFileObject' !== '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, '\SplFileObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\SplFileObject'; + 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(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation posPrintAsync + * + * Returns a printable POS PDF + * + * @param int $id (required) + * @param float $size In which size the POS PDF should be rendered. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['posPrint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function posPrintAsync($id, $size, string $contentType = self::contentTypes['posPrint'][0]) + { + return $this->posPrintAsyncWithHttpInfo($id, $size, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation posPrintAsyncWithHttpInfo + * + * Returns a printable POS PDF + * + * @param int $id (required) + * @param float $size In which size the POS PDF should be rendered. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['posPrint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function posPrintAsyncWithHttpInfo($id, $size, string $contentType = self::contentTypes['posPrint'][0]) + { + $returnType = '\SplFileObject'; + $request = $this->posPrintRequest($id, $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 'posPrint' + * + * @param int $id (required) + * @param float $size In which size the POS PDF should be rendered. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['posPrint'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function posPrintRequest($id, $size, string $contentType = self::contentTypes['posPrint'][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 posPrint' + ); + } + + // verify the required parameter 'size' is set + if ($size === null || (is_array($size) && count($size) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $size when calling posPrint' + ); + } + + + $resourcePath = '/documents/{id}/print/pos'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $size, + 'size', // param base name + 'number', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/pdf', '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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 sendDocument + * + * Send invoice to given email adresses. + * + * @param int $id id (required) + * @param \Cone\Billingo\Model\SendDocument $sendDocument List of email-s where you want to send the invoice. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\SendDocument|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function sendDocument($id, $sendDocument = null, string $contentType = self::contentTypes['sendDocument'][0]) + { + list($response) = $this->sendDocumentWithHttpInfo($id, $sendDocument, $contentType); + return $response; + } + + /** + * Operation sendDocumentWithHttpInfo + * + * Send invoice to given email adresses. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\SendDocument $sendDocument List of email-s where you want to send the invoice. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendDocument'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\SendDocument|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function sendDocumentWithHttpInfo($id, $sendDocument = null, string $contentType = self::contentTypes['sendDocument'][0]) + { + $request = $this->sendDocumentRequest($id, $sendDocument, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\SendDocument' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SendDocument' !== '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, '\Cone\Billingo\Model\SendDocument', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\SendDocument'; + 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(), + '\Cone\Billingo\Model\SendDocument', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sendDocumentAsync + * + * Send invoice to given email adresses. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\SendDocument $sendDocument List of email-s where you want to send the invoice. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendDocumentAsync($id, $sendDocument = null, string $contentType = self::contentTypes['sendDocument'][0]) + { + return $this->sendDocumentAsyncWithHttpInfo($id, $sendDocument, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendDocumentAsyncWithHttpInfo + * + * Send invoice to given email adresses. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\SendDocument $sendDocument List of email-s where you want to send the invoice. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendDocumentAsyncWithHttpInfo($id, $sendDocument = null, string $contentType = self::contentTypes['sendDocument'][0]) + { + $returnType = '\Cone\Billingo\Model\SendDocument'; + $request = $this->sendDocumentRequest($id, $sendDocument, $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 'sendDocument' + * + * @param int $id (required) + * @param \Cone\Billingo\Model\SendDocument $sendDocument List of email-s where you want to send the invoice. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendDocument'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendDocumentRequest($id, $sendDocument = null, string $contentType = self::contentTypes['sendDocument'][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 sendDocument' + ); + } + + + + $resourcePath = '/documents/{id}/send'; + $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 (isset($sendDocument)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($sendDocument)); + } else { + $httpBody = $sendDocument; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 updatePayment + * + * Update payment history + * + * @param int $id id (required) + * @param \Cone\Billingo\Model\PaymentHistory[] $paymentHistory Payment history object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePayment'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\PaymentHistory[]|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function updatePayment($id, $paymentHistory, string $contentType = self::contentTypes['updatePayment'][0]) + { + list($response) = $this->updatePaymentWithHttpInfo($id, $paymentHistory, $contentType); + return $response; + } + + /** + * Operation updatePaymentWithHttpInfo + * + * Update payment history + * + * @param int $id (required) + * @param \Cone\Billingo\Model\PaymentHistory[] $paymentHistory Payment history object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePayment'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\PaymentHistory[]|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function updatePaymentWithHttpInfo($id, $paymentHistory, string $contentType = self::contentTypes['updatePayment'][0]) + { + $request = $this->updatePaymentRequest($id, $paymentHistory, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\PaymentHistory[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\PaymentHistory[]' !== '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, '\Cone\Billingo\Model\PaymentHistory[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\PaymentHistory[]'; + 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(), + '\Cone\Billingo\Model\PaymentHistory[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updatePaymentAsync + * + * Update payment history + * + * @param int $id (required) + * @param \Cone\Billingo\Model\PaymentHistory[] $paymentHistory Payment history object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePaymentAsync($id, $paymentHistory, string $contentType = self::contentTypes['updatePayment'][0]) + { + return $this->updatePaymentAsyncWithHttpInfo($id, $paymentHistory, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updatePaymentAsyncWithHttpInfo + * + * Update payment history + * + * @param int $id (required) + * @param \Cone\Billingo\Model\PaymentHistory[] $paymentHistory Payment history object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePaymentAsyncWithHttpInfo($id, $paymentHistory, string $contentType = self::contentTypes['updatePayment'][0]) + { + $returnType = '\Cone\Billingo\Model\PaymentHistory[]'; + $request = $this->updatePaymentRequest($id, $paymentHistory, $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 'updatePayment' + * + * @param int $id (required) + * @param \Cone\Billingo\Model\PaymentHistory[] $paymentHistory Payment history object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePayment'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updatePaymentRequest($id, $paymentHistory, string $contentType = self::contentTypes['updatePayment'][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 updatePayment' + ); + } + + // verify the required parameter 'paymentHistory' is set + if ($paymentHistory === null || (is_array($paymentHistory) && count($paymentHistory) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $paymentHistory when calling updatePayment' + ); + } + + + $resourcePath = '/documents/{id}/payments'; + $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 (isset($paymentHistory)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($paymentHistory)); + } else { + $httpBody = $paymentHistory; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'PUT', + $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/src/Api/DocumentBlockApi.php b/src/Api/DocumentBlockApi.php new file mode 100644 index 0000000..d2e923b --- /dev/null +++ b/src/Api/DocumentBlockApi.php @@ -0,0 +1,697 @@ + [ + '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, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $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 listDocumentBlock + * + * List all document blocks + * + * @param int $page page (optional) + * @param int $perPage perPage (optional, default to 25) + * @param DocumentBlockType $type Filter document blocks by type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listDocumentBlock'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\DocumentBlockList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function listDocumentBlock($page = null, $perPage = 25, $type = null, string $contentType = self::contentTypes['listDocumentBlock'][0]) + { + list($response) = $this->listDocumentBlockWithHttpInfo($page, $perPage, $type, $contentType); + return $response; + } + + /** + * Operation listDocumentBlockWithHttpInfo + * + * List all document blocks + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param DocumentBlockType $type Filter document blocks by type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listDocumentBlock'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\DocumentBlockList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function listDocumentBlockWithHttpInfo($page = null, $perPage = 25, $type = null, string $contentType = self::contentTypes['listDocumentBlock'][0]) + { + $request = $this->listDocumentBlockRequest($page, $perPage, $type, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\DocumentBlockList' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\DocumentBlockList' !== '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, '\Cone\Billingo\Model\DocumentBlockList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\DocumentBlockList'; + 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(), + '\Cone\Billingo\Model\DocumentBlockList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listDocumentBlockAsync + * + * List all document blocks + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param DocumentBlockType $type Filter document blocks by type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listDocumentBlock'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listDocumentBlockAsync($page = null, $perPage = 25, $type = null, string $contentType = self::contentTypes['listDocumentBlock'][0]) + { + return $this->listDocumentBlockAsyncWithHttpInfo($page, $perPage, $type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listDocumentBlockAsyncWithHttpInfo + * + * List all document blocks + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param DocumentBlockType $type Filter document blocks by type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listDocumentBlock'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listDocumentBlockAsyncWithHttpInfo($page = null, $perPage = 25, $type = null, string $contentType = self::contentTypes['listDocumentBlock'][0]) + { + $returnType = '\Cone\Billingo\Model\DocumentBlockList'; + $request = $this->listDocumentBlockRequest($page, $perPage, $type, $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 'listDocumentBlock' + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param DocumentBlockType $type Filter document blocks by type (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listDocumentBlock'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listDocumentBlockRequest($page = null, $perPage = 25, $type = null, string $contentType = self::contentTypes['listDocumentBlock'][0]) + { + + + if ($perPage !== null && $perPage > 100) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling DocumentBlockApi.listDocumentBlock, must be smaller than or equal to 100.'); + } + if ($perPage !== null && $perPage < 1) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling DocumentBlockApi.listDocumentBlock, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/document-blocks'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // 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( + $perPage, + 'per_page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'DocumentBlockType', // 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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/src/Api/DocumentExportApi.php b/src/Api/DocumentExportApi.php new file mode 100644 index 0000000..b541ee0 --- /dev/null +++ b/src/Api/DocumentExportApi.php @@ -0,0 +1,1820 @@ + [ + 'application/json', + ], + 'download' => [ + 'application/json', + ], + 'poll' => [ + '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, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $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 create + * + * Create document export. + * + * @param \Cone\Billingo\Model\CreateDocumentExport $createDocumentExport Create document export body. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\DocumentExportId|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function create($createDocumentExport, string $contentType = self::contentTypes['create'][0]) + { + list($response) = $this->createWithHttpInfo($createDocumentExport, $contentType); + return $response; + } + + /** + * Operation createWithHttpInfo + * + * Create document export. + * + * @param \Cone\Billingo\Model\CreateDocumentExport $createDocumentExport Create document export body. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\DocumentExportId|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createWithHttpInfo($createDocumentExport, string $contentType = self::contentTypes['create'][0]) + { + $request = $this->createRequest($createDocumentExport, $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(); + + 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() + ); + } + + switch($statusCode) { + case 201: + if ('\Cone\Billingo\Model\DocumentExportId' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\DocumentExportId' !== '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, '\Cone\Billingo\Model\DocumentExportId', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\DocumentExportId'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\DocumentExportId', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createAsync + * + * Create document export. + * + * @param \Cone\Billingo\Model\CreateDocumentExport $createDocumentExport Create document export body. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsync($createDocumentExport, string $contentType = self::contentTypes['create'][0]) + { + return $this->createAsyncWithHttpInfo($createDocumentExport, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createAsyncWithHttpInfo + * + * Create document export. + * + * @param \Cone\Billingo\Model\CreateDocumentExport $createDocumentExport Create document export body. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createAsyncWithHttpInfo($createDocumentExport, string $contentType = self::contentTypes['create'][0]) + { + $returnType = '\Cone\Billingo\Model\DocumentExportId'; + $request = $this->createRequest($createDocumentExport, $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 'create' + * + * @param \Cone\Billingo\Model\CreateDocumentExport $createDocumentExport Create document export body. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['create'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createRequest($createDocumentExport, string $contentType = self::contentTypes['create'][0]) + { + + // verify the required parameter 'createDocumentExport' is set + if ($createDocumentExport === null || (is_array($createDocumentExport) && count($createDocumentExport) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $createDocumentExport when calling create' + ); + } + + + $resourcePath = '/document-export'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($createDocumentExport)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($createDocumentExport)); + } else { + $httpBody = $createDocumentExport; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 download + * + * Return exported binary file. + * + * @param string $id The ID from create document export endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['download'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \SplFileObject|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function download($id, string $contentType = self::contentTypes['download'][0]) + { + list($response) = $this->downloadWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation downloadWithHttpInfo + * + * Return exported binary file. + * + * @param string $id The ID from create document export endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['download'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \SplFileObject|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function downloadWithHttpInfo($id, string $contentType = self::contentTypes['download'][0]) + { + $request = $this->downloadRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\SplFileObject' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\SplFileObject' !== '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, '\SplFileObject', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\SplFileObject'; + 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(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation downloadAsync + * + * Return exported binary file. + * + * @param string $id The ID from create document export endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['download'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadAsync($id, string $contentType = self::contentTypes['download'][0]) + { + return $this->downloadAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation downloadAsyncWithHttpInfo + * + * Return exported binary file. + * + * @param string $id The ID from create document export endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['download'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function downloadAsyncWithHttpInfo($id, string $contentType = self::contentTypes['download'][0]) + { + $returnType = '\SplFileObject'; + $request = $this->downloadRequest($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 'download' + * + * @param string $id The ID from create document export endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['download'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function downloadRequest($id, string $contentType = self::contentTypes['download'][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 download' + ); + } + + + $resourcePath = '/document-export/{id}/download'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/*', '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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 poll + * + * Retrieve export state. + * + * @param string $id The ID from create document export endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['poll'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\DocumentExportStatus|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function poll($id, string $contentType = self::contentTypes['poll'][0]) + { + list($response) = $this->pollWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation pollWithHttpInfo + * + * Retrieve export state. + * + * @param string $id The ID from create document export endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['poll'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\DocumentExportStatus|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function pollWithHttpInfo($id, string $contentType = self::contentTypes['poll'][0]) + { + $request = $this->pollRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\DocumentExportStatus' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\DocumentExportStatus' !== '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, '\Cone\Billingo\Model\DocumentExportStatus', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\DocumentExportStatus'; + 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(), + '\Cone\Billingo\Model\DocumentExportStatus', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation pollAsync + * + * Retrieve export state. + * + * @param string $id The ID from create document export endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['poll'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function pollAsync($id, string $contentType = self::contentTypes['poll'][0]) + { + return $this->pollAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation pollAsyncWithHttpInfo + * + * Retrieve export state. + * + * @param string $id The ID from create document export endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['poll'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function pollAsyncWithHttpInfo($id, string $contentType = self::contentTypes['poll'][0]) + { + $returnType = '\Cone\Billingo\Model\DocumentExportStatus'; + $request = $this->pollRequest($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 'poll' + * + * @param string $id The ID from create document export endpoint. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['poll'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function pollRequest($id, string $contentType = self::contentTypes['poll'][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 poll' + ); + } + + + $resourcePath = '/document-export/{id}/poll'; + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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/src/Api/OrganizationApi.php b/src/Api/OrganizationApi.php new file mode 100644 index 0000000..b604d01 --- /dev/null +++ b/src/Api/OrganizationApi.php @@ -0,0 +1,646 @@ + [ + '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, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $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 getOrganizationData + * + * Retrieve a organization data. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationData'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\OrganizationData|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function getOrganizationData(string $contentType = self::contentTypes['getOrganizationData'][0]) + { + list($response) = $this->getOrganizationDataWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getOrganizationDataWithHttpInfo + * + * Retrieve a organization data. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationData'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\OrganizationData|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getOrganizationDataWithHttpInfo(string $contentType = self::contentTypes['getOrganizationData'][0]) + { + $request = $this->getOrganizationDataRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\OrganizationData' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\OrganizationData' !== '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, '\Cone\Billingo\Model\OrganizationData', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\OrganizationData'; + 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(), + '\Cone\Billingo\Model\OrganizationData', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getOrganizationDataAsync + * + * Retrieve a organization data. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationData'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrganizationDataAsync(string $contentType = self::contentTypes['getOrganizationData'][0]) + { + return $this->getOrganizationDataAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getOrganizationDataAsyncWithHttpInfo + * + * Retrieve a organization data. + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationData'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getOrganizationDataAsyncWithHttpInfo(string $contentType = self::contentTypes['getOrganizationData'][0]) + { + $returnType = '\Cone\Billingo\Model\OrganizationData'; + $request = $this->getOrganizationDataRequest($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 'getOrganizationData' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrganizationData'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getOrganizationDataRequest(string $contentType = self::contentTypes['getOrganizationData'][0]) + { + + + $resourcePath = '/organization'; + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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/src/Api/PartnerApi.php b/src/Api/PartnerApi.php new file mode 100644 index 0000000..0ad3456 --- /dev/null +++ b/src/Api/PartnerApi.php @@ -0,0 +1,2723 @@ + [ + 'application/json', + ], + 'deletePartner' => [ + 'application/json', + ], + 'getPartner' => [ + 'application/json', + ], + 'listPartner' => [ + 'application/json', + ], + 'updatePartner' => [ + '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, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $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 createPartner + * + * Create a partner + * + * @param \Cone\Billingo\Model\Partner $partner Partner object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPartner'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Partner|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function createPartner($partner, string $contentType = self::contentTypes['createPartner'][0]) + { + list($response) = $this->createPartnerWithHttpInfo($partner, $contentType); + return $response; + } + + /** + * Operation createPartnerWithHttpInfo + * + * Create a partner + * + * @param \Cone\Billingo\Model\Partner $partner Partner object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPartner'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Partner|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createPartnerWithHttpInfo($partner, string $contentType = self::contentTypes['createPartner'][0]) + { + $request = $this->createPartnerRequest($partner, $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(); + + 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() + ); + } + + switch($statusCode) { + case 201: + if ('\Cone\Billingo\Model\Partner' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Partner' !== '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, '\Cone\Billingo\Model\Partner', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Partner'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\Partner', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createPartnerAsync + * + * Create a partner + * + * @param \Cone\Billingo\Model\Partner $partner Partner object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPartnerAsync($partner, string $contentType = self::contentTypes['createPartner'][0]) + { + return $this->createPartnerAsyncWithHttpInfo($partner, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createPartnerAsyncWithHttpInfo + * + * Create a partner + * + * @param \Cone\Billingo\Model\Partner $partner Partner object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createPartnerAsyncWithHttpInfo($partner, string $contentType = self::contentTypes['createPartner'][0]) + { + $returnType = '\Cone\Billingo\Model\Partner'; + $request = $this->createPartnerRequest($partner, $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 'createPartner' + * + * @param \Cone\Billingo\Model\Partner $partner Partner object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createPartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createPartnerRequest($partner, string $contentType = self::contentTypes['createPartner'][0]) + { + + // verify the required parameter 'partner' is set + if ($partner === null || (is_array($partner) && count($partner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $partner when calling createPartner' + ); + } + + + $resourcePath = '/partners'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($partner)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($partner)); + } else { + $httpBody = $partner; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 deletePartner + * + * Delete a partner + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePartner'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function deletePartner($id, string $contentType = self::contentTypes['deletePartner'][0]) + { + $this->deletePartnerWithHttpInfo($id, $contentType); + } + + /** + * Operation deletePartnerWithHttpInfo + * + * Delete a partner + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePartner'] to see the possible values for this operation + * + * @throws \Cone\Billingo\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 deletePartnerWithHttpInfo($id, string $contentType = self::contentTypes['deletePartner'][0]) + { + $request = $this->deletePartnerRequest($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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deletePartnerAsync + * + * Delete a partner + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePartnerAsync($id, string $contentType = self::contentTypes['deletePartner'][0]) + { + return $this->deletePartnerAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deletePartnerAsyncWithHttpInfo + * + * Delete a partner + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deletePartnerAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deletePartner'][0]) + { + $returnType = ''; + $request = $this->deletePartnerRequest($id, $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 'deletePartner' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deletePartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deletePartnerRequest($id, string $contentType = self::contentTypes['deletePartner'][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 deletePartner' + ); + } + + + $resourcePath = '/partners/{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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getPartner + * + * Retrieve a partner + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPartner'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Partner|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function getPartner($id, string $contentType = self::contentTypes['getPartner'][0]) + { + list($response) = $this->getPartnerWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getPartnerWithHttpInfo + * + * Retrieve a partner + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPartner'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Partner|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getPartnerWithHttpInfo($id, string $contentType = self::contentTypes['getPartner'][0]) + { + $request = $this->getPartnerRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Partner' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Partner' !== '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, '\Cone\Billingo\Model\Partner', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Partner'; + 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(), + '\Cone\Billingo\Model\Partner', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getPartnerAsync + * + * Retrieve a partner + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPartnerAsync($id, string $contentType = self::contentTypes['getPartner'][0]) + { + return $this->getPartnerAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getPartnerAsyncWithHttpInfo + * + * Retrieve a partner + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getPartnerAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getPartner'][0]) + { + $returnType = '\Cone\Billingo\Model\Partner'; + $request = $this->getPartnerRequest($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 'getPartner' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getPartnerRequest($id, string $contentType = self::contentTypes['getPartner'][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 getPartner' + ); + } + + + $resourcePath = '/partners/{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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 listPartner + * + * List all partners + * + * @param int $page page (optional) + * @param int $perPage perPage (optional, default to 25) + * @param string $query query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPartner'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\PartnerList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function listPartner($page = null, $perPage = 25, $query = null, string $contentType = self::contentTypes['listPartner'][0]) + { + list($response) = $this->listPartnerWithHttpInfo($page, $perPage, $query, $contentType); + return $response; + } + + /** + * Operation listPartnerWithHttpInfo + * + * List all partners + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPartner'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\PartnerList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function listPartnerWithHttpInfo($page = null, $perPage = 25, $query = null, string $contentType = self::contentTypes['listPartner'][0]) + { + $request = $this->listPartnerRequest($page, $perPage, $query, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\PartnerList' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\PartnerList' !== '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, '\Cone\Billingo\Model\PartnerList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\PartnerList'; + 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(), + '\Cone\Billingo\Model\PartnerList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listPartnerAsync + * + * List all partners + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPartnerAsync($page = null, $perPage = 25, $query = null, string $contentType = self::contentTypes['listPartner'][0]) + { + return $this->listPartnerAsyncWithHttpInfo($page, $perPage, $query, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listPartnerAsyncWithHttpInfo + * + * List all partners + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listPartnerAsyncWithHttpInfo($page = null, $perPage = 25, $query = null, string $contentType = self::contentTypes['listPartner'][0]) + { + $returnType = '\Cone\Billingo\Model\PartnerList'; + $request = $this->listPartnerRequest($page, $perPage, $query, $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 'listPartner' + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listPartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listPartnerRequest($page = null, $perPage = 25, $query = null, string $contentType = self::contentTypes['listPartner'][0]) + { + + + if ($perPage !== null && $perPage > 100) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling PartnerApi.listPartner, must be smaller than or equal to 100.'); + } + if ($perPage !== null && $perPage < 1) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling PartnerApi.listPartner, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/partners'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // 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( + $perPage, + 'per_page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $query, + 'query', // param base name + 'string', // 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 updatePartner + * + * Update a partner + * + * @param int $id id (required) + * @param \Cone\Billingo\Model\Partner $partner Partner object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePartner'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Partner|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function updatePartner($id, $partner, string $contentType = self::contentTypes['updatePartner'][0]) + { + list($response) = $this->updatePartnerWithHttpInfo($id, $partner, $contentType); + return $response; + } + + /** + * Operation updatePartnerWithHttpInfo + * + * Update a partner + * + * @param int $id (required) + * @param \Cone\Billingo\Model\Partner $partner Partner object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePartner'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Partner|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function updatePartnerWithHttpInfo($id, $partner, string $contentType = self::contentTypes['updatePartner'][0]) + { + $request = $this->updatePartnerRequest($id, $partner, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Partner' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Partner' !== '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, '\Cone\Billingo\Model\Partner', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Partner'; + 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(), + '\Cone\Billingo\Model\Partner', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updatePartnerAsync + * + * Update a partner + * + * @param int $id (required) + * @param \Cone\Billingo\Model\Partner $partner Partner object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePartnerAsync($id, $partner, string $contentType = self::contentTypes['updatePartner'][0]) + { + return $this->updatePartnerAsyncWithHttpInfo($id, $partner, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updatePartnerAsyncWithHttpInfo + * + * Update a partner + * + * @param int $id (required) + * @param \Cone\Billingo\Model\Partner $partner Partner object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updatePartnerAsyncWithHttpInfo($id, $partner, string $contentType = self::contentTypes['updatePartner'][0]) + { + $returnType = '\Cone\Billingo\Model\Partner'; + $request = $this->updatePartnerRequest($id, $partner, $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 'updatePartner' + * + * @param int $id (required) + * @param \Cone\Billingo\Model\Partner $partner Partner object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updatePartner'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updatePartnerRequest($id, $partner, string $contentType = self::contentTypes['updatePartner'][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 updatePartner' + ); + } + + // verify the required parameter 'partner' is set + if ($partner === null || (is_array($partner) && count($partner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $partner when calling updatePartner' + ); + } + + + $resourcePath = '/partners/{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 (isset($partner)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($partner)); + } else { + $httpBody = $partner; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'PUT', + $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/src/Api/ProductApi.php b/src/Api/ProductApi.php new file mode 100644 index 0000000..e8a16d6 --- /dev/null +++ b/src/Api/ProductApi.php @@ -0,0 +1,2723 @@ + [ + 'application/json', + ], + 'deleteProduct' => [ + 'application/json', + ], + 'getProduct' => [ + 'application/json', + ], + 'listProduct' => [ + 'application/json', + ], + 'updateProduct' => [ + '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, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $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 createProduct + * + * Create a product + * + * @param \Cone\Billingo\Model\Product $product Product object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProduct'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Product|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function createProduct($product, string $contentType = self::contentTypes['createProduct'][0]) + { + list($response) = $this->createProductWithHttpInfo($product, $contentType); + return $response; + } + + /** + * Operation createProductWithHttpInfo + * + * Create a product + * + * @param \Cone\Billingo\Model\Product $product Product object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProduct'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Product|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createProductWithHttpInfo($product, string $contentType = self::contentTypes['createProduct'][0]) + { + $request = $this->createProductRequest($product, $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(); + + 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() + ); + } + + switch($statusCode) { + case 201: + if ('\Cone\Billingo\Model\Product' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Product' !== '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, '\Cone\Billingo\Model\Product', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Product'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\Product', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createProductAsync + * + * Create a product + * + * @param \Cone\Billingo\Model\Product $product Product object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createProductAsync($product, string $contentType = self::contentTypes['createProduct'][0]) + { + return $this->createProductAsyncWithHttpInfo($product, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createProductAsyncWithHttpInfo + * + * Create a product + * + * @param \Cone\Billingo\Model\Product $product Product object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createProductAsyncWithHttpInfo($product, string $contentType = self::contentTypes['createProduct'][0]) + { + $returnType = '\Cone\Billingo\Model\Product'; + $request = $this->createProductRequest($product, $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 'createProduct' + * + * @param \Cone\Billingo\Model\Product $product Product object that you would like to store. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createProductRequest($product, string $contentType = self::contentTypes['createProduct'][0]) + { + + // verify the required parameter 'product' is set + if ($product === null || (is_array($product) && count($product) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $product when calling createProduct' + ); + } + + + $resourcePath = '/products'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($product)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($product)); + } else { + $httpBody = $product; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 deleteProduct + * + * Delete a product + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProduct'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function deleteProduct($id, string $contentType = self::contentTypes['deleteProduct'][0]) + { + $this->deleteProductWithHttpInfo($id, $contentType); + } + + /** + * Operation deleteProductWithHttpInfo + * + * Delete a product + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProduct'] to see the possible values for this operation + * + * @throws \Cone\Billingo\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 deleteProductWithHttpInfo($id, string $contentType = self::contentTypes['deleteProduct'][0]) + { + $request = $this->deleteProductRequest($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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteProductAsync + * + * Delete a product + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteProductAsync($id, string $contentType = self::contentTypes['deleteProduct'][0]) + { + return $this->deleteProductAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteProductAsyncWithHttpInfo + * + * Delete a product + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteProductAsyncWithHttpInfo($id, string $contentType = self::contentTypes['deleteProduct'][0]) + { + $returnType = ''; + $request = $this->deleteProductRequest($id, $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 'deleteProduct' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteProductRequest($id, string $contentType = self::contentTypes['deleteProduct'][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 deleteProduct' + ); + } + + + $resourcePath = '/products/{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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getProduct + * + * Retrieve a product + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProduct'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Product|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function getProduct($id, string $contentType = self::contentTypes['getProduct'][0]) + { + list($response) = $this->getProductWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getProductWithHttpInfo + * + * Retrieve a product + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProduct'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Product|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getProductWithHttpInfo($id, string $contentType = self::contentTypes['getProduct'][0]) + { + $request = $this->getProductRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Product' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Product' !== '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, '\Cone\Billingo\Model\Product', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Product'; + 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(), + '\Cone\Billingo\Model\Product', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getProductAsync + * + * Retrieve a product + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProductAsync($id, string $contentType = self::contentTypes['getProduct'][0]) + { + return $this->getProductAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getProductAsyncWithHttpInfo + * + * Retrieve a product + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getProductAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getProduct'][0]) + { + $returnType = '\Cone\Billingo\Model\Product'; + $request = $this->getProductRequest($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 'getProduct' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getProductRequest($id, string $contentType = self::contentTypes['getProduct'][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 getProduct' + ); + } + + + $resourcePath = '/products/{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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 listProduct + * + * List all product + * + * @param int $page page (optional) + * @param int $perPage perPage (optional, default to 25) + * @param string $query query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProduct'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\ProductList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function listProduct($page = null, $perPage = 25, $query = null, string $contentType = self::contentTypes['listProduct'][0]) + { + list($response) = $this->listProductWithHttpInfo($page, $perPage, $query, $contentType); + return $response; + } + + /** + * Operation listProductWithHttpInfo + * + * List all product + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProduct'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\ProductList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function listProductWithHttpInfo($page = null, $perPage = 25, $query = null, string $contentType = self::contentTypes['listProduct'][0]) + { + $request = $this->listProductRequest($page, $perPage, $query, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\ProductList' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ProductList' !== '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, '\Cone\Billingo\Model\ProductList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\ProductList'; + 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(), + '\Cone\Billingo\Model\ProductList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listProductAsync + * + * List all product + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listProductAsync($page = null, $perPage = 25, $query = null, string $contentType = self::contentTypes['listProduct'][0]) + { + return $this->listProductAsyncWithHttpInfo($page, $perPage, $query, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listProductAsyncWithHttpInfo + * + * List all product + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listProductAsyncWithHttpInfo($page = null, $perPage = 25, $query = null, string $contentType = self::contentTypes['listProduct'][0]) + { + $returnType = '\Cone\Billingo\Model\ProductList'; + $request = $this->listProductRequest($page, $perPage, $query, $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 'listProduct' + * + * @param int $page (optional) + * @param int $perPage (optional, default to 25) + * @param string $query (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listProductRequest($page = null, $perPage = 25, $query = null, string $contentType = self::contentTypes['listProduct'][0]) + { + + + if ($perPage !== null && $perPage > 100) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling ProductApi.listProduct, must be smaller than or equal to 100.'); + } + if ($perPage !== null && $perPage < 1) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling ProductApi.listProduct, must be bigger than or equal to 1.'); + } + + + + $resourcePath = '/products'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // 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( + $perPage, + 'per_page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $query, + 'query', // param base name + 'string', // 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 updateProduct + * + * Update a product + * + * @param int $id id (required) + * @param \Cone\Billingo\Model\Product $product Product object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProduct'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Product|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function updateProduct($id, $product, string $contentType = self::contentTypes['updateProduct'][0]) + { + list($response) = $this->updateProductWithHttpInfo($id, $product, $contentType); + return $response; + } + + /** + * Operation updateProductWithHttpInfo + * + * Update a product + * + * @param int $id (required) + * @param \Cone\Billingo\Model\Product $product Product object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProduct'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Product|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function updateProductWithHttpInfo($id, $product, string $contentType = self::contentTypes['updateProduct'][0]) + { + $request = $this->updateProductRequest($id, $product, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Product' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Product' !== '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, '\Cone\Billingo\Model\Product', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Product'; + 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(), + '\Cone\Billingo\Model\Product', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateProductAsync + * + * Update a product + * + * @param int $id (required) + * @param \Cone\Billingo\Model\Product $product Product object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateProductAsync($id, $product, string $contentType = self::contentTypes['updateProduct'][0]) + { + return $this->updateProductAsyncWithHttpInfo($id, $product, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateProductAsyncWithHttpInfo + * + * Update a product + * + * @param int $id (required) + * @param \Cone\Billingo\Model\Product $product Product object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateProductAsyncWithHttpInfo($id, $product, string $contentType = self::contentTypes['updateProduct'][0]) + { + $returnType = '\Cone\Billingo\Model\Product'; + $request = $this->updateProductRequest($id, $product, $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 'updateProduct' + * + * @param int $id (required) + * @param \Cone\Billingo\Model\Product $product Product object that you would like to update. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateProduct'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateProductRequest($id, $product, string $contentType = self::contentTypes['updateProduct'][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 updateProduct' + ); + } + + // verify the required parameter 'product' is set + if ($product === null || (is_array($product) && count($product) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $product when calling updateProduct' + ); + } + + + $resourcePath = '/products/{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 (isset($product)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($product)); + } else { + $httpBody = $product; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'PUT', + $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/src/Api/SpendingApi.php b/src/Api/SpendingApi.php new file mode 100644 index 0000000..f0f2cab --- /dev/null +++ b/src/Api/SpendingApi.php @@ -0,0 +1,2831 @@ + [ + 'application/json', + ], + 'spendingList' => [ + 'application/json', + ], + 'spendingSave' => [ + 'application/json', + ], + 'spendingShow' => [ + 'application/json', + ], + 'spendingUpdate' => [ + '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, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $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 spendingDelete + * + * Deletes a spending. + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingDelete'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function spendingDelete($id, string $contentType = self::contentTypes['spendingDelete'][0]) + { + $this->spendingDeleteWithHttpInfo($id, $contentType); + } + + /** + * Operation spendingDeleteWithHttpInfo + * + * Deletes a spending. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingDelete'] to see the possible values for this operation + * + * @throws \Cone\Billingo\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 spendingDeleteWithHttpInfo($id, string $contentType = self::contentTypes['spendingDelete'][0]) + { + $request = $this->spendingDeleteRequest($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(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation spendingDeleteAsync + * + * Deletes a spending. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function spendingDeleteAsync($id, string $contentType = self::contentTypes['spendingDelete'][0]) + { + return $this->spendingDeleteAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation spendingDeleteAsyncWithHttpInfo + * + * Deletes a spending. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function spendingDeleteAsyncWithHttpInfo($id, string $contentType = self::contentTypes['spendingDelete'][0]) + { + $returnType = ''; + $request = $this->spendingDeleteRequest($id, $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 'spendingDelete' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function spendingDeleteRequest($id, string $contentType = self::contentTypes['spendingDelete'][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 spendingDelete' + ); + } + + + $resourcePath = '/spendings/{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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation spendingList + * + * Lists all spending + * + * @param string $q q (optional, default to '') + * @param int $page page (optional, default to 1) + * @param int $perPage perPage (optional, default to 25) + * @param DateType $spendingDate spendingDate (optional) + * @param string $startDate startDate (optional) + * @param string $endDate endDate (optional) + * @param PaymentStatusSpending $paymentStatus paymentStatus (optional) + * @param Source $spendingType spendingType (optional) + * @param Category $categories categories (optional) + * @param Currency $currencies currencies (optional) + * @param PaymentMethod $paymentMethods paymentMethods (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingList'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\SpendingList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function spendingList($q = '', $page = 1, $perPage = 25, $spendingDate = null, $startDate = null, $endDate = null, $paymentStatus = null, $spendingType = null, $categories = null, $currencies = null, $paymentMethods = null, string $contentType = self::contentTypes['spendingList'][0]) + { + list($response) = $this->spendingListWithHttpInfo($q, $page, $perPage, $spendingDate, $startDate, $endDate, $paymentStatus, $spendingType, $categories, $currencies, $paymentMethods, $contentType); + return $response; + } + + /** + * Operation spendingListWithHttpInfo + * + * Lists all spending + * + * @param string $q (optional, default to '') + * @param int $page (optional, default to 1) + * @param int $perPage (optional, default to 25) + * @param DateType $spendingDate (optional) + * @param string $startDate (optional) + * @param string $endDate (optional) + * @param PaymentStatusSpending $paymentStatus (optional) + * @param Source $spendingType (optional) + * @param Category $categories (optional) + * @param Currency $currencies (optional) + * @param PaymentMethod $paymentMethods (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingList'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\SpendingList|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function spendingListWithHttpInfo($q = '', $page = 1, $perPage = 25, $spendingDate = null, $startDate = null, $endDate = null, $paymentStatus = null, $spendingType = null, $categories = null, $currencies = null, $paymentMethods = null, string $contentType = self::contentTypes['spendingList'][0]) + { + $request = $this->spendingListRequest($q, $page, $perPage, $spendingDate, $startDate, $endDate, $paymentStatus, $spendingType, $categories, $currencies, $paymentMethods, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\SpendingList' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SpendingList' !== '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, '\Cone\Billingo\Model\SpendingList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\SpendingList'; + 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(), + '\Cone\Billingo\Model\SpendingList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation spendingListAsync + * + * Lists all spending + * + * @param string $q (optional, default to '') + * @param int $page (optional, default to 1) + * @param int $perPage (optional, default to 25) + * @param DateType $spendingDate (optional) + * @param string $startDate (optional) + * @param string $endDate (optional) + * @param PaymentStatusSpending $paymentStatus (optional) + * @param Source $spendingType (optional) + * @param Category $categories (optional) + * @param Currency $currencies (optional) + * @param PaymentMethod $paymentMethods (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function spendingListAsync($q = '', $page = 1, $perPage = 25, $spendingDate = null, $startDate = null, $endDate = null, $paymentStatus = null, $spendingType = null, $categories = null, $currencies = null, $paymentMethods = null, string $contentType = self::contentTypes['spendingList'][0]) + { + return $this->spendingListAsyncWithHttpInfo($q, $page, $perPage, $spendingDate, $startDate, $endDate, $paymentStatus, $spendingType, $categories, $currencies, $paymentMethods, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation spendingListAsyncWithHttpInfo + * + * Lists all spending + * + * @param string $q (optional, default to '') + * @param int $page (optional, default to 1) + * @param int $perPage (optional, default to 25) + * @param DateType $spendingDate (optional) + * @param string $startDate (optional) + * @param string $endDate (optional) + * @param PaymentStatusSpending $paymentStatus (optional) + * @param Source $spendingType (optional) + * @param Category $categories (optional) + * @param Currency $currencies (optional) + * @param PaymentMethod $paymentMethods (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function spendingListAsyncWithHttpInfo($q = '', $page = 1, $perPage = 25, $spendingDate = null, $startDate = null, $endDate = null, $paymentStatus = null, $spendingType = null, $categories = null, $currencies = null, $paymentMethods = null, string $contentType = self::contentTypes['spendingList'][0]) + { + $returnType = '\Cone\Billingo\Model\SpendingList'; + $request = $this->spendingListRequest($q, $page, $perPage, $spendingDate, $startDate, $endDate, $paymentStatus, $spendingType, $categories, $currencies, $paymentMethods, $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 'spendingList' + * + * @param string $q (optional, default to '') + * @param int $page (optional, default to 1) + * @param int $perPage (optional, default to 25) + * @param DateType $spendingDate (optional) + * @param string $startDate (optional) + * @param string $endDate (optional) + * @param PaymentStatusSpending $paymentStatus (optional) + * @param Source $spendingType (optional) + * @param Category $categories (optional) + * @param Currency $currencies (optional) + * @param PaymentMethod $paymentMethods (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function spendingListRequest($q = '', $page = 1, $perPage = 25, $spendingDate = null, $startDate = null, $endDate = null, $paymentStatus = null, $spendingType = null, $categories = null, $currencies = null, $paymentMethods = null, string $contentType = self::contentTypes['spendingList'][0]) + { + + + + if ($perPage !== null && $perPage > 100) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling SpendingApi.spendingList, must be smaller than or equal to 100.'); + } + if ($perPage !== null && $perPage < 1) { + throw new \InvalidArgumentException('invalid value for "$perPage" when calling SpendingApi.spendingList, must be bigger than or equal to 1.'); + } + + + + + + + + + + + $resourcePath = '/spendings'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $q, + 'q', // 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( + $perPage, + 'per_page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $spendingDate, + 'spending_date', // param base name + 'DateType', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $startDate, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $endDate, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $paymentStatus, + 'payment_status', // param base name + 'PaymentStatusSpending', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $spendingType, + 'spending_type', // param base name + 'Source', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $categories, + 'categories', // param base name + 'Category', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $currencies, + 'currencies', // param base name + 'Currency', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $paymentMethods, + 'payment_methods', // param base name + 'PaymentMethod', // 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 spendingSave + * + * Creates a new spending. + * + * @param \Cone\Billingo\Model\SpendingSave $spendingSave spendingSave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingSave'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Spending|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function spendingSave($spendingSave = null, string $contentType = self::contentTypes['spendingSave'][0]) + { + list($response) = $this->spendingSaveWithHttpInfo($spendingSave, $contentType); + return $response; + } + + /** + * Operation spendingSaveWithHttpInfo + * + * Creates a new spending. + * + * @param \Cone\Billingo\Model\SpendingSave $spendingSave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingSave'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Spending|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function spendingSaveWithHttpInfo($spendingSave = null, string $contentType = self::contentTypes['spendingSave'][0]) + { + $request = $this->spendingSaveRequest($spendingSave, $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(); + + 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() + ); + } + + switch($statusCode) { + case 201: + if ('\Cone\Billingo\Model\Spending' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Spending' !== '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, '\Cone\Billingo\Model\Spending', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Spending'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\Spending', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation spendingSaveAsync + * + * Creates a new spending. + * + * @param \Cone\Billingo\Model\SpendingSave $spendingSave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingSave'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function spendingSaveAsync($spendingSave = null, string $contentType = self::contentTypes['spendingSave'][0]) + { + return $this->spendingSaveAsyncWithHttpInfo($spendingSave, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation spendingSaveAsyncWithHttpInfo + * + * Creates a new spending. + * + * @param \Cone\Billingo\Model\SpendingSave $spendingSave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingSave'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function spendingSaveAsyncWithHttpInfo($spendingSave = null, string $contentType = self::contentTypes['spendingSave'][0]) + { + $returnType = '\Cone\Billingo\Model\Spending'; + $request = $this->spendingSaveRequest($spendingSave, $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 'spendingSave' + * + * @param \Cone\Billingo\Model\SpendingSave $spendingSave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingSave'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function spendingSaveRequest($spendingSave = null, string $contentType = self::contentTypes['spendingSave'][0]) + { + + + + $resourcePath = '/spendings'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($spendingSave)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($spendingSave)); + } else { + $httpBody = $spendingSave; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 spendingShow + * + * Retrieves one specific spending. + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingShow'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Spending|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function spendingShow($id, string $contentType = self::contentTypes['spendingShow'][0]) + { + list($response) = $this->spendingShowWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation spendingShowWithHttpInfo + * + * Retrieves one specific spending. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingShow'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Spending|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function spendingShowWithHttpInfo($id, string $contentType = self::contentTypes['spendingShow'][0]) + { + $request = $this->spendingShowRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Spending' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Spending' !== '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, '\Cone\Billingo\Model\Spending', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Spending'; + 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(), + '\Cone\Billingo\Model\Spending', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation spendingShowAsync + * + * Retrieves one specific spending. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingShow'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function spendingShowAsync($id, string $contentType = self::contentTypes['spendingShow'][0]) + { + return $this->spendingShowAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation spendingShowAsyncWithHttpInfo + * + * Retrieves one specific spending. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingShow'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function spendingShowAsyncWithHttpInfo($id, string $contentType = self::contentTypes['spendingShow'][0]) + { + $returnType = '\Cone\Billingo\Model\Spending'; + $request = $this->spendingShowRequest($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 'spendingShow' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingShow'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function spendingShowRequest($id, string $contentType = self::contentTypes['spendingShow'][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 spendingShow' + ); + } + + + $resourcePath = '/spendings/{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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 spendingUpdate + * + * Updates a spending item. + * + * @param int $id id (required) + * @param \Cone\Billingo\Model\SpendingSave $spendingSave spendingSave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingUpdate'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Spending|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function spendingUpdate($id, $spendingSave = null, string $contentType = self::contentTypes['spendingUpdate'][0]) + { + list($response) = $this->spendingUpdateWithHttpInfo($id, $spendingSave, $contentType); + return $response; + } + + /** + * Operation spendingUpdateWithHttpInfo + * + * Updates a spending item. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\SpendingSave $spendingSave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingUpdate'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Spending|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function spendingUpdateWithHttpInfo($id, $spendingSave = null, string $contentType = self::contentTypes['spendingUpdate'][0]) + { + $request = $this->spendingUpdateRequest($id, $spendingSave, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Spending' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Spending' !== '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, '\Cone\Billingo\Model\Spending', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Spending'; + 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(), + '\Cone\Billingo\Model\Spending', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation spendingUpdateAsync + * + * Updates a spending item. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\SpendingSave $spendingSave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function spendingUpdateAsync($id, $spendingSave = null, string $contentType = self::contentTypes['spendingUpdate'][0]) + { + return $this->spendingUpdateAsyncWithHttpInfo($id, $spendingSave, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation spendingUpdateAsyncWithHttpInfo + * + * Updates a spending item. + * + * @param int $id (required) + * @param \Cone\Billingo\Model\SpendingSave $spendingSave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function spendingUpdateAsyncWithHttpInfo($id, $spendingSave = null, string $contentType = self::contentTypes['spendingUpdate'][0]) + { + $returnType = '\Cone\Billingo\Model\Spending'; + $request = $this->spendingUpdateRequest($id, $spendingSave, $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 'spendingUpdate' + * + * @param int $id (required) + * @param \Cone\Billingo\Model\SpendingSave $spendingSave (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['spendingUpdate'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function spendingUpdateRequest($id, $spendingSave = null, string $contentType = self::contentTypes['spendingUpdate'][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 spendingUpdate' + ); + } + + + + $resourcePath = '/spendings/{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 (isset($spendingSave)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($spendingSave)); + } else { + $httpBody = $spendingSave; + } + } 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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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( + 'PUT', + $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/src/Api/UtilApi.php b/src/Api/UtilApi.php new file mode 100644 index 0000000..5a68c12 --- /dev/null +++ b/src/Api/UtilApi.php @@ -0,0 +1,1734 @@ + [ + 'application/json', + ], + 'getId' => [ + 'application/json', + ], + 'getServerTime' => [ + '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, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $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 checkTaxNumber + * + * Check tax number. + * + * @param string $taxNumber taxNumber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkTaxNumber'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\TaxNumber|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function checkTaxNumber($taxNumber, string $contentType = self::contentTypes['checkTaxNumber'][0]) + { + list($response) = $this->checkTaxNumberWithHttpInfo($taxNumber, $contentType); + return $response; + } + + /** + * Operation checkTaxNumberWithHttpInfo + * + * Check tax number. + * + * @param string $taxNumber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkTaxNumber'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\TaxNumber|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function checkTaxNumberWithHttpInfo($taxNumber, string $contentType = self::contentTypes['checkTaxNumber'][0]) + { + $request = $this->checkTaxNumberRequest($taxNumber, $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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\TaxNumber' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TaxNumber' !== '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, '\Cone\Billingo\Model\TaxNumber', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\TaxNumber'; + 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(), + '\Cone\Billingo\Model\TaxNumber', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation checkTaxNumberAsync + * + * Check tax number. + * + * @param string $taxNumber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkTaxNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function checkTaxNumberAsync($taxNumber, string $contentType = self::contentTypes['checkTaxNumber'][0]) + { + return $this->checkTaxNumberAsyncWithHttpInfo($taxNumber, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation checkTaxNumberAsyncWithHttpInfo + * + * Check tax number. + * + * @param string $taxNumber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkTaxNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function checkTaxNumberAsyncWithHttpInfo($taxNumber, string $contentType = self::contentTypes['checkTaxNumber'][0]) + { + $returnType = '\Cone\Billingo\Model\TaxNumber'; + $request = $this->checkTaxNumberRequest($taxNumber, $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 'checkTaxNumber' + * + * @param string $taxNumber (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['checkTaxNumber'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function checkTaxNumberRequest($taxNumber, string $contentType = self::contentTypes['checkTaxNumber'][0]) + { + + // verify the required parameter 'taxNumber' is set + if ($taxNumber === null || (is_array($taxNumber) && count($taxNumber) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $taxNumber when calling checkTaxNumber' + ); + } + if (!preg_match("/^([0-9]{8})-([12345])-([0-9]{2})$/", $taxNumber)) { + throw new \InvalidArgumentException("invalid value for \"taxNumber\" when calling UtilApi.checkTaxNumber, must conform to the pattern /^([0-9]{8})-([12345])-([0-9]{2})$/."); + } + + + $resourcePath = '/utils/check-tax-number/{tax_number}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($taxNumber !== null) { + $resourcePath = str_replace( + '{' . 'tax_number' . '}', + ObjectSerializer::toPathValue($taxNumber), + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 getId + * + * Convert legacy ID to v3 ID. + * + * @param int $id id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getId'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\Id|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse + */ + public function getId($id, string $contentType = self::contentTypes['getId'][0]) + { + list($response) = $this->getIdWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation getIdWithHttpInfo + * + * Convert legacy ID to v3 ID. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getId'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\Id|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse|\Cone\Billingo\Model\ClientErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getIdWithHttpInfo($id, string $contentType = self::contentTypes['getId'][0]) + { + $request = $this->getIdRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\Id' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\Id' !== '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, '\Cone\Billingo\Model\Id', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\Id'; + 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(), + '\Cone\Billingo\Model\Id', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getIdAsync + * + * Convert legacy ID to v3 ID. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIdAsync($id, string $contentType = self::contentTypes['getId'][0]) + { + return $this->getIdAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getIdAsyncWithHttpInfo + * + * Convert legacy ID to v3 ID. + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getIdAsyncWithHttpInfo($id, string $contentType = self::contentTypes['getId'][0]) + { + $returnType = '\Cone\Billingo\Model\Id'; + $request = $this->getIdRequest($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 'getId' + * + * @param int $id (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getId'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getIdRequest($id, string $contentType = self::contentTypes['getId'][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 getId' + ); + } + + + $resourcePath = '/utils/convert-legacy-id/{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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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 getServerTime + * + * Get the server time + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getServerTime'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Cone\Billingo\Model\ServerTime|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse + */ + public function getServerTime(string $contentType = self::contentTypes['getServerTime'][0]) + { + list($response) = $this->getServerTimeWithHttpInfo($contentType); + return $response; + } + + /** + * Operation getServerTimeWithHttpInfo + * + * Get the server time + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getServerTime'] to see the possible values for this operation + * + * @throws \Cone\Billingo\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Cone\Billingo\Model\ServerTime|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\ClientErrorResponse|\Cone\Billingo\Model\SubscriptionErrorResponse|\Cone\Billingo\Model\ValidationErrorResponse|\Cone\Billingo\Model\TooManyRequestsResponse|\Cone\Billingo\Model\ServerErrorResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getServerTimeWithHttpInfo(string $contentType = self::contentTypes['getServerTime'][0]) + { + $request = $this->getServerTimeRequest($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(); + + 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() + ); + } + + switch($statusCode) { + case 200: + if ('\Cone\Billingo\Model\ServerTime' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerTime' !== '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, '\Cone\Billingo\Model\ServerTime', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Cone\Billingo\Model\ClientErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ClientErrorResponse' !== '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, '\Cone\Billingo\Model\ClientErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\SubscriptionErrorResponse' !== '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, '\Cone\Billingo\Model\SubscriptionErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Cone\Billingo\Model\ValidationErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ValidationErrorResponse' !== '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, '\Cone\Billingo\Model\ValidationErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\Cone\Billingo\Model\TooManyRequestsResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\TooManyRequestsResponse' !== '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, '\Cone\Billingo\Model\TooManyRequestsResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Cone\Billingo\Model\ServerErrorResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Cone\Billingo\Model\ServerErrorResponse' !== '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, '\Cone\Billingo\Model\ServerErrorResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Cone\Billingo\Model\ServerTime'; + 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(), + '\Cone\Billingo\Model\ServerTime', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ClientErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\SubscriptionErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ValidationErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\TooManyRequestsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Cone\Billingo\Model\ServerErrorResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getServerTimeAsync + * + * Get the server time + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getServerTime'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getServerTimeAsync(string $contentType = self::contentTypes['getServerTime'][0]) + { + return $this->getServerTimeAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getServerTimeAsyncWithHttpInfo + * + * Get the server time + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getServerTime'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getServerTimeAsyncWithHttpInfo(string $contentType = self::contentTypes['getServerTime'][0]) + { + $returnType = '\Cone\Billingo\Model\ServerTime'; + $request = $this->getServerTimeRequest($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 'getServerTime' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getServerTime'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getServerTimeRequest(string $contentType = self::contentTypes['getServerTime'][0]) + { + + + $resourcePath = '/utils/time'; + $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 API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('X-API-KEY'); + if ($apiKey !== null) { + $headers['X-API-KEY'] = $apiKey; + } + + $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/src/ApiException.php b/src/ApiException.php new file mode 100644 index 0000000..d8e813c --- /dev/null +++ b/src/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/src/Configuration.php b/src/Configuration.php new file mode 100644 index 0000000..79addd9 --- /dev/null +++ b/src/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 $booleanFormatForQueryString 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 (Cone\Billingo) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 3.0.14' . 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" => "https://api.billingo.hu/v3", + "description" => "Billingo API", + ] + ]; + } + + /** + * 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 $hostsSettings, $hostIndex, array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostsSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostsSettings)); + } + + $host = $hostsSettings[$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/src/HeaderSelector.php b/src/HeaderSelector.php new file mode 100644 index 0000000..16026f6 --- /dev/null +++ b/src/HeaderSelector.php @@ -0,0 +1,246 @@ +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 = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $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); + } + + /** + * 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/src/Model/Address.php b/src/Model/Address.php new file mode 100644 index 0000000..c982c08 --- /dev/null +++ b/src/Model/Address.php @@ -0,0 +1,524 @@ + + */ +class Address implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Address'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'countryCode' => '\Cone\Billingo\Model\Country', + 'postCode' => 'string', + 'city' => 'string', + 'address' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'countryCode' => null, + 'postCode' => null, + 'city' => null, + 'address' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'countryCode' => false, + 'postCode' => false, + 'city' => false, + 'address' => 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 = [ + 'countryCode' => 'country_code', + 'postCode' => 'post_code', + 'city' => 'city', + 'address' => 'address' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'countryCode' => 'setCountryCode', + 'postCode' => 'setPostCode', + 'city' => 'setCity', + 'address' => 'setAddress' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'countryCode' => 'getCountryCode', + 'postCode' => 'getPostCode', + 'city' => 'getCity', + 'address' => 'getAddress' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('countryCode', $data ?? [], null); + $this->setIfExists('postCode', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('address', $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 ($this->container['countryCode'] === null) { + $invalidProperties[] = "'countryCode' can't be null"; + } + if ($this->container['postCode'] === null) { + $invalidProperties[] = "'postCode' can't be null"; + } + if ($this->container['city'] === null) { + $invalidProperties[] = "'city' can't be null"; + } + if ($this->container['address'] === null) { + $invalidProperties[] = "'address' can't be null"; + } + 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 countryCode + * + * @return \Cone\Billingo\Model\Country + */ + public function getCountryCode() + { + return $this->container['countryCode']; + } + + /** + * Sets countryCode + * + * @param \Cone\Billingo\Model\Country $countryCode countryCode + * + * @return self + */ + public function setCountryCode($countryCode) + { + if (is_null($countryCode)) { + throw new \InvalidArgumentException('non-nullable countryCode cannot be null'); + } + $this->container['countryCode'] = $countryCode; + + return $this; + } + + /** + * Gets postCode + * + * @return string + */ + public function getPostCode() + { + return $this->container['postCode']; + } + + /** + * Sets postCode + * + * @param string $postCode postCode + * + * @return self + */ + public function setPostCode($postCode) + { + if (is_null($postCode)) { + throw new \InvalidArgumentException('non-nullable postCode cannot be null'); + } + $this->container['postCode'] = $postCode; + + return $this; + } + + /** + * Gets city + * + * @return string + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string $city city + * + * @return self + */ + public function setCity($city) + { + if (is_null($city)) { + throw new \InvalidArgumentException('non-nullable city cannot be null'); + } + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets address + * + * @return string + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + throw new \InvalidArgumentException('non-nullable address cannot be null'); + } + $this->container['address'] = $address; + + 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/src/Model/BankAccount.php b/src/Model/BankAccount.php new file mode 100644 index 0000000..4c8a932 --- /dev/null +++ b/src/Model/BankAccount.php @@ -0,0 +1,625 @@ + + */ +class BankAccount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BankAccount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'accountNumber' => 'string', + 'accountNumberIban' => 'string', + 'swift' => 'string', + 'currency' => '\Cone\Billingo\Model\Currency', + 'needQr' => 'bool' + ]; + + /** + * 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, + 'accountNumber' => null, + 'accountNumberIban' => null, + 'swift' => null, + 'currency' => null, + 'needQr' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'accountNumber' => false, + 'accountNumberIban' => false, + 'swift' => false, + 'currency' => false, + 'needQr' => 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', + 'name' => 'name', + 'accountNumber' => 'account_number', + 'accountNumberIban' => 'account_number_iban', + 'swift' => 'swift', + 'currency' => 'currency', + 'needQr' => 'need_qr' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'accountNumber' => 'setAccountNumber', + 'accountNumberIban' => 'setAccountNumberIban', + 'swift' => 'setSwift', + 'currency' => 'setCurrency', + 'needQr' => 'setNeedQr' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'accountNumber' => 'getAccountNumber', + 'accountNumberIban' => 'getAccountNumberIban', + 'swift' => 'getSwift', + 'currency' => 'getCurrency', + 'needQr' => 'getNeedQr' + ]; + + /** + * 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[] $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('accountNumber', $data ?? [], null); + $this->setIfExists('accountNumberIban', $data ?? [], null); + $this->setIfExists('swift', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('needQr', $data ?? [], false); + } + + /** + * 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 ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['accountNumber'] === null) { + $invalidProperties[] = "'accountNumber' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + 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 name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets accountNumber + * + * @return string + */ + public function getAccountNumber() + { + return $this->container['accountNumber']; + } + + /** + * Sets accountNumber + * + * @param string $accountNumber accountNumber + * + * @return self + */ + public function setAccountNumber($accountNumber) + { + if (is_null($accountNumber)) { + throw new \InvalidArgumentException('non-nullable accountNumber cannot be null'); + } + $this->container['accountNumber'] = $accountNumber; + + return $this; + } + + /** + * Gets accountNumberIban + * + * @return string|null + */ + public function getAccountNumberIban() + { + return $this->container['accountNumberIban']; + } + + /** + * Sets accountNumberIban + * + * @param string|null $accountNumberIban accountNumberIban + * + * @return self + */ + public function setAccountNumberIban($accountNumberIban) + { + if (is_null($accountNumberIban)) { + throw new \InvalidArgumentException('non-nullable accountNumberIban cannot be null'); + } + $this->container['accountNumberIban'] = $accountNumberIban; + + return $this; + } + + /** + * Gets swift + * + * @return string|null + */ + public function getSwift() + { + return $this->container['swift']; + } + + /** + * Sets swift + * + * @param string|null $swift swift + * + * @return self + */ + public function setSwift($swift) + { + if (is_null($swift)) { + throw new \InvalidArgumentException('non-nullable swift cannot be null'); + } + $this->container['swift'] = $swift; + + return $this; + } + + /** + * Gets currency + * + * @return \Cone\Billingo\Model\Currency + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Cone\Billingo\Model\Currency $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets needQr + * + * @return bool|null + * @deprecated + */ + public function getNeedQr() + { + return $this->container['needQr']; + } + + /** + * Sets needQr + * + * @param bool|null $needQr needQr + * + * @return self + * @deprecated + */ + public function setNeedQr($needQr) + { + if (is_null($needQr)) { + throw new \InvalidArgumentException('non-nullable needQr cannot be null'); + } + $this->container['needQr'] = $needQr; + + 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/src/Model/BankAccountList.php b/src/Model/BankAccountList.php new file mode 100644 index 0000000..902084a --- /dev/null +++ b/src/Model/BankAccountList.php @@ -0,0 +1,615 @@ + + */ +class BankAccountList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BankAccountList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Cone\Billingo\Model\BankAccount[]', + 'total' => 'int', + 'perPage' => 'int', + 'currentPage' => 'int', + 'lastPage' => 'int', + 'prevPageUrl' => 'string', + 'nextPageUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'total' => null, + 'perPage' => null, + 'currentPage' => null, + 'lastPage' => null, + 'prevPageUrl' => null, + 'nextPageUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'total' => false, + 'perPage' => false, + 'currentPage' => false, + 'lastPage' => false, + 'prevPageUrl' => false, + 'nextPageUrl' => 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 = [ + 'data' => 'data', + 'total' => 'total', + 'perPage' => 'per_page', + 'currentPage' => 'current_page', + 'lastPage' => 'last_page', + 'prevPageUrl' => 'prev_page_url', + 'nextPageUrl' => 'next_page_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'total' => 'setTotal', + 'perPage' => 'setPerPage', + 'currentPage' => 'setCurrentPage', + 'lastPage' => 'setLastPage', + 'prevPageUrl' => 'setPrevPageUrl', + 'nextPageUrl' => 'setNextPageUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'total' => 'getTotal', + 'perPage' => 'getPerPage', + 'currentPage' => 'getCurrentPage', + 'lastPage' => 'getLastPage', + 'prevPageUrl' => 'getPrevPageUrl', + 'nextPageUrl' => 'getNextPageUrl' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('perPage', $data ?? [], null); + $this->setIfExists('currentPage', $data ?? [], null); + $this->setIfExists('lastPage', $data ?? [], null); + $this->setIfExists('prevPageUrl', $data ?? [], null); + $this->setIfExists('nextPageUrl', $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 data + * + * @return \Cone\Billingo\Model\BankAccount[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Cone\Billingo\Model\BankAccount[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total 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; + } + + /** + * Gets perPage + * + * @return int|null + */ + public function getPerPage() + { + return $this->container['perPage']; + } + + /** + * Sets perPage + * + * @param int|null $perPage perPage + * + * @return self + */ + public function setPerPage($perPage) + { + if (is_null($perPage)) { + throw new \InvalidArgumentException('non-nullable perPage cannot be null'); + } + $this->container['perPage'] = $perPage; + + return $this; + } + + /** + * Gets currentPage + * + * @return int|null + */ + public function getCurrentPage() + { + return $this->container['currentPage']; + } + + /** + * Sets currentPage + * + * @param int|null $currentPage currentPage + * + * @return self + */ + public function setCurrentPage($currentPage) + { + if (is_null($currentPage)) { + throw new \InvalidArgumentException('non-nullable currentPage cannot be null'); + } + $this->container['currentPage'] = $currentPage; + + return $this; + } + + /** + * Gets lastPage + * + * @return int|null + */ + public function getLastPage() + { + return $this->container['lastPage']; + } + + /** + * Sets lastPage + * + * @param int|null $lastPage lastPage + * + * @return self + */ + public function setLastPage($lastPage) + { + if (is_null($lastPage)) { + throw new \InvalidArgumentException('non-nullable lastPage cannot be null'); + } + $this->container['lastPage'] = $lastPage; + + return $this; + } + + /** + * Gets prevPageUrl + * + * @return string|null + */ + public function getPrevPageUrl() + { + return $this->container['prevPageUrl']; + } + + /** + * Sets prevPageUrl + * + * @param string|null $prevPageUrl prevPageUrl + * + * @return self + */ + public function setPrevPageUrl($prevPageUrl) + { + if (is_null($prevPageUrl)) { + throw new \InvalidArgumentException('non-nullable prevPageUrl cannot be null'); + } + $this->container['prevPageUrl'] = $prevPageUrl; + + return $this; + } + + /** + * Gets nextPageUrl + * + * @return string|null + */ + public function getNextPageUrl() + { + return $this->container['nextPageUrl']; + } + + /** + * Sets nextPageUrl + * + * @param string|null $nextPageUrl nextPageUrl + * + * @return self + */ + public function setNextPageUrl($nextPageUrl) + { + if (is_null($nextPageUrl)) { + throw new \InvalidArgumentException('non-nullable nextPageUrl cannot be null'); + } + $this->container['nextPageUrl'] = $nextPageUrl; + + 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/src/Model/Category.php b/src/Model/Category.php new file mode 100644 index 0000000..eb0fa3d --- /dev/null +++ b/src/Model/Category.php @@ -0,0 +1,78 @@ + + */ +class ClientError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => 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 = [ + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message', $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 message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + 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/src/Model/ClientErrorResponse.php b/src/Model/ClientErrorResponse.php new file mode 100644 index 0000000..f2291db --- /dev/null +++ b/src/Model/ClientErrorResponse.php @@ -0,0 +1,410 @@ + + */ +class ClientErrorResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClientErrorResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => '\Cone\Billingo\Model\ClientError' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => 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 = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error' => 'getError' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $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 error + * + * @return \Cone\Billingo\Model\ClientError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \Cone\Billingo\Model\ClientError|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + 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/src/Model/ConversationRate.php b/src/Model/ConversationRate.php new file mode 100644 index 0000000..2b06a08 --- /dev/null +++ b/src/Model/ConversationRate.php @@ -0,0 +1,512 @@ + + */ +class ConversationRate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ConversationRate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'fromCurrency' => '\Cone\Billingo\Model\Currency', + 'toCurrency' => '\Cone\Billingo\Model\Currency', + 'conversationRate' => 'float', + 'date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'fromCurrency' => null, + 'toCurrency' => null, + 'conversationRate' => 'float', + 'date' => 'date' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'fromCurrency' => false, + 'toCurrency' => false, + 'conversationRate' => false, + 'date' => 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 = [ + 'fromCurrency' => 'from_currency', + 'toCurrency' => 'to_currency', + 'conversationRate' => 'conversation_rate', + 'date' => 'date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'fromCurrency' => 'setFromCurrency', + 'toCurrency' => 'setToCurrency', + 'conversationRate' => 'setConversationRate', + 'date' => 'setDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'fromCurrency' => 'getFromCurrency', + 'toCurrency' => 'getToCurrency', + 'conversationRate' => 'getConversationRate', + 'date' => 'getDate' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('fromCurrency', $data ?? [], null); + $this->setIfExists('toCurrency', $data ?? [], null); + $this->setIfExists('conversationRate', $data ?? [], null); + $this->setIfExists('date', $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 fromCurrency + * + * @return \Cone\Billingo\Model\Currency|null + */ + public function getFromCurrency() + { + return $this->container['fromCurrency']; + } + + /** + * Sets fromCurrency + * + * @param \Cone\Billingo\Model\Currency|null $fromCurrency fromCurrency + * + * @return self + */ + public function setFromCurrency($fromCurrency) + { + if (is_null($fromCurrency)) { + throw new \InvalidArgumentException('non-nullable fromCurrency cannot be null'); + } + $this->container['fromCurrency'] = $fromCurrency; + + return $this; + } + + /** + * Gets toCurrency + * + * @return \Cone\Billingo\Model\Currency|null + */ + public function getToCurrency() + { + return $this->container['toCurrency']; + } + + /** + * Sets toCurrency + * + * @param \Cone\Billingo\Model\Currency|null $toCurrency toCurrency + * + * @return self + */ + public function setToCurrency($toCurrency) + { + if (is_null($toCurrency)) { + throw new \InvalidArgumentException('non-nullable toCurrency cannot be null'); + } + $this->container['toCurrency'] = $toCurrency; + + return $this; + } + + /** + * Gets conversationRate + * + * @return float|null + */ + public function getConversationRate() + { + return $this->container['conversationRate']; + } + + /** + * Sets conversationRate + * + * @param float|null $conversationRate conversationRate + * + * @return self + */ + public function setConversationRate($conversationRate) + { + if (is_null($conversationRate)) { + throw new \InvalidArgumentException('non-nullable conversationRate cannot be null'); + } + $this->container['conversationRate'] = $conversationRate; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date date + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + 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/src/Model/CorrectionType.php b/src/Model/CorrectionType.php new file mode 100644 index 0000000..55f158c --- /dev/null +++ b/src/Model/CorrectionType.php @@ -0,0 +1,114 @@ + + */ +class CreateDocumentExport implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateDocumentExport'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'queryType' => '\Cone\Billingo\Model\DocumentExportQueryType', + 'startDate' => '\DateTime', + 'endDate' => '\DateTime', + 'documentBlockId' => 'int', + 'exportType' => '\Cone\Billingo\Model\DocumentExportType', + 'numberStartYear' => 'int', + 'numberStartSequence' => 'int', + 'numberEndYear' => 'int', + 'numberEndSequence' => 'int', + 'paymentMethod' => '\Cone\Billingo\Model\PaymentMethod', + 'sortBy' => '\Cone\Billingo\Model\DocumentExportSortBy', + 'otherOptions' => '\Cone\Billingo\Model\DocumentExportOtherOptions', + 'filterExtra' => '\Cone\Billingo\Model\DocumentExportFilterExtra' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'queryType' => null, + 'startDate' => 'date', + 'endDate' => 'date', + 'documentBlockId' => null, + 'exportType' => null, + 'numberStartYear' => null, + 'numberStartSequence' => null, + 'numberEndYear' => null, + 'numberEndSequence' => null, + 'paymentMethod' => null, + 'sortBy' => null, + 'otherOptions' => null, + 'filterExtra' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'queryType' => false, + 'startDate' => false, + 'endDate' => false, + 'documentBlockId' => false, + 'exportType' => false, + 'numberStartYear' => false, + 'numberStartSequence' => false, + 'numberEndYear' => false, + 'numberEndSequence' => false, + 'paymentMethod' => false, + 'sortBy' => false, + 'otherOptions' => false, + 'filterExtra' => 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 = [ + 'queryType' => 'query_type', + 'startDate' => 'start_date', + 'endDate' => 'end_date', + 'documentBlockId' => 'document_block_id', + 'exportType' => 'export_type', + 'numberStartYear' => 'number_start_year', + 'numberStartSequence' => 'number_start_sequence', + 'numberEndYear' => 'number_end_year', + 'numberEndSequence' => 'number_end_sequence', + 'paymentMethod' => 'payment_method', + 'sortBy' => 'sort_by', + 'otherOptions' => 'other_options', + 'filterExtra' => 'filter_extra' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'queryType' => 'setQueryType', + 'startDate' => 'setStartDate', + 'endDate' => 'setEndDate', + 'documentBlockId' => 'setDocumentBlockId', + 'exportType' => 'setExportType', + 'numberStartYear' => 'setNumberStartYear', + 'numberStartSequence' => 'setNumberStartSequence', + 'numberEndYear' => 'setNumberEndYear', + 'numberEndSequence' => 'setNumberEndSequence', + 'paymentMethod' => 'setPaymentMethod', + 'sortBy' => 'setSortBy', + 'otherOptions' => 'setOtherOptions', + 'filterExtra' => 'setFilterExtra' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'queryType' => 'getQueryType', + 'startDate' => 'getStartDate', + 'endDate' => 'getEndDate', + 'documentBlockId' => 'getDocumentBlockId', + 'exportType' => 'getExportType', + 'numberStartYear' => 'getNumberStartYear', + 'numberStartSequence' => 'getNumberStartSequence', + 'numberEndYear' => 'getNumberEndYear', + 'numberEndSequence' => 'getNumberEndSequence', + 'paymentMethod' => 'getPaymentMethod', + 'sortBy' => 'getSortBy', + 'otherOptions' => 'getOtherOptions', + 'filterExtra' => 'getFilterExtra' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('queryType', $data ?? [], null); + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('endDate', $data ?? [], null); + $this->setIfExists('documentBlockId', $data ?? [], null); + $this->setIfExists('exportType', $data ?? [], null); + $this->setIfExists('numberStartYear', $data ?? [], null); + $this->setIfExists('numberStartSequence', $data ?? [], null); + $this->setIfExists('numberEndYear', $data ?? [], null); + $this->setIfExists('numberEndSequence', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('sortBy', $data ?? [], null); + $this->setIfExists('otherOptions', $data ?? [], null); + $this->setIfExists('filterExtra', $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 ($this->container['queryType'] === null) { + $invalidProperties[] = "'queryType' can't be null"; + } + if ($this->container['startDate'] === null) { + $invalidProperties[] = "'startDate' can't be null"; + } + if ($this->container['endDate'] === null) { + $invalidProperties[] = "'endDate' can't be null"; + } + if ($this->container['exportType'] === null) { + $invalidProperties[] = "'exportType' can't be null"; + } + 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 queryType + * + * @return \Cone\Billingo\Model\DocumentExportQueryType + */ + public function getQueryType() + { + return $this->container['queryType']; + } + + /** + * Sets queryType + * + * @param \Cone\Billingo\Model\DocumentExportQueryType $queryType queryType + * + * @return self + */ + public function setQueryType($queryType) + { + if (is_null($queryType)) { + throw new \InvalidArgumentException('non-nullable queryType cannot be null'); + } + $this->container['queryType'] = $queryType; + + return $this; + } + + /** + * Gets startDate + * + * @return \DateTime + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime $startDate startDate + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + throw new \InvalidArgumentException('non-nullable startDate cannot be null'); + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets endDate + * + * @return \DateTime + */ + public function getEndDate() + { + return $this->container['endDate']; + } + + /** + * Sets endDate + * + * @param \DateTime $endDate endDate + * + * @return self + */ + public function setEndDate($endDate) + { + if (is_null($endDate)) { + throw new \InvalidArgumentException('non-nullable endDate cannot be null'); + } + $this->container['endDate'] = $endDate; + + return $this; + } + + /** + * Gets documentBlockId + * + * @return int|null + */ + public function getDocumentBlockId() + { + return $this->container['documentBlockId']; + } + + /** + * Sets documentBlockId + * + * @param int|null $documentBlockId documentBlockId + * + * @return self + */ + public function setDocumentBlockId($documentBlockId) + { + if (is_null($documentBlockId)) { + throw new \InvalidArgumentException('non-nullable documentBlockId cannot be null'); + } + $this->container['documentBlockId'] = $documentBlockId; + + return $this; + } + + /** + * Gets exportType + * + * @return \Cone\Billingo\Model\DocumentExportType + */ + public function getExportType() + { + return $this->container['exportType']; + } + + /** + * Sets exportType + * + * @param \Cone\Billingo\Model\DocumentExportType $exportType exportType + * + * @return self + */ + public function setExportType($exportType) + { + if (is_null($exportType)) { + throw new \InvalidArgumentException('non-nullable exportType cannot be null'); + } + $this->container['exportType'] = $exportType; + + return $this; + } + + /** + * Gets numberStartYear + * + * @return int|null + */ + public function getNumberStartYear() + { + return $this->container['numberStartYear']; + } + + /** + * Sets numberStartYear + * + * @param int|null $numberStartYear numberStartYear + * + * @return self + */ + public function setNumberStartYear($numberStartYear) + { + if (is_null($numberStartYear)) { + throw new \InvalidArgumentException('non-nullable numberStartYear cannot be null'); + } + $this->container['numberStartYear'] = $numberStartYear; + + return $this; + } + + /** + * Gets numberStartSequence + * + * @return int|null + */ + public function getNumberStartSequence() + { + return $this->container['numberStartSequence']; + } + + /** + * Sets numberStartSequence + * + * @param int|null $numberStartSequence numberStartSequence + * + * @return self + */ + public function setNumberStartSequence($numberStartSequence) + { + if (is_null($numberStartSequence)) { + throw new \InvalidArgumentException('non-nullable numberStartSequence cannot be null'); + } + $this->container['numberStartSequence'] = $numberStartSequence; + + return $this; + } + + /** + * Gets numberEndYear + * + * @return int|null + */ + public function getNumberEndYear() + { + return $this->container['numberEndYear']; + } + + /** + * Sets numberEndYear + * + * @param int|null $numberEndYear numberEndYear + * + * @return self + */ + public function setNumberEndYear($numberEndYear) + { + if (is_null($numberEndYear)) { + throw new \InvalidArgumentException('non-nullable numberEndYear cannot be null'); + } + $this->container['numberEndYear'] = $numberEndYear; + + return $this; + } + + /** + * Gets numberEndSequence + * + * @return int|null + */ + public function getNumberEndSequence() + { + return $this->container['numberEndSequence']; + } + + /** + * Sets numberEndSequence + * + * @param int|null $numberEndSequence numberEndSequence + * + * @return self + */ + public function setNumberEndSequence($numberEndSequence) + { + if (is_null($numberEndSequence)) { + throw new \InvalidArgumentException('non-nullable numberEndSequence cannot be null'); + } + $this->container['numberEndSequence'] = $numberEndSequence; + + return $this; + } + + /** + * Gets paymentMethod + * + * @return \Cone\Billingo\Model\PaymentMethod|null + */ + public function getPaymentMethod() + { + return $this->container['paymentMethod']; + } + + /** + * Sets paymentMethod + * + * @param \Cone\Billingo\Model\PaymentMethod|null $paymentMethod paymentMethod + * + * @return self + */ + public function setPaymentMethod($paymentMethod) + { + if (is_null($paymentMethod)) { + throw new \InvalidArgumentException('non-nullable paymentMethod cannot be null'); + } + $this->container['paymentMethod'] = $paymentMethod; + + return $this; + } + + /** + * Gets sortBy + * + * @return \Cone\Billingo\Model\DocumentExportSortBy|null + */ + public function getSortBy() + { + return $this->container['sortBy']; + } + + /** + * Sets sortBy + * + * @param \Cone\Billingo\Model\DocumentExportSortBy|null $sortBy sortBy + * + * @return self + */ + public function setSortBy($sortBy) + { + if (is_null($sortBy)) { + throw new \InvalidArgumentException('non-nullable sortBy cannot be null'); + } + $this->container['sortBy'] = $sortBy; + + return $this; + } + + /** + * Gets otherOptions + * + * @return \Cone\Billingo\Model\DocumentExportOtherOptions|null + */ + public function getOtherOptions() + { + return $this->container['otherOptions']; + } + + /** + * Sets otherOptions + * + * @param \Cone\Billingo\Model\DocumentExportOtherOptions|null $otherOptions otherOptions + * + * @return self + */ + public function setOtherOptions($otherOptions) + { + if (is_null($otherOptions)) { + throw new \InvalidArgumentException('non-nullable otherOptions cannot be null'); + } + $this->container['otherOptions'] = $otherOptions; + + return $this; + } + + /** + * Gets filterExtra + * + * @return \Cone\Billingo\Model\DocumentExportFilterExtra|null + */ + public function getFilterExtra() + { + return $this->container['filterExtra']; + } + + /** + * Sets filterExtra + * + * @param \Cone\Billingo\Model\DocumentExportFilterExtra|null $filterExtra filterExtra + * + * @return self + */ + public function setFilterExtra($filterExtra) + { + if (is_null($filterExtra)) { + throw new \InvalidArgumentException('non-nullable filterExtra cannot be null'); + } + $this->container['filterExtra'] = $filterExtra; + + 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/src/Model/Currency.php b/src/Model/Currency.php new file mode 100644 index 0000000..c9bca96 --- /dev/null +++ b/src/Model/Currency.php @@ -0,0 +1,165 @@ + + */ +class Discount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Discount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => '\Cone\Billingo\Model\DiscountType', + 'value' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => 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 = [ + 'type' => 'type', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'value' => 'getValue' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('value', $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 \Cone\Billingo\Model\DiscountType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Cone\Billingo\Model\DiscountType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets value + * + * @return int|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param int|null $value value + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + 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/src/Model/DiscountType.php b/src/Model/DiscountType.php new file mode 100644 index 0000000..2386a2f --- /dev/null +++ b/src/Model/DiscountType.php @@ -0,0 +1,60 @@ + + */ +class Document implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Document'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'invoiceNumber' => 'string', + 'type' => '\Cone\Billingo\Model\DocumentType', + 'cancelled' => 'bool', + 'blockId' => 'int', + 'paymentStatus' => '\Cone\Billingo\Model\PaymentStatus', + 'paymentMethod' => '\Cone\Billingo\Model\PaymentMethod', + 'grossTotal' => 'float', + 'currency' => '\Cone\Billingo\Model\Currency', + 'conversionRate' => 'float', + 'invoiceDate' => '\DateTime', + 'fulfillmentDate' => '\DateTime', + 'dueDate' => '\DateTime', + 'paidDate' => '\DateTime', + 'organization' => '\Cone\Billingo\Model\DocumentOrganization', + 'partner' => '\Cone\Billingo\Model\Partner', + 'documentPartner' => '\Cone\Billingo\Model\DocumentPartner', + 'electronic' => 'bool', + 'comment' => 'string', + 'tags' => 'string[]', + 'notificationStatus' => '\Cone\Billingo\Model\DocumentNotificationStatus', + 'language' => '\Cone\Billingo\Model\DocumentLanguage', + 'items' => '\Cone\Billingo\Model\DocumentItem[]', + 'summary' => '\Cone\Billingo\Model\DocumentSummary', + 'settings' => '\Cone\Billingo\Model\DocumentSettings', + 'onlineSzamlaStatus' => '\Cone\Billingo\Model\OnlineSzamlaStatusEnum', + 'relatedDocuments' => '\Cone\Billingo\Model\DocumentAncestor[]', + 'discount' => '\Cone\Billingo\Model\Discount', + 'correctionType' => '\Cone\Billingo\Model\CorrectionType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'invoiceNumber' => null, + 'type' => null, + 'cancelled' => null, + 'blockId' => null, + 'paymentStatus' => null, + 'paymentMethod' => null, + 'grossTotal' => 'float', + 'currency' => null, + 'conversionRate' => 'float', + 'invoiceDate' => 'date', + 'fulfillmentDate' => 'date', + 'dueDate' => 'date', + 'paidDate' => 'date', + 'organization' => null, + 'partner' => null, + 'documentPartner' => null, + 'electronic' => null, + 'comment' => null, + 'tags' => null, + 'notificationStatus' => null, + 'language' => null, + 'items' => null, + 'summary' => null, + 'settings' => null, + 'onlineSzamlaStatus' => null, + 'relatedDocuments' => null, + 'discount' => null, + 'correctionType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'invoiceNumber' => false, + 'type' => false, + 'cancelled' => false, + 'blockId' => false, + 'paymentStatus' => false, + 'paymentMethod' => false, + 'grossTotal' => false, + 'currency' => false, + 'conversionRate' => false, + 'invoiceDate' => false, + 'fulfillmentDate' => false, + 'dueDate' => false, + 'paidDate' => false, + 'organization' => false, + 'partner' => false, + 'documentPartner' => false, + 'electronic' => false, + 'comment' => false, + 'tags' => false, + 'notificationStatus' => false, + 'language' => false, + 'items' => false, + 'summary' => false, + 'settings' => false, + 'onlineSzamlaStatus' => false, + 'relatedDocuments' => false, + 'discount' => false, + 'correctionType' => 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', + 'invoiceNumber' => 'invoice_number', + 'type' => 'type', + 'cancelled' => 'cancelled', + 'blockId' => 'block_id', + 'paymentStatus' => 'payment_status', + 'paymentMethod' => 'payment_method', + 'grossTotal' => 'gross_total', + 'currency' => 'currency', + 'conversionRate' => 'conversion_rate', + 'invoiceDate' => 'invoice_date', + 'fulfillmentDate' => 'fulfillment_date', + 'dueDate' => 'due_date', + 'paidDate' => 'paid_date', + 'organization' => 'organization', + 'partner' => 'partner', + 'documentPartner' => 'document_partner', + 'electronic' => 'electronic', + 'comment' => 'comment', + 'tags' => 'tags', + 'notificationStatus' => 'notification_status', + 'language' => 'language', + 'items' => 'items', + 'summary' => 'summary', + 'settings' => 'settings', + 'onlineSzamlaStatus' => 'online_szamla_status', + 'relatedDocuments' => 'related_documents', + 'discount' => 'discount', + 'correctionType' => 'correction_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'invoiceNumber' => 'setInvoiceNumber', + 'type' => 'setType', + 'cancelled' => 'setCancelled', + 'blockId' => 'setBlockId', + 'paymentStatus' => 'setPaymentStatus', + 'paymentMethod' => 'setPaymentMethod', + 'grossTotal' => 'setGrossTotal', + 'currency' => 'setCurrency', + 'conversionRate' => 'setConversionRate', + 'invoiceDate' => 'setInvoiceDate', + 'fulfillmentDate' => 'setFulfillmentDate', + 'dueDate' => 'setDueDate', + 'paidDate' => 'setPaidDate', + 'organization' => 'setOrganization', + 'partner' => 'setPartner', + 'documentPartner' => 'setDocumentPartner', + 'electronic' => 'setElectronic', + 'comment' => 'setComment', + 'tags' => 'setTags', + 'notificationStatus' => 'setNotificationStatus', + 'language' => 'setLanguage', + 'items' => 'setItems', + 'summary' => 'setSummary', + 'settings' => 'setSettings', + 'onlineSzamlaStatus' => 'setOnlineSzamlaStatus', + 'relatedDocuments' => 'setRelatedDocuments', + 'discount' => 'setDiscount', + 'correctionType' => 'setCorrectionType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'invoiceNumber' => 'getInvoiceNumber', + 'type' => 'getType', + 'cancelled' => 'getCancelled', + 'blockId' => 'getBlockId', + 'paymentStatus' => 'getPaymentStatus', + 'paymentMethod' => 'getPaymentMethod', + 'grossTotal' => 'getGrossTotal', + 'currency' => 'getCurrency', + 'conversionRate' => 'getConversionRate', + 'invoiceDate' => 'getInvoiceDate', + 'fulfillmentDate' => 'getFulfillmentDate', + 'dueDate' => 'getDueDate', + 'paidDate' => 'getPaidDate', + 'organization' => 'getOrganization', + 'partner' => 'getPartner', + 'documentPartner' => 'getDocumentPartner', + 'electronic' => 'getElectronic', + 'comment' => 'getComment', + 'tags' => 'getTags', + 'notificationStatus' => 'getNotificationStatus', + 'language' => 'getLanguage', + 'items' => 'getItems', + 'summary' => 'getSummary', + 'settings' => 'getSettings', + 'onlineSzamlaStatus' => 'getOnlineSzamlaStatus', + 'relatedDocuments' => 'getRelatedDocuments', + 'discount' => 'getDiscount', + 'correctionType' => 'getCorrectionType' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('invoiceNumber', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('cancelled', $data ?? [], null); + $this->setIfExists('blockId', $data ?? [], null); + $this->setIfExists('paymentStatus', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('grossTotal', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('conversionRate', $data ?? [], null); + $this->setIfExists('invoiceDate', $data ?? [], null); + $this->setIfExists('fulfillmentDate', $data ?? [], null); + $this->setIfExists('dueDate', $data ?? [], null); + $this->setIfExists('paidDate', $data ?? [], null); + $this->setIfExists('organization', $data ?? [], null); + $this->setIfExists('partner', $data ?? [], null); + $this->setIfExists('documentPartner', $data ?? [], null); + $this->setIfExists('electronic', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('tags', $data ?? [], null); + $this->setIfExists('notificationStatus', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('summary', $data ?? [], null); + $this->setIfExists('settings', $data ?? [], null); + $this->setIfExists('onlineSzamlaStatus', $data ?? [], null); + $this->setIfExists('relatedDocuments', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('correctionType', $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 The document's unique identifier. + * + * @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 invoiceNumber + * + * @return string|null + */ + public function getInvoiceNumber() + { + return $this->container['invoiceNumber']; + } + + /** + * Sets invoiceNumber + * + * @param string|null $invoiceNumber The document's invoice number. + * + * @return self + */ + public function setInvoiceNumber($invoiceNumber) + { + if (is_null($invoiceNumber)) { + throw new \InvalidArgumentException('non-nullable invoiceNumber cannot be null'); + } + $this->container['invoiceNumber'] = $invoiceNumber; + + return $this; + } + + /** + * Gets type + * + * @return \Cone\Billingo\Model\DocumentType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Cone\Billingo\Model\DocumentType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets cancelled + * + * @return bool|null + */ + public function getCancelled() + { + return $this->container['cancelled']; + } + + /** + * Sets cancelled + * + * @param bool|null $cancelled cancelled + * + * @return self + */ + public function setCancelled($cancelled) + { + if (is_null($cancelled)) { + throw new \InvalidArgumentException('non-nullable cancelled cannot be null'); + } + $this->container['cancelled'] = $cancelled; + + return $this; + } + + /** + * Gets blockId + * + * @return int|null + */ + public function getBlockId() + { + return $this->container['blockId']; + } + + /** + * Sets blockId + * + * @param int|null $blockId DocumentBlock's identifier. + * + * @return self + */ + public function setBlockId($blockId) + { + if (is_null($blockId)) { + throw new \InvalidArgumentException('non-nullable blockId cannot be null'); + } + $this->container['blockId'] = $blockId; + + return $this; + } + + /** + * Gets paymentStatus + * + * @return \Cone\Billingo\Model\PaymentStatus|null + */ + public function getPaymentStatus() + { + return $this->container['paymentStatus']; + } + + /** + * Sets paymentStatus + * + * @param \Cone\Billingo\Model\PaymentStatus|null $paymentStatus paymentStatus + * + * @return self + */ + public function setPaymentStatus($paymentStatus) + { + if (is_null($paymentStatus)) { + throw new \InvalidArgumentException('non-nullable paymentStatus cannot be null'); + } + $this->container['paymentStatus'] = $paymentStatus; + + return $this; + } + + /** + * Gets paymentMethod + * + * @return \Cone\Billingo\Model\PaymentMethod|null + */ + public function getPaymentMethod() + { + return $this->container['paymentMethod']; + } + + /** + * Sets paymentMethod + * + * @param \Cone\Billingo\Model\PaymentMethod|null $paymentMethod paymentMethod + * + * @return self + */ + public function setPaymentMethod($paymentMethod) + { + if (is_null($paymentMethod)) { + throw new \InvalidArgumentException('non-nullable paymentMethod cannot be null'); + } + $this->container['paymentMethod'] = $paymentMethod; + + return $this; + } + + /** + * Gets grossTotal + * + * @return float|null + */ + public function getGrossTotal() + { + return $this->container['grossTotal']; + } + + /** + * Sets grossTotal + * + * @param float|null $grossTotal The document's gross total price. + * + * @return self + */ + public function setGrossTotal($grossTotal) + { + if (is_null($grossTotal)) { + throw new \InvalidArgumentException('non-nullable grossTotal cannot be null'); + } + $this->container['grossTotal'] = $grossTotal; + + return $this; + } + + /** + * Gets currency + * + * @return \Cone\Billingo\Model\Currency|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Cone\Billingo\Model\Currency|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets conversionRate + * + * @return float|null + */ + public function getConversionRate() + { + return $this->container['conversionRate']; + } + + /** + * Sets conversionRate + * + * @param float|null $conversionRate conversionRate + * + * @return self + */ + public function setConversionRate($conversionRate) + { + if (is_null($conversionRate)) { + throw new \InvalidArgumentException('non-nullable conversionRate cannot be null'); + } + $this->container['conversionRate'] = $conversionRate; + + return $this; + } + + /** + * Gets invoiceDate + * + * @return \DateTime|null + */ + public function getInvoiceDate() + { + return $this->container['invoiceDate']; + } + + /** + * Sets invoiceDate + * + * @param \DateTime|null $invoiceDate invoiceDate + * + * @return self + */ + public function setInvoiceDate($invoiceDate) + { + if (is_null($invoiceDate)) { + throw new \InvalidArgumentException('non-nullable invoiceDate cannot be null'); + } + $this->container['invoiceDate'] = $invoiceDate; + + return $this; + } + + /** + * Gets fulfillmentDate + * + * @return \DateTime|null + */ + public function getFulfillmentDate() + { + return $this->container['fulfillmentDate']; + } + + /** + * Sets fulfillmentDate + * + * @param \DateTime|null $fulfillmentDate fulfillmentDate + * + * @return self + */ + public function setFulfillmentDate($fulfillmentDate) + { + if (is_null($fulfillmentDate)) { + throw new \InvalidArgumentException('non-nullable fulfillmentDate cannot be null'); + } + $this->container['fulfillmentDate'] = $fulfillmentDate; + + return $this; + } + + /** + * Gets dueDate + * + * @return \DateTime|null + */ + public function getDueDate() + { + return $this->container['dueDate']; + } + + /** + * Sets dueDate + * + * @param \DateTime|null $dueDate dueDate + * + * @return self + */ + public function setDueDate($dueDate) + { + if (is_null($dueDate)) { + throw new \InvalidArgumentException('non-nullable dueDate cannot be null'); + } + $this->container['dueDate'] = $dueDate; + + return $this; + } + + /** + * Gets paidDate + * + * @return \DateTime|null + */ + public function getPaidDate() + { + return $this->container['paidDate']; + } + + /** + * Sets paidDate + * + * @param \DateTime|null $paidDate paidDate + * + * @return self + */ + public function setPaidDate($paidDate) + { + if (is_null($paidDate)) { + throw new \InvalidArgumentException('non-nullable paidDate cannot be null'); + } + $this->container['paidDate'] = $paidDate; + + return $this; + } + + /** + * Gets organization + * + * @return \Cone\Billingo\Model\DocumentOrganization|null + */ + public function getOrganization() + { + return $this->container['organization']; + } + + /** + * Sets organization + * + * @param \Cone\Billingo\Model\DocumentOrganization|null $organization organization + * + * @return self + */ + public function setOrganization($organization) + { + if (is_null($organization)) { + throw new \InvalidArgumentException('non-nullable organization cannot be null'); + } + $this->container['organization'] = $organization; + + return $this; + } + + /** + * Gets partner + * + * @return \Cone\Billingo\Model\Partner|null + */ + public function getPartner() + { + return $this->container['partner']; + } + + /** + * Sets partner + * + * @param \Cone\Billingo\Model\Partner|null $partner partner + * + * @return self + */ + public function setPartner($partner) + { + if (is_null($partner)) { + throw new \InvalidArgumentException('non-nullable partner cannot be null'); + } + $this->container['partner'] = $partner; + + return $this; + } + + /** + * Gets documentPartner + * + * @return \Cone\Billingo\Model\DocumentPartner|null + */ + public function getDocumentPartner() + { + return $this->container['documentPartner']; + } + + /** + * Sets documentPartner + * + * @param \Cone\Billingo\Model\DocumentPartner|null $documentPartner documentPartner + * + * @return self + */ + public function setDocumentPartner($documentPartner) + { + if (is_null($documentPartner)) { + throw new \InvalidArgumentException('non-nullable documentPartner cannot be null'); + } + $this->container['documentPartner'] = $documentPartner; + + return $this; + } + + /** + * Gets electronic + * + * @return bool|null + */ + public function getElectronic() + { + return $this->container['electronic']; + } + + /** + * Sets electronic + * + * @param bool|null $electronic electronic + * + * @return self + */ + public function setElectronic($electronic) + { + if (is_null($electronic)) { + throw new \InvalidArgumentException('non-nullable electronic cannot be null'); + } + $this->container['electronic'] = $electronic; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + throw new \InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets tags + * + * @return string[]|null + */ + public function getTags() + { + return $this->container['tags']; + } + + /** + * Sets tags + * + * @param string[]|null $tags tags + * + * @return self + */ + public function setTags($tags) + { + if (is_null($tags)) { + throw new \InvalidArgumentException('non-nullable tags cannot be null'); + } + $this->container['tags'] = $tags; + + return $this; + } + + /** + * Gets notificationStatus + * + * @return \Cone\Billingo\Model\DocumentNotificationStatus|null + */ + public function getNotificationStatus() + { + return $this->container['notificationStatus']; + } + + /** + * Sets notificationStatus + * + * @param \Cone\Billingo\Model\DocumentNotificationStatus|null $notificationStatus notificationStatus + * + * @return self + */ + public function setNotificationStatus($notificationStatus) + { + if (is_null($notificationStatus)) { + throw new \InvalidArgumentException('non-nullable notificationStatus cannot be null'); + } + $this->container['notificationStatus'] = $notificationStatus; + + return $this; + } + + /** + * Gets language + * + * @return \Cone\Billingo\Model\DocumentLanguage|null + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param \Cone\Billingo\Model\DocumentLanguage|null $language language + * + * @return self + */ + public function setLanguage($language) + { + if (is_null($language)) { + throw new \InvalidArgumentException('non-nullable language cannot be null'); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets items + * + * @return \Cone\Billingo\Model\DocumentItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Cone\Billingo\Model\DocumentItem[]|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 summary + * + * @return \Cone\Billingo\Model\DocumentSummary|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param \Cone\Billingo\Model\DocumentSummary|null $summary summary + * + * @return self + */ + public function setSummary($summary) + { + if (is_null($summary)) { + throw new \InvalidArgumentException('non-nullable summary cannot be null'); + } + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets settings + * + * @return \Cone\Billingo\Model\DocumentSettings|null + */ + public function getSettings() + { + return $this->container['settings']; + } + + /** + * Sets settings + * + * @param \Cone\Billingo\Model\DocumentSettings|null $settings settings + * + * @return self + */ + public function setSettings($settings) + { + if (is_null($settings)) { + throw new \InvalidArgumentException('non-nullable settings cannot be null'); + } + $this->container['settings'] = $settings; + + return $this; + } + + /** + * Gets onlineSzamlaStatus + * + * @return \Cone\Billingo\Model\OnlineSzamlaStatusEnum|null + */ + public function getOnlineSzamlaStatus() + { + return $this->container['onlineSzamlaStatus']; + } + + /** + * Sets onlineSzamlaStatus + * + * @param \Cone\Billingo\Model\OnlineSzamlaStatusEnum|null $onlineSzamlaStatus onlineSzamlaStatus + * + * @return self + */ + public function setOnlineSzamlaStatus($onlineSzamlaStatus) + { + if (is_null($onlineSzamlaStatus)) { + throw new \InvalidArgumentException('non-nullable onlineSzamlaStatus cannot be null'); + } + $this->container['onlineSzamlaStatus'] = $onlineSzamlaStatus; + + return $this; + } + + /** + * Gets relatedDocuments + * + * @return \Cone\Billingo\Model\DocumentAncestor[]|null + */ + public function getRelatedDocuments() + { + return $this->container['relatedDocuments']; + } + + /** + * Sets relatedDocuments + * + * @param \Cone\Billingo\Model\DocumentAncestor[]|null $relatedDocuments relatedDocuments + * + * @return self + */ + public function setRelatedDocuments($relatedDocuments) + { + if (is_null($relatedDocuments)) { + throw new \InvalidArgumentException('non-nullable relatedDocuments cannot be null'); + } + $this->container['relatedDocuments'] = $relatedDocuments; + + return $this; + } + + /** + * Gets discount + * + * @return \Cone\Billingo\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \Cone\Billingo\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets correctionType + * + * @return \Cone\Billingo\Model\CorrectionType|null + */ + public function getCorrectionType() + { + return $this->container['correctionType']; + } + + /** + * Sets correctionType + * + * @param \Cone\Billingo\Model\CorrectionType|null $correctionType correctionType + * + * @return self + */ + public function setCorrectionType($correctionType) + { + if (is_null($correctionType)) { + throw new \InvalidArgumentException('non-nullable correctionType cannot be null'); + } + $this->container['correctionType'] = $correctionType; + + 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/src/Model/DocumentAncestor.php b/src/Model/DocumentAncestor.php new file mode 100644 index 0000000..63503e9 --- /dev/null +++ b/src/Model/DocumentAncestor.php @@ -0,0 +1,445 @@ + + */ +class DocumentAncestor implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentAncestor'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'invoiceNumber' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'invoiceNumber' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'invoiceNumber' => 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', + 'invoiceNumber' => 'invoice_number' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'invoiceNumber' => 'setInvoiceNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'invoiceNumber' => 'getInvoiceNumber' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('invoiceNumber', $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 Unique identifier of the related document. + * + * @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 invoiceNumber + * + * @return string|null + */ + public function getInvoiceNumber() + { + return $this->container['invoiceNumber']; + } + + /** + * Sets invoiceNumber + * + * @param string|null $invoiceNumber Invoice number of the related document. + * + * @return self + */ + public function setInvoiceNumber($invoiceNumber) + { + if (is_null($invoiceNumber)) { + throw new \InvalidArgumentException('non-nullable invoiceNumber cannot be null'); + } + $this->container['invoiceNumber'] = $invoiceNumber; + + 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/src/Model/DocumentBankAccount.php b/src/Model/DocumentBankAccount.php new file mode 100644 index 0000000..eea1846 --- /dev/null +++ b/src/Model/DocumentBankAccount.php @@ -0,0 +1,559 @@ + + */ +class DocumentBankAccount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentBankAccount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'accountNumber' => 'string', + 'accountNumberIban' => 'string', + 'swift' => '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, + 'accountNumber' => null, + 'accountNumberIban' => null, + 'swift' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => true, + 'name' => false, + 'accountNumber' => false, + 'accountNumberIban' => false, + 'swift' => 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', + 'name' => 'name', + 'accountNumber' => 'account_number', + 'accountNumberIban' => 'account_number_iban', + 'swift' => 'swift' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'accountNumber' => 'setAccountNumber', + 'accountNumberIban' => 'setAccountNumberIban', + 'swift' => 'setSwift' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'accountNumber' => 'getAccountNumber', + 'accountNumberIban' => 'getAccountNumberIban', + 'swift' => 'getSwift' + ]; + + /** + * 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[] $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('accountNumber', $data ?? [], null); + $this->setIfExists('accountNumberIban', $data ?? [], null); + $this->setIfExists('swift', $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 ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['accountNumber'] === null) { + $invalidProperties[] = "'accountNumber' can't be null"; + } + 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)) { + 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 + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets accountNumber + * + * @return string + */ + public function getAccountNumber() + { + return $this->container['accountNumber']; + } + + /** + * Sets accountNumber + * + * @param string $accountNumber accountNumber + * + * @return self + */ + public function setAccountNumber($accountNumber) + { + if (is_null($accountNumber)) { + throw new \InvalidArgumentException('non-nullable accountNumber cannot be null'); + } + $this->container['accountNumber'] = $accountNumber; + + return $this; + } + + /** + * Gets accountNumberIban + * + * @return string|null + */ + public function getAccountNumberIban() + { + return $this->container['accountNumberIban']; + } + + /** + * Sets accountNumberIban + * + * @param string|null $accountNumberIban accountNumberIban + * + * @return self + */ + public function setAccountNumberIban($accountNumberIban) + { + if (is_null($accountNumberIban)) { + throw new \InvalidArgumentException('non-nullable accountNumberIban cannot be null'); + } + $this->container['accountNumberIban'] = $accountNumberIban; + + return $this; + } + + /** + * Gets swift + * + * @return string|null + */ + public function getSwift() + { + return $this->container['swift']; + } + + /** + * Sets swift + * + * @param string|null $swift swift + * + * @return self + */ + public function setSwift($swift) + { + if (is_null($swift)) { + throw new \InvalidArgumentException('non-nullable swift cannot be null'); + } + $this->container['swift'] = $swift; + + 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/src/Model/DocumentBlock.php b/src/Model/DocumentBlock.php new file mode 100644 index 0000000..b2fa271 --- /dev/null +++ b/src/Model/DocumentBlock.php @@ -0,0 +1,580 @@ + + */ +class DocumentBlock implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentBlock'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'prefix' => 'string', + 'customField1' => 'string', + 'customField2' => 'string', + 'type' => '\Cone\Billingo\Model\DocumentBlockType' + ]; + + /** + * 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, + 'prefix' => null, + 'customField1' => null, + 'customField2' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'prefix' => false, + 'customField1' => false, + 'customField2' => false, + 'type' => 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', + 'name' => 'name', + 'prefix' => 'prefix', + 'customField1' => 'custom_field1', + 'customField2' => 'custom_field2', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'prefix' => 'setPrefix', + 'customField1' => 'setCustomField1', + 'customField2' => 'setCustomField2', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'prefix' => 'getPrefix', + 'customField1' => 'getCustomField1', + 'customField2' => 'getCustomField2', + 'type' => 'getType' + ]; + + /** + * 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[] $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('prefix', $data ?? [], null); + $this->setIfExists('customField1', $data ?? [], null); + $this->setIfExists('customField2', $data ?? [], null); + $this->setIfExists('type', $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 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)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets prefix + * + * @return string|null + */ + public function getPrefix() + { + return $this->container['prefix']; + } + + /** + * Sets prefix + * + * @param string|null $prefix prefix + * + * @return self + */ + public function setPrefix($prefix) + { + if (is_null($prefix)) { + throw new \InvalidArgumentException('non-nullable prefix cannot be null'); + } + $this->container['prefix'] = $prefix; + + return $this; + } + + /** + * Gets customField1 + * + * @return string|null + */ + public function getCustomField1() + { + return $this->container['customField1']; + } + + /** + * Sets customField1 + * + * @param string|null $customField1 customField1 + * + * @return self + */ + public function setCustomField1($customField1) + { + if (is_null($customField1)) { + throw new \InvalidArgumentException('non-nullable customField1 cannot be null'); + } + $this->container['customField1'] = $customField1; + + return $this; + } + + /** + * Gets customField2 + * + * @return string|null + */ + public function getCustomField2() + { + return $this->container['customField2']; + } + + /** + * Sets customField2 + * + * @param string|null $customField2 customField2 + * + * @return self + */ + public function setCustomField2($customField2) + { + if (is_null($customField2)) { + throw new \InvalidArgumentException('non-nullable customField2 cannot be null'); + } + $this->container['customField2'] = $customField2; + + return $this; + } + + /** + * Gets type + * + * @return \Cone\Billingo\Model\DocumentBlockType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Cone\Billingo\Model\DocumentBlockType|null $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + 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/src/Model/DocumentBlockList.php b/src/Model/DocumentBlockList.php new file mode 100644 index 0000000..3934176 --- /dev/null +++ b/src/Model/DocumentBlockList.php @@ -0,0 +1,615 @@ + + */ +class DocumentBlockList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentBlockList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Cone\Billingo\Model\DocumentBlock[]', + 'total' => 'int', + 'perPage' => 'int', + 'currentPage' => 'int', + 'lastPage' => 'int', + 'prevPageUrl' => 'string', + 'nextPageUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'total' => null, + 'perPage' => null, + 'currentPage' => null, + 'lastPage' => null, + 'prevPageUrl' => null, + 'nextPageUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'total' => false, + 'perPage' => false, + 'currentPage' => false, + 'lastPage' => false, + 'prevPageUrl' => false, + 'nextPageUrl' => 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 = [ + 'data' => 'data', + 'total' => 'total', + 'perPage' => 'per_page', + 'currentPage' => 'current_page', + 'lastPage' => 'last_page', + 'prevPageUrl' => 'prev_page_url', + 'nextPageUrl' => 'next_page_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'total' => 'setTotal', + 'perPage' => 'setPerPage', + 'currentPage' => 'setCurrentPage', + 'lastPage' => 'setLastPage', + 'prevPageUrl' => 'setPrevPageUrl', + 'nextPageUrl' => 'setNextPageUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'total' => 'getTotal', + 'perPage' => 'getPerPage', + 'currentPage' => 'getCurrentPage', + 'lastPage' => 'getLastPage', + 'prevPageUrl' => 'getPrevPageUrl', + 'nextPageUrl' => 'getNextPageUrl' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('perPage', $data ?? [], null); + $this->setIfExists('currentPage', $data ?? [], null); + $this->setIfExists('lastPage', $data ?? [], null); + $this->setIfExists('prevPageUrl', $data ?? [], null); + $this->setIfExists('nextPageUrl', $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 data + * + * @return \Cone\Billingo\Model\DocumentBlock[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Cone\Billingo\Model\DocumentBlock[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total 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; + } + + /** + * Gets perPage + * + * @return int|null + */ + public function getPerPage() + { + return $this->container['perPage']; + } + + /** + * Sets perPage + * + * @param int|null $perPage perPage + * + * @return self + */ + public function setPerPage($perPage) + { + if (is_null($perPage)) { + throw new \InvalidArgumentException('non-nullable perPage cannot be null'); + } + $this->container['perPage'] = $perPage; + + return $this; + } + + /** + * Gets currentPage + * + * @return int|null + */ + public function getCurrentPage() + { + return $this->container['currentPage']; + } + + /** + * Sets currentPage + * + * @param int|null $currentPage currentPage + * + * @return self + */ + public function setCurrentPage($currentPage) + { + if (is_null($currentPage)) { + throw new \InvalidArgumentException('non-nullable currentPage cannot be null'); + } + $this->container['currentPage'] = $currentPage; + + return $this; + } + + /** + * Gets lastPage + * + * @return int|null + */ + public function getLastPage() + { + return $this->container['lastPage']; + } + + /** + * Sets lastPage + * + * @param int|null $lastPage lastPage + * + * @return self + */ + public function setLastPage($lastPage) + { + if (is_null($lastPage)) { + throw new \InvalidArgumentException('non-nullable lastPage cannot be null'); + } + $this->container['lastPage'] = $lastPage; + + return $this; + } + + /** + * Gets prevPageUrl + * + * @return string|null + */ + public function getPrevPageUrl() + { + return $this->container['prevPageUrl']; + } + + /** + * Sets prevPageUrl + * + * @param string|null $prevPageUrl prevPageUrl + * + * @return self + */ + public function setPrevPageUrl($prevPageUrl) + { + if (is_null($prevPageUrl)) { + throw new \InvalidArgumentException('non-nullable prevPageUrl cannot be null'); + } + $this->container['prevPageUrl'] = $prevPageUrl; + + return $this; + } + + /** + * Gets nextPageUrl + * + * @return string|null + */ + public function getNextPageUrl() + { + return $this->container['nextPageUrl']; + } + + /** + * Sets nextPageUrl + * + * @param string|null $nextPageUrl nextPageUrl + * + * @return self + */ + public function setNextPageUrl($nextPageUrl) + { + if (is_null($nextPageUrl)) { + throw new \InvalidArgumentException('non-nullable nextPageUrl cannot be null'); + } + $this->container['nextPageUrl'] = $nextPageUrl; + + 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/src/Model/DocumentBlockType.php b/src/Model/DocumentBlockType.php new file mode 100644 index 0000000..f9c4444 --- /dev/null +++ b/src/Model/DocumentBlockType.php @@ -0,0 +1,78 @@ + + */ +class DocumentCancellation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentCancellation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cancellationReason' => 'string', + 'cancellationRecipients' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cancellationReason' => null, + 'cancellationRecipients' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'cancellationReason' => false, + 'cancellationRecipients' => 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 = [ + 'cancellationReason' => 'cancellation_reason', + 'cancellationRecipients' => 'cancellation_recipients' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cancellationReason' => 'setCancellationReason', + 'cancellationRecipients' => 'setCancellationRecipients' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cancellationReason' => 'getCancellationReason', + 'cancellationRecipients' => 'getCancellationRecipients' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('cancellationReason', $data ?? [], null); + $this->setIfExists('cancellationRecipients', $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 cancellationReason + * + * @return string|null + */ + public function getCancellationReason() + { + return $this->container['cancellationReason']; + } + + /** + * Sets cancellationReason + * + * @param string|null $cancellationReason cancellationReason + * + * @return self + */ + public function setCancellationReason($cancellationReason) + { + if (is_null($cancellationReason)) { + throw new \InvalidArgumentException('non-nullable cancellationReason cannot be null'); + } + $this->container['cancellationReason'] = $cancellationReason; + + return $this; + } + + /** + * Gets cancellationRecipients + * + * @return string|null + */ + public function getCancellationRecipients() + { + return $this->container['cancellationRecipients']; + } + + /** + * Sets cancellationRecipients + * + * @param string|null $cancellationRecipients cancellationRecipients + * + * @return self + */ + public function setCancellationRecipients($cancellationRecipients) + { + if (is_null($cancellationRecipients)) { + throw new \InvalidArgumentException('non-nullable cancellationRecipients cannot be null'); + } + $this->container['cancellationRecipients'] = $cancellationRecipients; + + 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/src/Model/DocumentExportFilterExtra.php b/src/Model/DocumentExportFilterExtra.php new file mode 100644 index 0000000..778ccfc --- /dev/null +++ b/src/Model/DocumentExportFilterExtra.php @@ -0,0 +1,682 @@ + + */ +class DocumentExportFilterExtra implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentExportFilterExtra'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'tensoftVkod' => 'string', + 'ledgerNumber' => '\Cone\Billingo\Model\LedgerNumberInformation', + 'forintsoftKonyvelesiNaploSzam' => 'string', + 'positiveLedgerNumber' => 'string', + 'negativeLedgerNumber' => 'string', + 'rlbKata' => 'bool', + 'rlbNote' => 'string', + 'novitaxNaplokod' => 'string', + 'useGrossValues' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'tensoftVkod' => null, + 'ledgerNumber' => null, + 'forintsoftKonyvelesiNaploSzam' => null, + 'positiveLedgerNumber' => null, + 'negativeLedgerNumber' => null, + 'rlbKata' => null, + 'rlbNote' => null, + 'novitaxNaplokod' => null, + 'useGrossValues' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'tensoftVkod' => false, + 'ledgerNumber' => false, + 'forintsoftKonyvelesiNaploSzam' => false, + 'positiveLedgerNumber' => false, + 'negativeLedgerNumber' => false, + 'rlbKata' => false, + 'rlbNote' => false, + 'novitaxNaplokod' => false, + 'useGrossValues' => 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 = [ + 'tensoftVkod' => 'tensoft_vkod', + 'ledgerNumber' => 'ledger_number', + 'forintsoftKonyvelesiNaploSzam' => 'forintsoft_konyvelesi_naplo_szam', + 'positiveLedgerNumber' => 'positive_ledger_number', + 'negativeLedgerNumber' => 'negative_ledger_number', + 'rlbKata' => 'rlb_kata', + 'rlbNote' => 'rlb_note', + 'novitaxNaplokod' => 'novitax_naplokod', + 'useGrossValues' => 'use_gross_values' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'tensoftVkod' => 'setTensoftVkod', + 'ledgerNumber' => 'setLedgerNumber', + 'forintsoftKonyvelesiNaploSzam' => 'setForintsoftKonyvelesiNaploSzam', + 'positiveLedgerNumber' => 'setPositiveLedgerNumber', + 'negativeLedgerNumber' => 'setNegativeLedgerNumber', + 'rlbKata' => 'setRlbKata', + 'rlbNote' => 'setRlbNote', + 'novitaxNaplokod' => 'setNovitaxNaplokod', + 'useGrossValues' => 'setUseGrossValues' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'tensoftVkod' => 'getTensoftVkod', + 'ledgerNumber' => 'getLedgerNumber', + 'forintsoftKonyvelesiNaploSzam' => 'getForintsoftKonyvelesiNaploSzam', + 'positiveLedgerNumber' => 'getPositiveLedgerNumber', + 'negativeLedgerNumber' => 'getNegativeLedgerNumber', + 'rlbKata' => 'getRlbKata', + 'rlbNote' => 'getRlbNote', + 'novitaxNaplokod' => 'getNovitaxNaplokod', + 'useGrossValues' => 'getUseGrossValues' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('tensoftVkod', $data ?? [], null); + $this->setIfExists('ledgerNumber', $data ?? [], null); + $this->setIfExists('forintsoftKonyvelesiNaploSzam', $data ?? [], null); + $this->setIfExists('positiveLedgerNumber', $data ?? [], null); + $this->setIfExists('negativeLedgerNumber', $data ?? [], null); + $this->setIfExists('rlbKata', $data ?? [], null); + $this->setIfExists('rlbNote', $data ?? [], null); + $this->setIfExists('novitaxNaplokod', $data ?? [], null); + $this->setIfExists('useGrossValues', $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 tensoftVkod + * + * @return string|null + */ + public function getTensoftVkod() + { + return $this->container['tensoftVkod']; + } + + /** + * Sets tensoftVkod + * + * @param string|null $tensoftVkod tensoftVkod + * + * @return self + */ + public function setTensoftVkod($tensoftVkod) + { + if (is_null($tensoftVkod)) { + throw new \InvalidArgumentException('non-nullable tensoftVkod cannot be null'); + } + $this->container['tensoftVkod'] = $tensoftVkod; + + return $this; + } + + /** + * Gets ledgerNumber + * + * @return \Cone\Billingo\Model\LedgerNumberInformation|null + */ + public function getLedgerNumber() + { + return $this->container['ledgerNumber']; + } + + /** + * Sets ledgerNumber + * + * @param \Cone\Billingo\Model\LedgerNumberInformation|null $ledgerNumber ledgerNumber + * + * @return self + */ + public function setLedgerNumber($ledgerNumber) + { + if (is_null($ledgerNumber)) { + throw new \InvalidArgumentException('non-nullable ledgerNumber cannot be null'); + } + $this->container['ledgerNumber'] = $ledgerNumber; + + return $this; + } + + /** + * Gets forintsoftKonyvelesiNaploSzam + * + * @return string|null + */ + public function getForintsoftKonyvelesiNaploSzam() + { + return $this->container['forintsoftKonyvelesiNaploSzam']; + } + + /** + * Sets forintsoftKonyvelesiNaploSzam + * + * @param string|null $forintsoftKonyvelesiNaploSzam forintsoftKonyvelesiNaploSzam + * + * @return self + */ + public function setForintsoftKonyvelesiNaploSzam($forintsoftKonyvelesiNaploSzam) + { + if (is_null($forintsoftKonyvelesiNaploSzam)) { + throw new \InvalidArgumentException('non-nullable forintsoftKonyvelesiNaploSzam cannot be null'); + } + $this->container['forintsoftKonyvelesiNaploSzam'] = $forintsoftKonyvelesiNaploSzam; + + return $this; + } + + /** + * Gets positiveLedgerNumber + * + * @return string|null + */ + public function getPositiveLedgerNumber() + { + return $this->container['positiveLedgerNumber']; + } + + /** + * Sets positiveLedgerNumber + * + * @param string|null $positiveLedgerNumber positiveLedgerNumber + * + * @return self + */ + public function setPositiveLedgerNumber($positiveLedgerNumber) + { + if (is_null($positiveLedgerNumber)) { + throw new \InvalidArgumentException('non-nullable positiveLedgerNumber cannot be null'); + } + $this->container['positiveLedgerNumber'] = $positiveLedgerNumber; + + return $this; + } + + /** + * Gets negativeLedgerNumber + * + * @return string|null + */ + public function getNegativeLedgerNumber() + { + return $this->container['negativeLedgerNumber']; + } + + /** + * Sets negativeLedgerNumber + * + * @param string|null $negativeLedgerNumber negativeLedgerNumber + * + * @return self + */ + public function setNegativeLedgerNumber($negativeLedgerNumber) + { + if (is_null($negativeLedgerNumber)) { + throw new \InvalidArgumentException('non-nullable negativeLedgerNumber cannot be null'); + } + $this->container['negativeLedgerNumber'] = $negativeLedgerNumber; + + return $this; + } + + /** + * Gets rlbKata + * + * @return bool|null + */ + public function getRlbKata() + { + return $this->container['rlbKata']; + } + + /** + * Sets rlbKata + * + * @param bool|null $rlbKata rlbKata + * + * @return self + */ + public function setRlbKata($rlbKata) + { + if (is_null($rlbKata)) { + throw new \InvalidArgumentException('non-nullable rlbKata cannot be null'); + } + $this->container['rlbKata'] = $rlbKata; + + return $this; + } + + /** + * Gets rlbNote + * + * @return string|null + */ + public function getRlbNote() + { + return $this->container['rlbNote']; + } + + /** + * Sets rlbNote + * + * @param string|null $rlbNote rlbNote + * + * @return self + */ + public function setRlbNote($rlbNote) + { + if (is_null($rlbNote)) { + throw new \InvalidArgumentException('non-nullable rlbNote cannot be null'); + } + $this->container['rlbNote'] = $rlbNote; + + return $this; + } + + /** + * Gets novitaxNaplokod + * + * @return string|null + */ + public function getNovitaxNaplokod() + { + return $this->container['novitaxNaplokod']; + } + + /** + * Sets novitaxNaplokod + * + * @param string|null $novitaxNaplokod novitaxNaplokod + * + * @return self + */ + public function setNovitaxNaplokod($novitaxNaplokod) + { + if (is_null($novitaxNaplokod)) { + throw new \InvalidArgumentException('non-nullable novitaxNaplokod cannot be null'); + } + $this->container['novitaxNaplokod'] = $novitaxNaplokod; + + return $this; + } + + /** + * Gets useGrossValues + * + * @return bool|null + */ + public function getUseGrossValues() + { + return $this->container['useGrossValues']; + } + + /** + * Sets useGrossValues + * + * @param bool|null $useGrossValues useGrossValues + * + * @return self + */ + public function setUseGrossValues($useGrossValues) + { + if (is_null($useGrossValues)) { + throw new \InvalidArgumentException('non-nullable useGrossValues cannot be null'); + } + $this->container['useGrossValues'] = $useGrossValues; + + 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/src/Model/DocumentExportId.php b/src/Model/DocumentExportId.php new file mode 100644 index 0000000..cbf62a7 --- /dev/null +++ b/src/Model/DocumentExportId.php @@ -0,0 +1,410 @@ + + */ +class DocumentExportId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentExportId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + '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 + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + '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' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('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)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $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/src/Model/DocumentExportOtherOptions.php b/src/Model/DocumentExportOtherOptions.php new file mode 100644 index 0000000..311823d --- /dev/null +++ b/src/Model/DocumentExportOtherOptions.php @@ -0,0 +1,66 @@ + + */ +class DocumentExportStatus implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentExportStatus'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'state' => '\Cone\Billingo\Model\DocumentExportStatusState', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'state' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'state' => false, + 'message' => 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', + 'state' => 'state', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'state' => 'setState', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'state' => 'getState', + 'message' => 'getMessage' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); + $this->setIfExists('message', $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)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets state + * + * @return \Cone\Billingo\Model\DocumentExportStatusState|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param \Cone\Billingo\Model\DocumentExportStatusState|null $state state + * + * @return self + */ + public function setState($state) + { + if (is_null($state)) { + throw new \InvalidArgumentException('non-nullable state cannot be null'); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + 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/src/Model/DocumentExportStatusState.php b/src/Model/DocumentExportStatusState.php new file mode 100644 index 0000000..5815807 --- /dev/null +++ b/src/Model/DocumentExportStatusState.php @@ -0,0 +1,72 @@ + + */ +class DocumentInsert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentInsert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'vendorId' => 'string', + 'partnerId' => 'int', + 'blockId' => 'int', + 'bankAccountId' => 'int', + 'type' => '\Cone\Billingo\Model\DocumentInsertType', + 'fulfillmentDate' => '\DateTime', + 'dueDate' => '\DateTime', + 'paymentMethod' => '\Cone\Billingo\Model\PaymentMethod', + 'language' => '\Cone\Billingo\Model\DocumentLanguage', + 'currency' => '\Cone\Billingo\Model\Currency', + 'conversionRate' => 'float', + 'electronic' => 'bool', + 'paid' => 'bool', + 'items' => '\Cone\Billingo\Model\DocumentInsertItemsInner[]', + 'comment' => 'string', + 'settings' => '\Cone\Billingo\Model\DocumentSettings', + 'advanceInvoice' => 'int[]', + 'discount' => '\Cone\Billingo\Model\Discount', + 'instantPayment' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'vendorId' => null, + 'partnerId' => null, + 'blockId' => null, + 'bankAccountId' => null, + 'type' => null, + 'fulfillmentDate' => 'date', + 'dueDate' => 'date', + 'paymentMethod' => null, + 'language' => null, + 'currency' => null, + 'conversionRate' => 'float', + 'electronic' => null, + 'paid' => null, + 'items' => null, + 'comment' => null, + 'settings' => null, + 'advanceInvoice' => null, + 'discount' => null, + 'instantPayment' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'vendorId' => false, + 'partnerId' => false, + 'blockId' => false, + 'bankAccountId' => false, + 'type' => false, + 'fulfillmentDate' => false, + 'dueDate' => false, + 'paymentMethod' => false, + 'language' => false, + 'currency' => false, + 'conversionRate' => false, + 'electronic' => false, + 'paid' => false, + 'items' => false, + 'comment' => false, + 'settings' => false, + 'advanceInvoice' => false, + 'discount' => false, + 'instantPayment' => 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 = [ + 'vendorId' => 'vendor_id', + 'partnerId' => 'partner_id', + 'blockId' => 'block_id', + 'bankAccountId' => 'bank_account_id', + 'type' => 'type', + 'fulfillmentDate' => 'fulfillment_date', + 'dueDate' => 'due_date', + 'paymentMethod' => 'payment_method', + 'language' => 'language', + 'currency' => 'currency', + 'conversionRate' => 'conversion_rate', + 'electronic' => 'electronic', + 'paid' => 'paid', + 'items' => 'items', + 'comment' => 'comment', + 'settings' => 'settings', + 'advanceInvoice' => 'advance_invoice', + 'discount' => 'discount', + 'instantPayment' => 'instant_payment' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'vendorId' => 'setVendorId', + 'partnerId' => 'setPartnerId', + 'blockId' => 'setBlockId', + 'bankAccountId' => 'setBankAccountId', + 'type' => 'setType', + 'fulfillmentDate' => 'setFulfillmentDate', + 'dueDate' => 'setDueDate', + 'paymentMethod' => 'setPaymentMethod', + 'language' => 'setLanguage', + 'currency' => 'setCurrency', + 'conversionRate' => 'setConversionRate', + 'electronic' => 'setElectronic', + 'paid' => 'setPaid', + 'items' => 'setItems', + 'comment' => 'setComment', + 'settings' => 'setSettings', + 'advanceInvoice' => 'setAdvanceInvoice', + 'discount' => 'setDiscount', + 'instantPayment' => 'setInstantPayment' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'vendorId' => 'getVendorId', + 'partnerId' => 'getPartnerId', + 'blockId' => 'getBlockId', + 'bankAccountId' => 'getBankAccountId', + 'type' => 'getType', + 'fulfillmentDate' => 'getFulfillmentDate', + 'dueDate' => 'getDueDate', + 'paymentMethod' => 'getPaymentMethod', + 'language' => 'getLanguage', + 'currency' => 'getCurrency', + 'conversionRate' => 'getConversionRate', + 'electronic' => 'getElectronic', + 'paid' => 'getPaid', + 'items' => 'getItems', + 'comment' => 'getComment', + 'settings' => 'getSettings', + 'advanceInvoice' => 'getAdvanceInvoice', + 'discount' => 'getDiscount', + 'instantPayment' => 'getInstantPayment' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('vendorId', $data ?? [], null); + $this->setIfExists('partnerId', $data ?? [], null); + $this->setIfExists('blockId', $data ?? [], null); + $this->setIfExists('bankAccountId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('fulfillmentDate', $data ?? [], null); + $this->setIfExists('dueDate', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('conversionRate', $data ?? [], null); + $this->setIfExists('electronic', $data ?? [], false); + $this->setIfExists('paid', $data ?? [], false); + $this->setIfExists('items', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('settings', $data ?? [], null); + $this->setIfExists('advanceInvoice', $data ?? [], null); + $this->setIfExists('discount', $data ?? [], null); + $this->setIfExists('instantPayment', $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 ($this->container['partnerId'] === null) { + $invalidProperties[] = "'partnerId' can't be null"; + } + if ($this->container['blockId'] === null) { + $invalidProperties[] = "'blockId' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['fulfillmentDate'] === null) { + $invalidProperties[] = "'fulfillmentDate' can't be null"; + } + if ($this->container['dueDate'] === null) { + $invalidProperties[] = "'dueDate' can't be null"; + } + if ($this->container['paymentMethod'] === null) { + $invalidProperties[] = "'paymentMethod' can't be null"; + } + if ($this->container['language'] === null) { + $invalidProperties[] = "'language' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + 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 vendorId + * + * @return string|null + */ + public function getVendorId() + { + return $this->container['vendorId']; + } + + /** + * Sets vendorId + * + * @param string|null $vendorId vendorId + * + * @return self + */ + public function setVendorId($vendorId) + { + if (is_null($vendorId)) { + throw new \InvalidArgumentException('non-nullable vendorId cannot be null'); + } + $this->container['vendorId'] = $vendorId; + + return $this; + } + + /** + * Gets partnerId + * + * @return int + */ + public function getPartnerId() + { + return $this->container['partnerId']; + } + + /** + * Sets partnerId + * + * @param int $partnerId partnerId + * + * @return self + */ + public function setPartnerId($partnerId) + { + if (is_null($partnerId)) { + throw new \InvalidArgumentException('non-nullable partnerId cannot be null'); + } + $this->container['partnerId'] = $partnerId; + + return $this; + } + + /** + * Gets blockId + * + * @return int + */ + public function getBlockId() + { + return $this->container['blockId']; + } + + /** + * Sets blockId + * + * @param int $blockId blockId + * + * @return self + */ + public function setBlockId($blockId) + { + if (is_null($blockId)) { + throw new \InvalidArgumentException('non-nullable blockId cannot be null'); + } + $this->container['blockId'] = $blockId; + + return $this; + } + + /** + * Gets bankAccountId + * + * @return int|null + */ + public function getBankAccountId() + { + return $this->container['bankAccountId']; + } + + /** + * Sets bankAccountId + * + * @param int|null $bankAccountId bankAccountId + * + * @return self + */ + public function setBankAccountId($bankAccountId) + { + if (is_null($bankAccountId)) { + throw new \InvalidArgumentException('non-nullable bankAccountId cannot be null'); + } + $this->container['bankAccountId'] = $bankAccountId; + + return $this; + } + + /** + * Gets type + * + * @return \Cone\Billingo\Model\DocumentInsertType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Cone\Billingo\Model\DocumentInsertType $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets fulfillmentDate + * + * @return \DateTime + */ + public function getFulfillmentDate() + { + return $this->container['fulfillmentDate']; + } + + /** + * Sets fulfillmentDate + * + * @param \DateTime $fulfillmentDate fulfillmentDate + * + * @return self + */ + public function setFulfillmentDate($fulfillmentDate) + { + if (is_null($fulfillmentDate)) { + throw new \InvalidArgumentException('non-nullable fulfillmentDate cannot be null'); + } + $this->container['fulfillmentDate'] = $fulfillmentDate; + + return $this; + } + + /** + * Gets dueDate + * + * @return \DateTime + */ + public function getDueDate() + { + return $this->container['dueDate']; + } + + /** + * Sets dueDate + * + * @param \DateTime $dueDate dueDate + * + * @return self + */ + public function setDueDate($dueDate) + { + if (is_null($dueDate)) { + throw new \InvalidArgumentException('non-nullable dueDate cannot be null'); + } + $this->container['dueDate'] = $dueDate; + + return $this; + } + + /** + * Gets paymentMethod + * + * @return \Cone\Billingo\Model\PaymentMethod + */ + public function getPaymentMethod() + { + return $this->container['paymentMethod']; + } + + /** + * Sets paymentMethod + * + * @param \Cone\Billingo\Model\PaymentMethod $paymentMethod paymentMethod + * + * @return self + */ + public function setPaymentMethod($paymentMethod) + { + if (is_null($paymentMethod)) { + throw new \InvalidArgumentException('non-nullable paymentMethod cannot be null'); + } + $this->container['paymentMethod'] = $paymentMethod; + + return $this; + } + + /** + * Gets language + * + * @return \Cone\Billingo\Model\DocumentLanguage + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param \Cone\Billingo\Model\DocumentLanguage $language language + * + * @return self + */ + public function setLanguage($language) + { + if (is_null($language)) { + throw new \InvalidArgumentException('non-nullable language cannot be null'); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets currency + * + * @return \Cone\Billingo\Model\Currency + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Cone\Billingo\Model\Currency $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets conversionRate + * + * @return float|null + */ + public function getConversionRate() + { + return $this->container['conversionRate']; + } + + /** + * Sets conversionRate + * + * @param float|null $conversionRate conversionRate + * + * @return self + */ + public function setConversionRate($conversionRate) + { + if (is_null($conversionRate)) { + throw new \InvalidArgumentException('non-nullable conversionRate cannot be null'); + } + $this->container['conversionRate'] = $conversionRate; + + return $this; + } + + /** + * Gets electronic + * + * @return bool|null + */ + public function getElectronic() + { + return $this->container['electronic']; + } + + /** + * Sets electronic + * + * @param bool|null $electronic electronic + * + * @return self + */ + public function setElectronic($electronic) + { + if (is_null($electronic)) { + throw new \InvalidArgumentException('non-nullable electronic cannot be null'); + } + $this->container['electronic'] = $electronic; + + return $this; + } + + /** + * Gets paid + * + * @return bool|null + */ + public function getPaid() + { + return $this->container['paid']; + } + + /** + * Sets paid + * + * @param bool|null $paid paid + * + * @return self + */ + public function setPaid($paid) + { + if (is_null($paid)) { + throw new \InvalidArgumentException('non-nullable paid cannot be null'); + } + $this->container['paid'] = $paid; + + return $this; + } + + /** + * Gets items + * + * @return \Cone\Billingo\Model\DocumentInsertItemsInner[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Cone\Billingo\Model\DocumentInsertItemsInner[]|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 comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + throw new \InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets settings + * + * @return \Cone\Billingo\Model\DocumentSettings|null + */ + public function getSettings() + { + return $this->container['settings']; + } + + /** + * Sets settings + * + * @param \Cone\Billingo\Model\DocumentSettings|null $settings settings + * + * @return self + */ + public function setSettings($settings) + { + if (is_null($settings)) { + throw new \InvalidArgumentException('non-nullable settings cannot be null'); + } + $this->container['settings'] = $settings; + + return $this; + } + + /** + * Gets advanceInvoice + * + * @return int[]|null + */ + public function getAdvanceInvoice() + { + return $this->container['advanceInvoice']; + } + + /** + * Sets advanceInvoice + * + * @param int[]|null $advanceInvoice advanceInvoice + * + * @return self + */ + public function setAdvanceInvoice($advanceInvoice) + { + if (is_null($advanceInvoice)) { + throw new \InvalidArgumentException('non-nullable advanceInvoice cannot be null'); + } + $this->container['advanceInvoice'] = $advanceInvoice; + + return $this; + } + + /** + * Gets discount + * + * @return \Cone\Billingo\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \Cone\Billingo\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + return $this; + } + + /** + * Gets instantPayment + * + * @return bool|null + */ + public function getInstantPayment() + { + return $this->container['instantPayment']; + } + + /** + * Sets instantPayment + * + * @param bool|null $instantPayment instantPayment + * + * @return self + */ + public function setInstantPayment($instantPayment) + { + if (is_null($instantPayment)) { + throw new \InvalidArgumentException('non-nullable instantPayment cannot be null'); + } + $this->container['instantPayment'] = $instantPayment; + + 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/src/Model/DocumentInsertItemsInner.php b/src/Model/DocumentInsertItemsInner.php new file mode 100644 index 0000000..cc19bd2 --- /dev/null +++ b/src/Model/DocumentInsertItemsInner.php @@ -0,0 +1,703 @@ + + */ +class DocumentInsertItemsInner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentInsert_items_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'productId' => 'int', + 'quantity' => 'float', + 'comment' => 'string', + 'name' => 'string', + 'unitPrice' => 'float', + 'unitPriceType' => '\Cone\Billingo\Model\UnitPriceType', + 'unit' => 'string', + 'vat' => '\Cone\Billingo\Model\Vat', + 'entitlement' => '\Cone\Billingo\Model\Entitlement' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'productId' => null, + 'quantity' => 'float', + 'comment' => null, + 'name' => null, + 'unitPrice' => 'float', + 'unitPriceType' => null, + 'unit' => null, + 'vat' => null, + 'entitlement' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'productId' => false, + 'quantity' => false, + 'comment' => false, + 'name' => false, + 'unitPrice' => false, + 'unitPriceType' => false, + 'unit' => false, + 'vat' => false, + 'entitlement' => 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 = [ + 'productId' => 'product_id', + 'quantity' => 'quantity', + 'comment' => 'comment', + 'name' => 'name', + 'unitPrice' => 'unit_price', + 'unitPriceType' => 'unit_price_type', + 'unit' => 'unit', + 'vat' => 'vat', + 'entitlement' => 'entitlement' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'productId' => 'setProductId', + 'quantity' => 'setQuantity', + 'comment' => 'setComment', + 'name' => 'setName', + 'unitPrice' => 'setUnitPrice', + 'unitPriceType' => 'setUnitPriceType', + 'unit' => 'setUnit', + 'vat' => 'setVat', + 'entitlement' => 'setEntitlement' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'productId' => 'getProductId', + 'quantity' => 'getQuantity', + 'comment' => 'getComment', + 'name' => 'getName', + 'unitPrice' => 'getUnitPrice', + 'unitPriceType' => 'getUnitPriceType', + 'unit' => 'getUnit', + 'vat' => 'getVat', + 'entitlement' => 'getEntitlement' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('unitPrice', $data ?? [], null); + $this->setIfExists('unitPriceType', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('vat', $data ?? [], null); + $this->setIfExists('entitlement', $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 ($this->container['productId'] === null) { + $invalidProperties[] = "'productId' can't be null"; + } + if ($this->container['quantity'] === null) { + $invalidProperties[] = "'quantity' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['unitPrice'] === null) { + $invalidProperties[] = "'unitPrice' can't be null"; + } + if ($this->container['unitPriceType'] === null) { + $invalidProperties[] = "'unitPriceType' can't be null"; + } + if ($this->container['unit'] === null) { + $invalidProperties[] = "'unit' can't be null"; + } + if ($this->container['vat'] === null) { + $invalidProperties[] = "'vat' can't be null"; + } + 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 productId + * + * @return int + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param int $productId productId + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets quantity + * + * @return float + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param float $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + throw new \InvalidArgumentException('non-nullable quantity cannot be null'); + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + throw new \InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets unitPrice + * + * @return float + */ + public function getUnitPrice() + { + return $this->container['unitPrice']; + } + + /** + * Sets unitPrice + * + * @param float $unitPrice unitPrice + * + * @return self + */ + public function setUnitPrice($unitPrice) + { + if (is_null($unitPrice)) { + throw new \InvalidArgumentException('non-nullable unitPrice cannot be null'); + } + $this->container['unitPrice'] = $unitPrice; + + return $this; + } + + /** + * Gets unitPriceType + * + * @return \Cone\Billingo\Model\UnitPriceType + */ + public function getUnitPriceType() + { + return $this->container['unitPriceType']; + } + + /** + * Sets unitPriceType + * + * @param \Cone\Billingo\Model\UnitPriceType $unitPriceType unitPriceType + * + * @return self + */ + public function setUnitPriceType($unitPriceType) + { + if (is_null($unitPriceType)) { + throw new \InvalidArgumentException('non-nullable unitPriceType cannot be null'); + } + $this->container['unitPriceType'] = $unitPriceType; + + return $this; + } + + /** + * Gets unit + * + * @return string + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string $unit unit + * + * @return self + */ + public function setUnit($unit) + { + if (is_null($unit)) { + throw new \InvalidArgumentException('non-nullable unit cannot be null'); + } + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets vat + * + * @return \Cone\Billingo\Model\Vat + */ + public function getVat() + { + return $this->container['vat']; + } + + /** + * Sets vat + * + * @param \Cone\Billingo\Model\Vat $vat 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 entitlement + * + * @return \Cone\Billingo\Model\Entitlement|null + */ + public function getEntitlement() + { + return $this->container['entitlement']; + } + + /** + * Sets entitlement + * + * @param \Cone\Billingo\Model\Entitlement|null $entitlement entitlement + * + * @return self + */ + public function setEntitlement($entitlement) + { + if (is_null($entitlement)) { + throw new \InvalidArgumentException('non-nullable entitlement cannot be null'); + } + $this->container['entitlement'] = $entitlement; + + 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/src/Model/DocumentInsertType.php b/src/Model/DocumentInsertType.php new file mode 100644 index 0000000..5b8fe39 --- /dev/null +++ b/src/Model/DocumentInsertType.php @@ -0,0 +1,69 @@ + + */ +class DocumentItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'productId' => 'int', + 'name' => 'string', + 'netUnitAmount' => 'float', + 'quantity' => 'float', + 'unit' => 'string', + 'netAmount' => 'float', + 'grossAmount' => 'float', + 'vat' => '\Cone\Billingo\Model\Vat', + 'vatAmount' => 'float', + 'entitlement' => '\Cone\Billingo\Model\Entitlement', + 'comment' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'productId' => null, + 'name' => null, + 'netUnitAmount' => 'float', + 'quantity' => 'float', + 'unit' => null, + 'netAmount' => 'float', + 'grossAmount' => 'float', + 'vat' => null, + 'vatAmount' => 'float', + 'entitlement' => null, + 'comment' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'productId' => true, + 'name' => false, + 'netUnitAmount' => false, + 'quantity' => false, + 'unit' => false, + 'netAmount' => false, + 'grossAmount' => false, + 'vat' => false, + 'vatAmount' => false, + 'entitlement' => false, + 'comment' => 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 = [ + 'productId' => 'product_id', + 'name' => 'name', + 'netUnitAmount' => 'net_unit_amount', + 'quantity' => 'quantity', + 'unit' => 'unit', + 'netAmount' => 'net_amount', + 'grossAmount' => 'gross_amount', + 'vat' => 'vat', + 'vatAmount' => 'vat_amount', + 'entitlement' => 'entitlement', + 'comment' => 'comment' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'productId' => 'setProductId', + 'name' => 'setName', + 'netUnitAmount' => 'setNetUnitAmount', + 'quantity' => 'setQuantity', + 'unit' => 'setUnit', + 'netAmount' => 'setNetAmount', + 'grossAmount' => 'setGrossAmount', + 'vat' => 'setVat', + 'vatAmount' => 'setVatAmount', + 'entitlement' => 'setEntitlement', + 'comment' => 'setComment' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'productId' => 'getProductId', + 'name' => 'getName', + 'netUnitAmount' => 'getNetUnitAmount', + 'quantity' => 'getQuantity', + 'unit' => 'getUnit', + 'netAmount' => 'getNetAmount', + 'grossAmount' => 'getGrossAmount', + 'vat' => 'getVat', + 'vatAmount' => 'getVatAmount', + 'entitlement' => 'getEntitlement', + 'comment' => 'getComment' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('netUnitAmount', $data ?? [], null); + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('netAmount', $data ?? [], null); + $this->setIfExists('grossAmount', $data ?? [], null); + $this->setIfExists('vat', $data ?? [], null); + $this->setIfExists('vatAmount', $data ?? [], null); + $this->setIfExists('entitlement', $data ?? [], null); + $this->setIfExists('comment', $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 productId + * + * @return int|null + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param int|null $productId productId + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + array_push($this->openAPINullablesSetToNull, 'productId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('productId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['productId'] = $productId; + + 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)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets netUnitAmount + * + * @return float|null + */ + public function getNetUnitAmount() + { + return $this->container['netUnitAmount']; + } + + /** + * Sets netUnitAmount + * + * @param float|null $netUnitAmount netUnitAmount + * + * @return self + */ + public function setNetUnitAmount($netUnitAmount) + { + if (is_null($netUnitAmount)) { + throw new \InvalidArgumentException('non-nullable netUnitAmount cannot be null'); + } + $this->container['netUnitAmount'] = $netUnitAmount; + + return $this; + } + + /** + * Gets quantity + * + * @return float|null + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param float|null $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + throw new \InvalidArgumentException('non-nullable quantity cannot be null'); + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets unit + * + * @return string|null + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string|null $unit unit + * + * @return self + */ + public function setUnit($unit) + { + if (is_null($unit)) { + throw new \InvalidArgumentException('non-nullable unit cannot be null'); + } + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets netAmount + * + * @return float|null + */ + public function getNetAmount() + { + return $this->container['netAmount']; + } + + /** + * Sets netAmount + * + * @param float|null $netAmount netAmount + * + * @return self + */ + public function setNetAmount($netAmount) + { + if (is_null($netAmount)) { + throw new \InvalidArgumentException('non-nullable netAmount cannot be null'); + } + $this->container['netAmount'] = $netAmount; + + return $this; + } + + /** + * Gets grossAmount + * + * @return float|null + */ + public function getGrossAmount() + { + return $this->container['grossAmount']; + } + + /** + * Sets grossAmount + * + * @param float|null $grossAmount grossAmount + * + * @return self + */ + public function setGrossAmount($grossAmount) + { + if (is_null($grossAmount)) { + throw new \InvalidArgumentException('non-nullable grossAmount cannot be null'); + } + $this->container['grossAmount'] = $grossAmount; + + return $this; + } + + /** + * Gets vat + * + * @return \Cone\Billingo\Model\Vat|null + */ + public function getVat() + { + return $this->container['vat']; + } + + /** + * Sets vat + * + * @param \Cone\Billingo\Model\Vat|null $vat 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 vatAmount + * + * @return float|null + */ + public function getVatAmount() + { + return $this->container['vatAmount']; + } + + /** + * Sets vatAmount + * + * @param float|null $vatAmount vatAmount + * + * @return self + */ + public function setVatAmount($vatAmount) + { + if (is_null($vatAmount)) { + throw new \InvalidArgumentException('non-nullable vatAmount cannot be null'); + } + $this->container['vatAmount'] = $vatAmount; + + return $this; + } + + /** + * Gets entitlement + * + * @return \Cone\Billingo\Model\Entitlement|null + */ + public function getEntitlement() + { + return $this->container['entitlement']; + } + + /** + * Sets entitlement + * + * @param \Cone\Billingo\Model\Entitlement|null $entitlement entitlement + * + * @return self + */ + public function setEntitlement($entitlement) + { + if (is_null($entitlement)) { + throw new \InvalidArgumentException('non-nullable entitlement cannot be null'); + } + $this->container['entitlement'] = $entitlement; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + throw new \InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + 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/src/Model/DocumentItemData.php b/src/Model/DocumentItemData.php new file mode 100644 index 0000000..c38f7c0 --- /dev/null +++ b/src/Model/DocumentItemData.php @@ -0,0 +1,484 @@ + + */ +class DocumentItemData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentItemData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'productId' => 'int', + 'quantity' => 'float', + 'comment' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'productId' => null, + 'quantity' => 'float', + 'comment' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'productId' => false, + 'quantity' => false, + 'comment' => 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 = [ + 'productId' => 'product_id', + 'quantity' => 'quantity', + 'comment' => 'comment' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'productId' => 'setProductId', + 'quantity' => 'setQuantity', + 'comment' => 'setComment' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'productId' => 'getProductId', + 'quantity' => 'getQuantity', + 'comment' => 'getComment' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('comment', $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 ($this->container['productId'] === null) { + $invalidProperties[] = "'productId' can't be null"; + } + if ($this->container['quantity'] === null) { + $invalidProperties[] = "'quantity' can't be null"; + } + 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 productId + * + * @return int + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param int $productId productId + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + return $this; + } + + /** + * Gets quantity + * + * @return float + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param float $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + throw new \InvalidArgumentException('non-nullable quantity cannot be null'); + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + throw new \InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + 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/src/Model/DocumentLanguage.php b/src/Model/DocumentLanguage.php new file mode 100644 index 0000000..d85d054 --- /dev/null +++ b/src/Model/DocumentLanguage.php @@ -0,0 +1,84 @@ + + */ +class DocumentList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Cone\Billingo\Model\Document[]', + 'total' => 'int', + 'perPage' => 'int', + 'currentPage' => 'int', + 'lastPage' => 'int', + 'prevPageUrl' => 'string', + 'nextPageUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'total' => null, + 'perPage' => null, + 'currentPage' => null, + 'lastPage' => null, + 'prevPageUrl' => null, + 'nextPageUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'total' => false, + 'perPage' => false, + 'currentPage' => false, + 'lastPage' => false, + 'prevPageUrl' => false, + 'nextPageUrl' => 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 = [ + 'data' => 'data', + 'total' => 'total', + 'perPage' => 'per_page', + 'currentPage' => 'current_page', + 'lastPage' => 'last_page', + 'prevPageUrl' => 'prev_page_url', + 'nextPageUrl' => 'next_page_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'total' => 'setTotal', + 'perPage' => 'setPerPage', + 'currentPage' => 'setCurrentPage', + 'lastPage' => 'setLastPage', + 'prevPageUrl' => 'setPrevPageUrl', + 'nextPageUrl' => 'setNextPageUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'total' => 'getTotal', + 'perPage' => 'getPerPage', + 'currentPage' => 'getCurrentPage', + 'lastPage' => 'getLastPage', + 'prevPageUrl' => 'getPrevPageUrl', + 'nextPageUrl' => 'getNextPageUrl' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('perPage', $data ?? [], null); + $this->setIfExists('currentPage', $data ?? [], null); + $this->setIfExists('lastPage', $data ?? [], null); + $this->setIfExists('prevPageUrl', $data ?? [], null); + $this->setIfExists('nextPageUrl', $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 data + * + * @return \Cone\Billingo\Model\Document[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Cone\Billingo\Model\Document[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total 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; + } + + /** + * Gets perPage + * + * @return int|null + */ + public function getPerPage() + { + return $this->container['perPage']; + } + + /** + * Sets perPage + * + * @param int|null $perPage perPage + * + * @return self + */ + public function setPerPage($perPage) + { + if (is_null($perPage)) { + throw new \InvalidArgumentException('non-nullable perPage cannot be null'); + } + $this->container['perPage'] = $perPage; + + return $this; + } + + /** + * Gets currentPage + * + * @return int|null + */ + public function getCurrentPage() + { + return $this->container['currentPage']; + } + + /** + * Sets currentPage + * + * @param int|null $currentPage currentPage + * + * @return self + */ + public function setCurrentPage($currentPage) + { + if (is_null($currentPage)) { + throw new \InvalidArgumentException('non-nullable currentPage cannot be null'); + } + $this->container['currentPage'] = $currentPage; + + return $this; + } + + /** + * Gets lastPage + * + * @return int|null + */ + public function getLastPage() + { + return $this->container['lastPage']; + } + + /** + * Sets lastPage + * + * @param int|null $lastPage lastPage + * + * @return self + */ + public function setLastPage($lastPage) + { + if (is_null($lastPage)) { + throw new \InvalidArgumentException('non-nullable lastPage cannot be null'); + } + $this->container['lastPage'] = $lastPage; + + return $this; + } + + /** + * Gets prevPageUrl + * + * @return string|null + */ + public function getPrevPageUrl() + { + return $this->container['prevPageUrl']; + } + + /** + * Sets prevPageUrl + * + * @param string|null $prevPageUrl prevPageUrl + * + * @return self + */ + public function setPrevPageUrl($prevPageUrl) + { + if (is_null($prevPageUrl)) { + throw new \InvalidArgumentException('non-nullable prevPageUrl cannot be null'); + } + $this->container['prevPageUrl'] = $prevPageUrl; + + return $this; + } + + /** + * Gets nextPageUrl + * + * @return string|null + */ + public function getNextPageUrl() + { + return $this->container['nextPageUrl']; + } + + /** + * Sets nextPageUrl + * + * @param string|null $nextPageUrl nextPageUrl + * + * @return self + */ + public function setNextPageUrl($nextPageUrl) + { + if (is_null($nextPageUrl)) { + throw new \InvalidArgumentException('non-nullable nextPageUrl cannot be null'); + } + $this->container['nextPageUrl'] = $nextPageUrl; + + 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/src/Model/DocumentNotificationStatus.php b/src/Model/DocumentNotificationStatus.php new file mode 100644 index 0000000..6bb952c --- /dev/null +++ b/src/Model/DocumentNotificationStatus.php @@ -0,0 +1,75 @@ + + */ +class DocumentOrganization implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentOrganization'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'taxNumber' => 'string', + 'bankAccount' => '\Cone\Billingo\Model\DocumentBankAccount', + 'address' => '\Cone\Billingo\Model\Address', + 'smallTaxpayer' => 'bool', + 'evNumber' => 'string', + 'euTaxNumber' => 'string', + 'cashSettled' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'taxNumber' => null, + 'bankAccount' => null, + 'address' => null, + 'smallTaxpayer' => null, + 'evNumber' => null, + 'euTaxNumber' => null, + 'cashSettled' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'taxNumber' => false, + 'bankAccount' => false, + 'address' => false, + 'smallTaxpayer' => false, + 'evNumber' => false, + 'euTaxNumber' => false, + 'cashSettled' => 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 = [ + 'name' => 'name', + 'taxNumber' => 'tax_number', + 'bankAccount' => 'bank_account', + 'address' => 'address', + 'smallTaxpayer' => 'small_taxpayer', + 'evNumber' => 'ev_number', + 'euTaxNumber' => 'eu_tax_number', + 'cashSettled' => 'cash_settled' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'taxNumber' => 'setTaxNumber', + 'bankAccount' => 'setBankAccount', + 'address' => 'setAddress', + 'smallTaxpayer' => 'setSmallTaxpayer', + 'evNumber' => 'setEvNumber', + 'euTaxNumber' => 'setEuTaxNumber', + 'cashSettled' => 'setCashSettled' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'taxNumber' => 'getTaxNumber', + 'bankAccount' => 'getBankAccount', + 'address' => 'getAddress', + 'smallTaxpayer' => 'getSmallTaxpayer', + 'evNumber' => 'getEvNumber', + 'euTaxNumber' => 'getEuTaxNumber', + 'cashSettled' => 'getCashSettled' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('taxNumber', $data ?? [], null); + $this->setIfExists('bankAccount', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('smallTaxpayer', $data ?? [], null); + $this->setIfExists('evNumber', $data ?? [], null); + $this->setIfExists('euTaxNumber', $data ?? [], null); + $this->setIfExists('cashSettled', $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 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)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets taxNumber + * + * @return string|null + */ + public function getTaxNumber() + { + return $this->container['taxNumber']; + } + + /** + * Sets taxNumber + * + * @param string|null $taxNumber taxNumber + * + * @return self + */ + public function setTaxNumber($taxNumber) + { + if (is_null($taxNumber)) { + throw new \InvalidArgumentException('non-nullable taxNumber cannot be null'); + } + $this->container['taxNumber'] = $taxNumber; + + return $this; + } + + /** + * Gets bankAccount + * + * @return \Cone\Billingo\Model\DocumentBankAccount|null + */ + public function getBankAccount() + { + return $this->container['bankAccount']; + } + + /** + * Sets bankAccount + * + * @param \Cone\Billingo\Model\DocumentBankAccount|null $bankAccount bankAccount + * + * @return self + */ + public function setBankAccount($bankAccount) + { + if (is_null($bankAccount)) { + throw new \InvalidArgumentException('non-nullable bankAccount cannot be null'); + } + $this->container['bankAccount'] = $bankAccount; + + return $this; + } + + /** + * Gets address + * + * @return \Cone\Billingo\Model\Address|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \Cone\Billingo\Model\Address|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + throw new \InvalidArgumentException('non-nullable address cannot be null'); + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets smallTaxpayer + * + * @return bool|null + */ + public function getSmallTaxpayer() + { + return $this->container['smallTaxpayer']; + } + + /** + * Sets smallTaxpayer + * + * @param bool|null $smallTaxpayer smallTaxpayer + * + * @return self + */ + public function setSmallTaxpayer($smallTaxpayer) + { + if (is_null($smallTaxpayer)) { + throw new \InvalidArgumentException('non-nullable smallTaxpayer cannot be null'); + } + $this->container['smallTaxpayer'] = $smallTaxpayer; + + return $this; + } + + /** + * Gets evNumber + * + * @return string|null + */ + public function getEvNumber() + { + return $this->container['evNumber']; + } + + /** + * Sets evNumber + * + * @param string|null $evNumber evNumber + * + * @return self + */ + public function setEvNumber($evNumber) + { + if (is_null($evNumber)) { + throw new \InvalidArgumentException('non-nullable evNumber cannot be null'); + } + $this->container['evNumber'] = $evNumber; + + return $this; + } + + /** + * Gets euTaxNumber + * + * @return string|null + */ + public function getEuTaxNumber() + { + return $this->container['euTaxNumber']; + } + + /** + * Sets euTaxNumber + * + * @param string|null $euTaxNumber euTaxNumber + * + * @return self + */ + public function setEuTaxNumber($euTaxNumber) + { + if (is_null($euTaxNumber)) { + throw new \InvalidArgumentException('non-nullable euTaxNumber cannot be null'); + } + $this->container['euTaxNumber'] = $euTaxNumber; + + return $this; + } + + /** + * Gets cashSettled + * + * @return bool|null + */ + public function getCashSettled() + { + return $this->container['cashSettled']; + } + + /** + * Sets cashSettled + * + * @param bool|null $cashSettled cashSettled + * + * @return self + */ + public function setCashSettled($cashSettled) + { + if (is_null($cashSettled)) { + throw new \InvalidArgumentException('non-nullable cashSettled cannot be null'); + } + $this->container['cashSettled'] = $cashSettled; + + 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/src/Model/DocumentPartner.php b/src/Model/DocumentPartner.php new file mode 100644 index 0000000..6ffb7c5 --- /dev/null +++ b/src/Model/DocumentPartner.php @@ -0,0 +1,716 @@ + + */ +class DocumentPartner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentPartner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'address' => '\Cone\Billingo\Model\Address', + 'emails' => 'string[]', + 'taxcode' => 'string', + 'iban' => 'string', + 'swift' => 'string', + 'accountNumber' => 'string', + 'phone' => 'string', + 'taxType' => '\Cone\Billingo\Model\PartnerTaxType' + ]; + + /** + * 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, + 'address' => null, + 'emails' => null, + 'taxcode' => null, + 'iban' => null, + 'swift' => null, + 'accountNumber' => null, + 'phone' => null, + 'taxType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'address' => false, + 'emails' => false, + 'taxcode' => false, + 'iban' => false, + 'swift' => false, + 'accountNumber' => false, + 'phone' => false, + 'taxType' => 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', + 'name' => 'name', + 'address' => 'address', + 'emails' => 'emails', + 'taxcode' => 'taxcode', + 'iban' => 'iban', + 'swift' => 'swift', + 'accountNumber' => 'account_number', + 'phone' => 'phone', + 'taxType' => 'tax_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'address' => 'setAddress', + 'emails' => 'setEmails', + 'taxcode' => 'setTaxcode', + 'iban' => 'setIban', + 'swift' => 'setSwift', + 'accountNumber' => 'setAccountNumber', + 'phone' => 'setPhone', + 'taxType' => 'setTaxType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'address' => 'getAddress', + 'emails' => 'getEmails', + 'taxcode' => 'getTaxcode', + 'iban' => 'getIban', + 'swift' => 'getSwift', + 'accountNumber' => 'getAccountNumber', + 'phone' => 'getPhone', + 'taxType' => 'getTaxType' + ]; + + /** + * 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[] $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('address', $data ?? [], null); + $this->setIfExists('emails', $data ?? [], null); + $this->setIfExists('taxcode', $data ?? [], null); + $this->setIfExists('iban', $data ?? [], null); + $this->setIfExists('swift', $data ?? [], null); + $this->setIfExists('accountNumber', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('taxType', $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 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)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets address + * + * @return \Cone\Billingo\Model\Address|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \Cone\Billingo\Model\Address|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + throw new \InvalidArgumentException('non-nullable address cannot be null'); + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets emails + * + * @return string[]|null + */ + public function getEmails() + { + return $this->container['emails']; + } + + /** + * Sets emails + * + * @param string[]|null $emails emails + * + * @return self + */ + public function setEmails($emails) + { + if (is_null($emails)) { + throw new \InvalidArgumentException('non-nullable emails cannot be null'); + } + $this->container['emails'] = $emails; + + return $this; + } + + /** + * Gets taxcode + * + * @return string|null + */ + public function getTaxcode() + { + return $this->container['taxcode']; + } + + /** + * Sets taxcode + * + * @param string|null $taxcode taxcode + * + * @return self + */ + public function setTaxcode($taxcode) + { + if (is_null($taxcode)) { + throw new \InvalidArgumentException('non-nullable taxcode cannot be null'); + } + $this->container['taxcode'] = $taxcode; + + return $this; + } + + /** + * Gets iban + * + * @return string|null + */ + public function getIban() + { + return $this->container['iban']; + } + + /** + * Sets iban + * + * @param string|null $iban iban + * + * @return self + */ + public function setIban($iban) + { + if (is_null($iban)) { + throw new \InvalidArgumentException('non-nullable iban cannot be null'); + } + $this->container['iban'] = $iban; + + return $this; + } + + /** + * Gets swift + * + * @return string|null + */ + public function getSwift() + { + return $this->container['swift']; + } + + /** + * Sets swift + * + * @param string|null $swift swift + * + * @return self + */ + public function setSwift($swift) + { + if (is_null($swift)) { + throw new \InvalidArgumentException('non-nullable swift cannot be null'); + } + $this->container['swift'] = $swift; + + return $this; + } + + /** + * Gets accountNumber + * + * @return string|null + */ + public function getAccountNumber() + { + return $this->container['accountNumber']; + } + + /** + * Sets accountNumber + * + * @param string|null $accountNumber accountNumber + * + * @return self + */ + public function setAccountNumber($accountNumber) + { + if (is_null($accountNumber)) { + throw new \InvalidArgumentException('non-nullable accountNumber cannot be null'); + } + $this->container['accountNumber'] = $accountNumber; + + 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)) { + throw new \InvalidArgumentException('non-nullable phone cannot be null'); + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets taxType + * + * @return \Cone\Billingo\Model\PartnerTaxType|null + */ + public function getTaxType() + { + return $this->container['taxType']; + } + + /** + * Sets taxType + * + * @param \Cone\Billingo\Model\PartnerTaxType|null $taxType taxType + * + * @return self + */ + public function setTaxType($taxType) + { + if (is_null($taxType)) { + throw new \InvalidArgumentException('non-nullable taxType cannot be null'); + } + $this->container['taxType'] = $taxType; + + 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/src/Model/DocumentProductData.php b/src/Model/DocumentProductData.php new file mode 100644 index 0000000..2a22d6f --- /dev/null +++ b/src/Model/DocumentProductData.php @@ -0,0 +1,666 @@ + + */ +class DocumentProductData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentProductData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'unitPrice' => 'float', + 'unitPriceType' => '\Cone\Billingo\Model\UnitPriceType', + 'quantity' => 'float', + 'unit' => 'string', + 'vat' => '\Cone\Billingo\Model\Vat', + 'comment' => 'string', + 'entitlement' => '\Cone\Billingo\Model\Entitlement' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'unitPrice' => 'float', + 'unitPriceType' => null, + 'quantity' => 'float', + 'unit' => null, + 'vat' => null, + 'comment' => null, + 'entitlement' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'unitPrice' => false, + 'unitPriceType' => false, + 'quantity' => false, + 'unit' => false, + 'vat' => false, + 'comment' => false, + 'entitlement' => 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 = [ + 'name' => 'name', + 'unitPrice' => 'unit_price', + 'unitPriceType' => 'unit_price_type', + 'quantity' => 'quantity', + 'unit' => 'unit', + 'vat' => 'vat', + 'comment' => 'comment', + 'entitlement' => 'entitlement' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'unitPrice' => 'setUnitPrice', + 'unitPriceType' => 'setUnitPriceType', + 'quantity' => 'setQuantity', + 'unit' => 'setUnit', + 'vat' => 'setVat', + 'comment' => 'setComment', + 'entitlement' => 'setEntitlement' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'unitPrice' => 'getUnitPrice', + 'unitPriceType' => 'getUnitPriceType', + 'quantity' => 'getQuantity', + 'unit' => 'getUnit', + 'vat' => 'getVat', + 'comment' => 'getComment', + 'entitlement' => 'getEntitlement' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('unitPrice', $data ?? [], null); + $this->setIfExists('unitPriceType', $data ?? [], null); + $this->setIfExists('quantity', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('vat', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('entitlement', $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 ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['unitPrice'] === null) { + $invalidProperties[] = "'unitPrice' can't be null"; + } + if ($this->container['unitPriceType'] === null) { + $invalidProperties[] = "'unitPriceType' can't be null"; + } + if ($this->container['quantity'] === null) { + $invalidProperties[] = "'quantity' can't be null"; + } + if ($this->container['unit'] === null) { + $invalidProperties[] = "'unit' can't be null"; + } + if ($this->container['vat'] === null) { + $invalidProperties[] = "'vat' can't be null"; + } + 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 name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets unitPrice + * + * @return float + */ + public function getUnitPrice() + { + return $this->container['unitPrice']; + } + + /** + * Sets unitPrice + * + * @param float $unitPrice unitPrice + * + * @return self + */ + public function setUnitPrice($unitPrice) + { + if (is_null($unitPrice)) { + throw new \InvalidArgumentException('non-nullable unitPrice cannot be null'); + } + $this->container['unitPrice'] = $unitPrice; + + return $this; + } + + /** + * Gets unitPriceType + * + * @return \Cone\Billingo\Model\UnitPriceType + */ + public function getUnitPriceType() + { + return $this->container['unitPriceType']; + } + + /** + * Sets unitPriceType + * + * @param \Cone\Billingo\Model\UnitPriceType $unitPriceType unitPriceType + * + * @return self + */ + public function setUnitPriceType($unitPriceType) + { + if (is_null($unitPriceType)) { + throw new \InvalidArgumentException('non-nullable unitPriceType cannot be null'); + } + $this->container['unitPriceType'] = $unitPriceType; + + return $this; + } + + /** + * Gets quantity + * + * @return float + */ + public function getQuantity() + { + return $this->container['quantity']; + } + + /** + * Sets quantity + * + * @param float $quantity quantity + * + * @return self + */ + public function setQuantity($quantity) + { + if (is_null($quantity)) { + throw new \InvalidArgumentException('non-nullable quantity cannot be null'); + } + $this->container['quantity'] = $quantity; + + return $this; + } + + /** + * Gets unit + * + * @return string + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string $unit unit + * + * @return self + */ + public function setUnit($unit) + { + if (is_null($unit)) { + throw new \InvalidArgumentException('non-nullable unit cannot be null'); + } + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets vat + * + * @return \Cone\Billingo\Model\Vat + */ + public function getVat() + { + return $this->container['vat']; + } + + /** + * Sets vat + * + * @param \Cone\Billingo\Model\Vat $vat 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 comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + throw new \InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets entitlement + * + * @return \Cone\Billingo\Model\Entitlement|null + */ + public function getEntitlement() + { + return $this->container['entitlement']; + } + + /** + * Sets entitlement + * + * @param \Cone\Billingo\Model\Entitlement|null $entitlement entitlement + * + * @return self + */ + public function setEntitlement($entitlement) + { + if (is_null($entitlement)) { + throw new \InvalidArgumentException('non-nullable entitlement cannot be null'); + } + $this->container['entitlement'] = $entitlement; + + 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/src/Model/DocumentPublicUrl.php b/src/Model/DocumentPublicUrl.php new file mode 100644 index 0000000..3aed422 --- /dev/null +++ b/src/Model/DocumentPublicUrl.php @@ -0,0 +1,410 @@ + + */ +class DocumentPublicUrl implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentPublicUrl'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'publicUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'publicUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'publicUrl' => 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 = [ + 'publicUrl' => 'public_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'publicUrl' => 'setPublicUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'publicUrl' => 'getPublicUrl' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('publicUrl', $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 publicUrl + * + * @return string|null + */ + public function getPublicUrl() + { + return $this->container['publicUrl']; + } + + /** + * Sets publicUrl + * + * @param string|null $publicUrl publicUrl + * + * @return self + */ + public function setPublicUrl($publicUrl) + { + if (is_null($publicUrl)) { + throw new \InvalidArgumentException('non-nullable publicUrl cannot be null'); + } + $this->container['publicUrl'] = $publicUrl; + + 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/src/Model/DocumentSettings.php b/src/Model/DocumentSettings.php new file mode 100644 index 0000000..43712ba --- /dev/null +++ b/src/Model/DocumentSettings.php @@ -0,0 +1,689 @@ + + */ +class DocumentSettings implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentSettings'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'mediatedService' => 'bool', + 'withoutFinancialFulfillment' => 'bool', + 'onlinePayment' => '\Cone\Billingo\Model\OnlinePayment', + 'round' => '\Cone\Billingo\Model\Round', + 'noSendOnlineszamlaByUser' => 'bool', + 'orderNumber' => 'string', + 'placeId' => 'int', + 'instantPayment' => 'bool', + 'selectedType' => '\Cone\Billingo\Model\DocumentType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'mediatedService' => null, + 'withoutFinancialFulfillment' => null, + 'onlinePayment' => null, + 'round' => null, + 'noSendOnlineszamlaByUser' => null, + 'orderNumber' => null, + 'placeId' => null, + 'instantPayment' => null, + 'selectedType' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'mediatedService' => false, + 'withoutFinancialFulfillment' => false, + 'onlinePayment' => false, + 'round' => false, + 'noSendOnlineszamlaByUser' => false, + 'orderNumber' => false, + 'placeId' => true, + 'instantPayment' => false, + 'selectedType' => 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 = [ + 'mediatedService' => 'mediated_service', + 'withoutFinancialFulfillment' => 'without_financial_fulfillment', + 'onlinePayment' => 'online_payment', + 'round' => 'round', + 'noSendOnlineszamlaByUser' => 'no_send_onlineszamla_by_user', + 'orderNumber' => 'order_number', + 'placeId' => 'place_id', + 'instantPayment' => 'instant_payment', + 'selectedType' => 'selected_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'mediatedService' => 'setMediatedService', + 'withoutFinancialFulfillment' => 'setWithoutFinancialFulfillment', + 'onlinePayment' => 'setOnlinePayment', + 'round' => 'setRound', + 'noSendOnlineszamlaByUser' => 'setNoSendOnlineszamlaByUser', + 'orderNumber' => 'setOrderNumber', + 'placeId' => 'setPlaceId', + 'instantPayment' => 'setInstantPayment', + 'selectedType' => 'setSelectedType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'mediatedService' => 'getMediatedService', + 'withoutFinancialFulfillment' => 'getWithoutFinancialFulfillment', + 'onlinePayment' => 'getOnlinePayment', + 'round' => 'getRound', + 'noSendOnlineszamlaByUser' => 'getNoSendOnlineszamlaByUser', + 'orderNumber' => 'getOrderNumber', + 'placeId' => 'getPlaceId', + 'instantPayment' => 'getInstantPayment', + 'selectedType' => 'getSelectedType' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('mediatedService', $data ?? [], false); + $this->setIfExists('withoutFinancialFulfillment', $data ?? [], false); + $this->setIfExists('onlinePayment', $data ?? [], null); + $this->setIfExists('round', $data ?? [], null); + $this->setIfExists('noSendOnlineszamlaByUser', $data ?? [], null); + $this->setIfExists('orderNumber', $data ?? [], null); + $this->setIfExists('placeId', $data ?? [], null); + $this->setIfExists('instantPayment', $data ?? [], null); + $this->setIfExists('selectedType', $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 mediatedService + * + * @return bool|null + */ + public function getMediatedService() + { + return $this->container['mediatedService']; + } + + /** + * Sets mediatedService + * + * @param bool|null $mediatedService mediatedService + * + * @return self + */ + public function setMediatedService($mediatedService) + { + if (is_null($mediatedService)) { + throw new \InvalidArgumentException('non-nullable mediatedService cannot be null'); + } + $this->container['mediatedService'] = $mediatedService; + + return $this; + } + + /** + * Gets withoutFinancialFulfillment + * + * @return bool|null + */ + public function getWithoutFinancialFulfillment() + { + return $this->container['withoutFinancialFulfillment']; + } + + /** + * Sets withoutFinancialFulfillment + * + * @param bool|null $withoutFinancialFulfillment withoutFinancialFulfillment + * + * @return self + */ + public function setWithoutFinancialFulfillment($withoutFinancialFulfillment) + { + if (is_null($withoutFinancialFulfillment)) { + throw new \InvalidArgumentException('non-nullable withoutFinancialFulfillment cannot be null'); + } + $this->container['withoutFinancialFulfillment'] = $withoutFinancialFulfillment; + + return $this; + } + + /** + * Gets onlinePayment + * + * @return \Cone\Billingo\Model\OnlinePayment|null + */ + public function getOnlinePayment() + { + return $this->container['onlinePayment']; + } + + /** + * Sets onlinePayment + * + * @param \Cone\Billingo\Model\OnlinePayment|null $onlinePayment onlinePayment + * + * @return self + */ + public function setOnlinePayment($onlinePayment) + { + if (is_null($onlinePayment)) { + throw new \InvalidArgumentException('non-nullable onlinePayment cannot be null'); + } + $this->container['onlinePayment'] = $onlinePayment; + + return $this; + } + + /** + * Gets round + * + * @return \Cone\Billingo\Model\Round|null + */ + public function getRound() + { + return $this->container['round']; + } + + /** + * Sets round + * + * @param \Cone\Billingo\Model\Round|null $round round + * + * @return self + */ + public function setRound($round) + { + if (is_null($round)) { + throw new \InvalidArgumentException('non-nullable round cannot be null'); + } + $this->container['round'] = $round; + + return $this; + } + + /** + * Gets noSendOnlineszamlaByUser + * + * @return bool|null + */ + public function getNoSendOnlineszamlaByUser() + { + return $this->container['noSendOnlineszamlaByUser']; + } + + /** + * Sets noSendOnlineszamlaByUser + * + * @param bool|null $noSendOnlineszamlaByUser noSendOnlineszamlaByUser + * + * @return self + */ + public function setNoSendOnlineszamlaByUser($noSendOnlineszamlaByUser) + { + if (is_null($noSendOnlineszamlaByUser)) { + throw new \InvalidArgumentException('non-nullable noSendOnlineszamlaByUser cannot be null'); + } + $this->container['noSendOnlineszamlaByUser'] = $noSendOnlineszamlaByUser; + + return $this; + } + + /** + * Gets orderNumber + * + * @return string|null + */ + public function getOrderNumber() + { + return $this->container['orderNumber']; + } + + /** + * Sets orderNumber + * + * @param string|null $orderNumber orderNumber + * + * @return self + */ + public function setOrderNumber($orderNumber) + { + if (is_null($orderNumber)) { + throw new \InvalidArgumentException('non-nullable orderNumber cannot be null'); + } + $this->container['orderNumber'] = $orderNumber; + + return $this; + } + + /** + * Gets placeId + * + * @return int|null + */ + public function getPlaceId() + { + return $this->container['placeId']; + } + + /** + * Sets placeId + * + * @param int|null $placeId placeId + * + * @return self + */ + public function setPlaceId($placeId) + { + if (is_null($placeId)) { + array_push($this->openAPINullablesSetToNull, 'placeId'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('placeId', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['placeId'] = $placeId; + + return $this; + } + + /** + * Gets instantPayment + * + * @return bool|null + */ + public function getInstantPayment() + { + return $this->container['instantPayment']; + } + + /** + * Sets instantPayment + * + * @param bool|null $instantPayment instantPayment + * + * @return self + */ + public function setInstantPayment($instantPayment) + { + if (is_null($instantPayment)) { + throw new \InvalidArgumentException('non-nullable instantPayment cannot be null'); + } + $this->container['instantPayment'] = $instantPayment; + + return $this; + } + + /** + * Gets selectedType + * + * @return \Cone\Billingo\Model\DocumentType|null + */ + public function getSelectedType() + { + return $this->container['selectedType']; + } + + /** + * Sets selectedType + * + * @param \Cone\Billingo\Model\DocumentType|null $selectedType selectedType + * + * @return self + */ + public function setSelectedType($selectedType) + { + if (is_null($selectedType)) { + throw new \InvalidArgumentException('non-nullable selectedType cannot be null'); + } + $this->container['selectedType'] = $selectedType; + + 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/src/Model/DocumentSummary.php b/src/Model/DocumentSummary.php new file mode 100644 index 0000000..9c37d53 --- /dev/null +++ b/src/Model/DocumentSummary.php @@ -0,0 +1,580 @@ + + */ +class DocumentSummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentSummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'netAmount' => 'float', + 'netAmountLocal' => 'float', + 'grossAmountLocal' => 'float', + 'vatAmount' => 'float', + 'vatAmountLocal' => 'float', + 'vatRateSummary' => '\Cone\Billingo\Model\DocumentVatRateSummary[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'netAmount' => 'float', + 'netAmountLocal' => 'float', + 'grossAmountLocal' => 'float', + 'vatAmount' => 'float', + 'vatAmountLocal' => 'float', + 'vatRateSummary' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'netAmount' => false, + 'netAmountLocal' => false, + 'grossAmountLocal' => false, + 'vatAmount' => false, + 'vatAmountLocal' => false, + 'vatRateSummary' => 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 = [ + 'netAmount' => 'net_amount', + 'netAmountLocal' => 'net_amount_local', + 'grossAmountLocal' => 'gross_amount_local', + 'vatAmount' => 'vat_amount', + 'vatAmountLocal' => 'vat_amount_local', + 'vatRateSummary' => 'vat_rate_summary' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'netAmount' => 'setNetAmount', + 'netAmountLocal' => 'setNetAmountLocal', + 'grossAmountLocal' => 'setGrossAmountLocal', + 'vatAmount' => 'setVatAmount', + 'vatAmountLocal' => 'setVatAmountLocal', + 'vatRateSummary' => 'setVatRateSummary' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'netAmount' => 'getNetAmount', + 'netAmountLocal' => 'getNetAmountLocal', + 'grossAmountLocal' => 'getGrossAmountLocal', + 'vatAmount' => 'getVatAmount', + 'vatAmountLocal' => 'getVatAmountLocal', + 'vatRateSummary' => 'getVatRateSummary' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('netAmount', $data ?? [], null); + $this->setIfExists('netAmountLocal', $data ?? [], null); + $this->setIfExists('grossAmountLocal', $data ?? [], null); + $this->setIfExists('vatAmount', $data ?? [], null); + $this->setIfExists('vatAmountLocal', $data ?? [], null); + $this->setIfExists('vatRateSummary', $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 netAmount + * + * @return float|null + */ + public function getNetAmount() + { + return $this->container['netAmount']; + } + + /** + * Sets netAmount + * + * @param float|null $netAmount netAmount + * + * @return self + */ + public function setNetAmount($netAmount) + { + if (is_null($netAmount)) { + throw new \InvalidArgumentException('non-nullable netAmount cannot be null'); + } + $this->container['netAmount'] = $netAmount; + + return $this; + } + + /** + * Gets netAmountLocal + * + * @return float|null + */ + public function getNetAmountLocal() + { + return $this->container['netAmountLocal']; + } + + /** + * Sets netAmountLocal + * + * @param float|null $netAmountLocal netAmountLocal + * + * @return self + */ + public function setNetAmountLocal($netAmountLocal) + { + if (is_null($netAmountLocal)) { + throw new \InvalidArgumentException('non-nullable netAmountLocal cannot be null'); + } + $this->container['netAmountLocal'] = $netAmountLocal; + + return $this; + } + + /** + * Gets grossAmountLocal + * + * @return float|null + */ + public function getGrossAmountLocal() + { + return $this->container['grossAmountLocal']; + } + + /** + * Sets grossAmountLocal + * + * @param float|null $grossAmountLocal grossAmountLocal + * + * @return self + */ + public function setGrossAmountLocal($grossAmountLocal) + { + if (is_null($grossAmountLocal)) { + throw new \InvalidArgumentException('non-nullable grossAmountLocal cannot be null'); + } + $this->container['grossAmountLocal'] = $grossAmountLocal; + + return $this; + } + + /** + * Gets vatAmount + * + * @return float|null + */ + public function getVatAmount() + { + return $this->container['vatAmount']; + } + + /** + * Sets vatAmount + * + * @param float|null $vatAmount vatAmount + * + * @return self + */ + public function setVatAmount($vatAmount) + { + if (is_null($vatAmount)) { + throw new \InvalidArgumentException('non-nullable vatAmount cannot be null'); + } + $this->container['vatAmount'] = $vatAmount; + + return $this; + } + + /** + * Gets vatAmountLocal + * + * @return float|null + */ + public function getVatAmountLocal() + { + return $this->container['vatAmountLocal']; + } + + /** + * Sets vatAmountLocal + * + * @param float|null $vatAmountLocal vatAmountLocal + * + * @return self + */ + public function setVatAmountLocal($vatAmountLocal) + { + if (is_null($vatAmountLocal)) { + throw new \InvalidArgumentException('non-nullable vatAmountLocal cannot be null'); + } + $this->container['vatAmountLocal'] = $vatAmountLocal; + + return $this; + } + + /** + * Gets vatRateSummary + * + * @return \Cone\Billingo\Model\DocumentVatRateSummary[]|null + */ + public function getVatRateSummary() + { + return $this->container['vatRateSummary']; + } + + /** + * Sets vatRateSummary + * + * @param \Cone\Billingo\Model\DocumentVatRateSummary[]|null $vatRateSummary vatRateSummary + * + * @return self + */ + public function setVatRateSummary($vatRateSummary) + { + if (is_null($vatRateSummary)) { + throw new \InvalidArgumentException('non-nullable vatRateSummary cannot be null'); + } + $this->container['vatRateSummary'] = $vatRateSummary; + + 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/src/Model/DocumentType.php b/src/Model/DocumentType.php new file mode 100644 index 0000000..7dbb4f4 --- /dev/null +++ b/src/Model/DocumentType.php @@ -0,0 +1,108 @@ + + */ +class DocumentVatRateSummary implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DocumentVatRateSummary'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'vatName' => 'string', + 'vatPercentage' => 'float', + 'vatRateNetAmount' => 'float', + 'vatRateVatAmount' => 'float', + 'vatRateVatAmountLocal' => 'float', + 'vatRateGrossAmount' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'vatName' => null, + 'vatPercentage' => 'float', + 'vatRateNetAmount' => 'float', + 'vatRateVatAmount' => 'float', + 'vatRateVatAmountLocal' => 'float', + 'vatRateGrossAmount' => 'float' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'vatName' => false, + 'vatPercentage' => false, + 'vatRateNetAmount' => false, + 'vatRateVatAmount' => false, + 'vatRateVatAmountLocal' => false, + 'vatRateGrossAmount' => 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 = [ + 'vatName' => 'vat_name', + 'vatPercentage' => 'vat_percentage', + 'vatRateNetAmount' => 'vat_rate_net_amount', + 'vatRateVatAmount' => 'vat_rate_vat_amount', + 'vatRateVatAmountLocal' => 'vat_rate_vat_amount_local', + 'vatRateGrossAmount' => 'vat_rate_gross_amount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'vatName' => 'setVatName', + 'vatPercentage' => 'setVatPercentage', + 'vatRateNetAmount' => 'setVatRateNetAmount', + 'vatRateVatAmount' => 'setVatRateVatAmount', + 'vatRateVatAmountLocal' => 'setVatRateVatAmountLocal', + 'vatRateGrossAmount' => 'setVatRateGrossAmount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'vatName' => 'getVatName', + 'vatPercentage' => 'getVatPercentage', + 'vatRateNetAmount' => 'getVatRateNetAmount', + 'vatRateVatAmount' => 'getVatRateVatAmount', + 'vatRateVatAmountLocal' => 'getVatRateVatAmountLocal', + 'vatRateGrossAmount' => 'getVatRateGrossAmount' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('vatName', $data ?? [], null); + $this->setIfExists('vatPercentage', $data ?? [], null); + $this->setIfExists('vatRateNetAmount', $data ?? [], null); + $this->setIfExists('vatRateVatAmount', $data ?? [], null); + $this->setIfExists('vatRateVatAmountLocal', $data ?? [], null); + $this->setIfExists('vatRateGrossAmount', $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 vatName + * + * @return string|null + */ + public function getVatName() + { + return $this->container['vatName']; + } + + /** + * Sets vatName + * + * @param string|null $vatName vatName + * + * @return self + */ + public function setVatName($vatName) + { + if (is_null($vatName)) { + throw new \InvalidArgumentException('non-nullable vatName cannot be null'); + } + $this->container['vatName'] = $vatName; + + return $this; + } + + /** + * Gets vatPercentage + * + * @return float|null + */ + public function getVatPercentage() + { + return $this->container['vatPercentage']; + } + + /** + * Sets vatPercentage + * + * @param float|null $vatPercentage vatPercentage + * + * @return self + */ + public function setVatPercentage($vatPercentage) + { + if (is_null($vatPercentage)) { + throw new \InvalidArgumentException('non-nullable vatPercentage cannot be null'); + } + $this->container['vatPercentage'] = $vatPercentage; + + return $this; + } + + /** + * Gets vatRateNetAmount + * + * @return float|null + */ + public function getVatRateNetAmount() + { + return $this->container['vatRateNetAmount']; + } + + /** + * Sets vatRateNetAmount + * + * @param float|null $vatRateNetAmount vatRateNetAmount + * + * @return self + */ + public function setVatRateNetAmount($vatRateNetAmount) + { + if (is_null($vatRateNetAmount)) { + throw new \InvalidArgumentException('non-nullable vatRateNetAmount cannot be null'); + } + $this->container['vatRateNetAmount'] = $vatRateNetAmount; + + return $this; + } + + /** + * Gets vatRateVatAmount + * + * @return float|null + */ + public function getVatRateVatAmount() + { + return $this->container['vatRateVatAmount']; + } + + /** + * Sets vatRateVatAmount + * + * @param float|null $vatRateVatAmount vatRateVatAmount + * + * @return self + */ + public function setVatRateVatAmount($vatRateVatAmount) + { + if (is_null($vatRateVatAmount)) { + throw new \InvalidArgumentException('non-nullable vatRateVatAmount cannot be null'); + } + $this->container['vatRateVatAmount'] = $vatRateVatAmount; + + return $this; + } + + /** + * Gets vatRateVatAmountLocal + * + * @return float|null + */ + public function getVatRateVatAmountLocal() + { + return $this->container['vatRateVatAmountLocal']; + } + + /** + * Sets vatRateVatAmountLocal + * + * @param float|null $vatRateVatAmountLocal vatRateVatAmountLocal + * + * @return self + */ + public function setVatRateVatAmountLocal($vatRateVatAmountLocal) + { + if (is_null($vatRateVatAmountLocal)) { + throw new \InvalidArgumentException('non-nullable vatRateVatAmountLocal cannot be null'); + } + $this->container['vatRateVatAmountLocal'] = $vatRateVatAmountLocal; + + return $this; + } + + /** + * Gets vatRateGrossAmount + * + * @return float|null + */ + public function getVatRateGrossAmount() + { + return $this->container['vatRateGrossAmount']; + } + + /** + * Sets vatRateGrossAmount + * + * @param float|null $vatRateGrossAmount vatRateGrossAmount + * + * @return self + */ + public function setVatRateGrossAmount($vatRateGrossAmount) + { + if (is_null($vatRateGrossAmount)) { + throw new \InvalidArgumentException('non-nullable vatRateGrossAmount cannot be null'); + } + $this->container['vatRateGrossAmount'] = $vatRateGrossAmount; + + 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/src/Model/Entitlement.php b/src/Model/Entitlement.php new file mode 100644 index 0000000..a5087f1 --- /dev/null +++ b/src/Model/Entitlement.php @@ -0,0 +1,103 @@ + + */ +class Id implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Id'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'legacyId' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'legacyId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'legacyId' => 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', + 'legacyId' => 'legacy_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'legacyId' => 'setLegacyId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'legacyId' => 'getLegacyId' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('legacyId', $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 legacyId + * + * @return int|null + */ + public function getLegacyId() + { + return $this->container['legacyId']; + } + + /** + * Sets legacyId + * + * @param int|null $legacyId legacyId + * + * @return self + */ + public function setLegacyId($legacyId) + { + if (is_null($legacyId)) { + throw new \InvalidArgumentException('non-nullable legacyId cannot be null'); + } + $this->container['legacyId'] = $legacyId; + + 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/src/Model/InvoiceSettings.php b/src/Model/InvoiceSettings.php new file mode 100644 index 0000000..373079b --- /dev/null +++ b/src/Model/InvoiceSettings.php @@ -0,0 +1,546 @@ + + */ +class InvoiceSettings implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InvoiceSettings'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'documentType' => '\Cone\Billingo\Model\DocumentType', + 'fulfillmentDate' => '\DateTime', + 'dueDate' => '\DateTime', + 'documentFormat' => '\Cone\Billingo\Model\DocumentFormat', + 'comment' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'documentType' => null, + 'fulfillmentDate' => 'date', + 'dueDate' => 'date', + 'documentFormat' => null, + 'comment' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'documentType' => false, + 'fulfillmentDate' => false, + 'dueDate' => false, + 'documentFormat' => false, + 'comment' => 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 = [ + 'documentType' => 'document_type', + 'fulfillmentDate' => 'fulfillment_date', + 'dueDate' => 'due_date', + 'documentFormat' => 'document_format', + 'comment' => 'comment' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'documentType' => 'setDocumentType', + 'fulfillmentDate' => 'setFulfillmentDate', + 'dueDate' => 'setDueDate', + 'documentFormat' => 'setDocumentFormat', + 'comment' => 'setComment' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'documentType' => 'getDocumentType', + 'fulfillmentDate' => 'getFulfillmentDate', + 'dueDate' => 'getDueDate', + 'documentFormat' => 'getDocumentFormat', + 'comment' => 'getComment' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('documentType', $data ?? [], null); + $this->setIfExists('fulfillmentDate', $data ?? [], null); + $this->setIfExists('dueDate', $data ?? [], null); + $this->setIfExists('documentFormat', $data ?? [], null); + $this->setIfExists('comment', $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 documentType + * + * @return \Cone\Billingo\Model\DocumentType|null + */ + public function getDocumentType() + { + return $this->container['documentType']; + } + + /** + * Sets documentType + * + * @param \Cone\Billingo\Model\DocumentType|null $documentType documentType + * + * @return self + */ + public function setDocumentType($documentType) + { + if (is_null($documentType)) { + throw new \InvalidArgumentException('non-nullable documentType cannot be null'); + } + $this->container['documentType'] = $documentType; + + return $this; + } + + /** + * Gets fulfillmentDate + * + * @return \DateTime|null + */ + public function getFulfillmentDate() + { + return $this->container['fulfillmentDate']; + } + + /** + * Sets fulfillmentDate + * + * @param \DateTime|null $fulfillmentDate fulfillmentDate + * + * @return self + */ + public function setFulfillmentDate($fulfillmentDate) + { + if (is_null($fulfillmentDate)) { + throw new \InvalidArgumentException('non-nullable fulfillmentDate cannot be null'); + } + $this->container['fulfillmentDate'] = $fulfillmentDate; + + return $this; + } + + /** + * Gets dueDate + * + * @return \DateTime|null + */ + public function getDueDate() + { + return $this->container['dueDate']; + } + + /** + * Sets dueDate + * + * @param \DateTime|null $dueDate dueDate + * + * @return self + */ + public function setDueDate($dueDate) + { + if (is_null($dueDate)) { + throw new \InvalidArgumentException('non-nullable dueDate cannot be null'); + } + $this->container['dueDate'] = $dueDate; + + return $this; + } + + /** + * Gets documentFormat + * + * @return \Cone\Billingo\Model\DocumentFormat|null + */ + public function getDocumentFormat() + { + return $this->container['documentFormat']; + } + + /** + * Sets documentFormat + * + * @param \Cone\Billingo\Model\DocumentFormat|null $documentFormat documentFormat + * + * @return self + */ + public function setDocumentFormat($documentFormat) + { + if (is_null($documentFormat)) { + throw new \InvalidArgumentException('non-nullable documentFormat cannot be null'); + } + $this->container['documentFormat'] = $documentFormat; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + throw new \InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + 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/src/Model/LedgerNumberInformation.php b/src/Model/LedgerNumberInformation.php new file mode 100644 index 0000000..b6812d5 --- /dev/null +++ b/src/Model/LedgerNumberInformation.php @@ -0,0 +1,512 @@ + + */ +class LedgerNumberInformation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LedgerNumberInformation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'bevetel' => 'string', + 'vevo' => 'string', + 'penztar' => 'string', + 'afa' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'bevetel' => null, + 'vevo' => null, + 'penztar' => null, + 'afa' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'bevetel' => false, + 'vevo' => false, + 'penztar' => false, + 'afa' => 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 = [ + 'bevetel' => 'bevetel', + 'vevo' => 'vevo', + 'penztar' => 'penztar', + 'afa' => 'afa' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'bevetel' => 'setBevetel', + 'vevo' => 'setVevo', + 'penztar' => 'setPenztar', + 'afa' => 'setAfa' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'bevetel' => 'getBevetel', + 'vevo' => 'getVevo', + 'penztar' => 'getPenztar', + 'afa' => 'getAfa' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('bevetel', $data ?? [], null); + $this->setIfExists('vevo', $data ?? [], null); + $this->setIfExists('penztar', $data ?? [], null); + $this->setIfExists('afa', $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 bevetel + * + * @return string|null + */ + public function getBevetel() + { + return $this->container['bevetel']; + } + + /** + * Sets bevetel + * + * @param string|null $bevetel bevetel + * + * @return self + */ + public function setBevetel($bevetel) + { + if (is_null($bevetel)) { + throw new \InvalidArgumentException('non-nullable bevetel cannot be null'); + } + $this->container['bevetel'] = $bevetel; + + return $this; + } + + /** + * Gets vevo + * + * @return string|null + */ + public function getVevo() + { + return $this->container['vevo']; + } + + /** + * Sets vevo + * + * @param string|null $vevo vevo + * + * @return self + */ + public function setVevo($vevo) + { + if (is_null($vevo)) { + throw new \InvalidArgumentException('non-nullable vevo cannot be null'); + } + $this->container['vevo'] = $vevo; + + return $this; + } + + /** + * Gets penztar + * + * @return string|null + */ + public function getPenztar() + { + return $this->container['penztar']; + } + + /** + * Sets penztar + * + * @param string|null $penztar penztar + * + * @return self + */ + public function setPenztar($penztar) + { + if (is_null($penztar)) { + throw new \InvalidArgumentException('non-nullable penztar cannot be null'); + } + $this->container['penztar'] = $penztar; + + return $this; + } + + /** + * Gets afa + * + * @return string|null + */ + public function getAfa() + { + return $this->container['afa']; + } + + /** + * Sets afa + * + * @param string|null $afa afa + * + * @return self + */ + public function setAfa($afa) + { + if (is_null($afa)) { + throw new \InvalidArgumentException('non-nullable afa cannot be null'); + } + $this->container['afa'] = $afa; + + 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/src/Model/ModelInterface.php b/src/Model/ModelInterface.php new file mode 100644 index 0000000..9f1de5b --- /dev/null +++ b/src/Model/ModelInterface.php @@ -0,0 +1,112 @@ + + */ +class ModificationDocumentInsert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ModificationDocumentInsert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'dueDate' => '\DateTime', + 'comment' => 'string', + 'paymentMethod' => '\Cone\Billingo\Model\PaymentMethod', + 'withoutFinancialFulfillment' => 'bool', + 'items' => '\Cone\Billingo\Model\DocumentInsertItemsInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'dueDate' => 'date', + 'comment' => null, + 'paymentMethod' => null, + 'withoutFinancialFulfillment' => null, + 'items' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'dueDate' => false, + 'comment' => false, + 'paymentMethod' => false, + 'withoutFinancialFulfillment' => false, + 'items' => 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 = [ + 'dueDate' => 'due_date', + 'comment' => 'comment', + 'paymentMethod' => 'payment_method', + 'withoutFinancialFulfillment' => 'without_financial_fulfillment', + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'dueDate' => 'setDueDate', + 'comment' => 'setComment', + 'paymentMethod' => 'setPaymentMethod', + 'withoutFinancialFulfillment' => 'setWithoutFinancialFulfillment', + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'dueDate' => 'getDueDate', + 'comment' => 'getComment', + 'paymentMethod' => 'getPaymentMethod', + 'withoutFinancialFulfillment' => 'getWithoutFinancialFulfillment', + 'items' => 'getItems' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('dueDate', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('withoutFinancialFulfillment', $data ?? [], false); + $this->setIfExists('items', $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 dueDate + * + * @return \DateTime|null + */ + public function getDueDate() + { + return $this->container['dueDate']; + } + + /** + * Sets dueDate + * + * @param \DateTime|null $dueDate dueDate + * + * @return self + */ + public function setDueDate($dueDate) + { + if (is_null($dueDate)) { + throw new \InvalidArgumentException('non-nullable dueDate cannot be null'); + } + $this->container['dueDate'] = $dueDate; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + throw new \InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets paymentMethod + * + * @return \Cone\Billingo\Model\PaymentMethod|null + */ + public function getPaymentMethod() + { + return $this->container['paymentMethod']; + } + + /** + * Sets paymentMethod + * + * @param \Cone\Billingo\Model\PaymentMethod|null $paymentMethod paymentMethod + * + * @return self + */ + public function setPaymentMethod($paymentMethod) + { + if (is_null($paymentMethod)) { + throw new \InvalidArgumentException('non-nullable paymentMethod cannot be null'); + } + $this->container['paymentMethod'] = $paymentMethod; + + return $this; + } + + /** + * Gets withoutFinancialFulfillment + * + * @return bool|null + */ + public function getWithoutFinancialFulfillment() + { + return $this->container['withoutFinancialFulfillment']; + } + + /** + * Sets withoutFinancialFulfillment + * + * @param bool|null $withoutFinancialFulfillment withoutFinancialFulfillment + * + * @return self + */ + public function setWithoutFinancialFulfillment($withoutFinancialFulfillment) + { + if (is_null($withoutFinancialFulfillment)) { + throw new \InvalidArgumentException('non-nullable withoutFinancialFulfillment cannot be null'); + } + $this->container['withoutFinancialFulfillment'] = $withoutFinancialFulfillment; + + return $this; + } + + /** + * Gets items + * + * @return \Cone\Billingo\Model\DocumentInsertItemsInner[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Cone\Billingo\Model\DocumentInsertItemsInner[]|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; + } + /** + * 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/src/Model/OnlinePayment.php b/src/Model/OnlinePayment.php new file mode 100644 index 0000000..80e004f --- /dev/null +++ b/src/Model/OnlinePayment.php @@ -0,0 +1,69 @@ + + */ +class OnlineSzamlaStatus implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OnlineSzamlaStatus'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'transactionId' => 'string', + 'status' => 'string', + 'messages' => '\Cone\Billingo\Model\OnlineSzamlaStatusMessage[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'transactionId' => null, + 'status' => null, + 'messages' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'transactionId' => false, + 'status' => false, + 'messages' => 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 = [ + 'transactionId' => 'transaction_id', + 'status' => 'status', + 'messages' => 'messages' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'transactionId' => 'setTransactionId', + 'status' => 'setStatus', + 'messages' => 'setMessages' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'transactionId' => 'getTransactionId', + 'status' => 'getStatus', + 'messages' => 'getMessages' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('transactionId', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('messages', $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 transactionId + * + * @return string|null + */ + public function getTransactionId() + { + return $this->container['transactionId']; + } + + /** + * Sets transactionId + * + * @param string|null $transactionId transactionId + * + * @return self + */ + public function setTransactionId($transactionId) + { + if (is_null($transactionId)) { + throw new \InvalidArgumentException('non-nullable transactionId cannot be null'); + } + $this->container['transactionId'] = $transactionId; + + 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)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets messages + * + * @return \Cone\Billingo\Model\OnlineSzamlaStatusMessage[]|null + */ + public function getMessages() + { + return $this->container['messages']; + } + + /** + * Sets messages + * + * @param \Cone\Billingo\Model\OnlineSzamlaStatusMessage[]|null $messages messages + * + * @return self + */ + public function setMessages($messages) + { + if (is_null($messages)) { + throw new \InvalidArgumentException('non-nullable messages cannot be null'); + } + $this->container['messages'] = $messages; + + 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/src/Model/OnlineSzamlaStatusEnum.php b/src/Model/OnlineSzamlaStatusEnum.php new file mode 100644 index 0000000..dc1665d --- /dev/null +++ b/src/Model/OnlineSzamlaStatusEnum.php @@ -0,0 +1,171 @@ + + */ +class OnlineSzamlaStatusMessage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OnlineSzamlaStatusMessage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'validationResultCode' => 'string', + 'validationErrorCode' => 'string', + 'humanReadableMessage' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'validationResultCode' => null, + 'validationErrorCode' => null, + 'humanReadableMessage' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'validationResultCode' => false, + 'validationErrorCode' => false, + 'humanReadableMessage' => 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 = [ + 'validationResultCode' => 'validation_result_code', + 'validationErrorCode' => 'validation_error_code', + 'humanReadableMessage' => 'human_readable_message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'validationResultCode' => 'setValidationResultCode', + 'validationErrorCode' => 'setValidationErrorCode', + 'humanReadableMessage' => 'setHumanReadableMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'validationResultCode' => 'getValidationResultCode', + 'validationErrorCode' => 'getValidationErrorCode', + 'humanReadableMessage' => 'getHumanReadableMessage' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('validationResultCode', $data ?? [], null); + $this->setIfExists('validationErrorCode', $data ?? [], null); + $this->setIfExists('humanReadableMessage', $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 validationResultCode + * + * @return string|null + */ + public function getValidationResultCode() + { + return $this->container['validationResultCode']; + } + + /** + * Sets validationResultCode + * + * @param string|null $validationResultCode validationResultCode + * + * @return self + */ + public function setValidationResultCode($validationResultCode) + { + if (is_null($validationResultCode)) { + throw new \InvalidArgumentException('non-nullable validationResultCode cannot be null'); + } + $this->container['validationResultCode'] = $validationResultCode; + + return $this; + } + + /** + * Gets validationErrorCode + * + * @return string|null + */ + public function getValidationErrorCode() + { + return $this->container['validationErrorCode']; + } + + /** + * Sets validationErrorCode + * + * @param string|null $validationErrorCode validationErrorCode + * + * @return self + */ + public function setValidationErrorCode($validationErrorCode) + { + if (is_null($validationErrorCode)) { + throw new \InvalidArgumentException('non-nullable validationErrorCode cannot be null'); + } + $this->container['validationErrorCode'] = $validationErrorCode; + + return $this; + } + + /** + * Gets humanReadableMessage + * + * @return string|null + */ + public function getHumanReadableMessage() + { + return $this->container['humanReadableMessage']; + } + + /** + * Sets humanReadableMessage + * + * @param string|null $humanReadableMessage humanReadableMessage + * + * @return self + */ + public function setHumanReadableMessage($humanReadableMessage) + { + if (is_null($humanReadableMessage)) { + throw new \InvalidArgumentException('non-nullable humanReadableMessage cannot be null'); + } + $this->container['humanReadableMessage'] = $humanReadableMessage; + + 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/src/Model/OrganizationData.php b/src/Model/OrganizationData.php new file mode 100644 index 0000000..dcc3ace --- /dev/null +++ b/src/Model/OrganizationData.php @@ -0,0 +1,444 @@ + + */ +class OrganizationData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OrganizationData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'taxCode' => 'string', + 'subscription' => '\Cone\Billingo\Model\Subscription' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'taxCode' => null, + 'subscription' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'taxCode' => false, + 'subscription' => 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 = [ + 'taxCode' => 'tax_code', + 'subscription' => 'subscription' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'taxCode' => 'setTaxCode', + 'subscription' => 'setSubscription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'taxCode' => 'getTaxCode', + 'subscription' => 'getSubscription' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('taxCode', $data ?? [], null); + $this->setIfExists('subscription', $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 taxCode + * + * @return string|null + */ + public function getTaxCode() + { + return $this->container['taxCode']; + } + + /** + * Sets taxCode + * + * @param string|null $taxCode taxCode + * + * @return self + */ + public function setTaxCode($taxCode) + { + if (is_null($taxCode)) { + throw new \InvalidArgumentException('non-nullable taxCode cannot be null'); + } + $this->container['taxCode'] = $taxCode; + + return $this; + } + + /** + * Gets subscription + * + * @return \Cone\Billingo\Model\Subscription|null + */ + public function getSubscription() + { + return $this->container['subscription']; + } + + /** + * Sets subscription + * + * @param \Cone\Billingo\Model\Subscription|null $subscription subscription + * + * @return self + */ + public function setSubscription($subscription) + { + if (is_null($subscription)) { + throw new \InvalidArgumentException('non-nullable subscription cannot be null'); + } + $this->container['subscription'] = $subscription; + + 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/src/Model/Partner.php b/src/Model/Partner.php new file mode 100644 index 0000000..dba7f96 --- /dev/null +++ b/src/Model/Partner.php @@ -0,0 +1,818 @@ + + */ +class Partner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Partner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'address' => '\Cone\Billingo\Model\Address', + 'emails' => 'string[]', + 'taxcode' => 'string', + 'iban' => 'string', + 'swift' => 'string', + 'accountNumber' => 'string', + 'phone' => 'string', + 'generalLedgerNumber' => 'string', + 'taxType' => '\Cone\Billingo\Model\PartnerTaxType', + 'customBillingSettings' => '\Cone\Billingo\Model\PartnerCustomBillingSettings', + 'groupMemberTaxNumber' => '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, + 'address' => null, + 'emails' => null, + 'taxcode' => null, + 'iban' => null, + 'swift' => null, + 'accountNumber' => null, + 'phone' => null, + 'generalLedgerNumber' => null, + 'taxType' => null, + 'customBillingSettings' => null, + 'groupMemberTaxNumber' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'address' => false, + 'emails' => false, + 'taxcode' => false, + 'iban' => false, + 'swift' => false, + 'accountNumber' => false, + 'phone' => false, + 'generalLedgerNumber' => false, + 'taxType' => false, + 'customBillingSettings' => false, + 'groupMemberTaxNumber' => 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', + 'name' => 'name', + 'address' => 'address', + 'emails' => 'emails', + 'taxcode' => 'taxcode', + 'iban' => 'iban', + 'swift' => 'swift', + 'accountNumber' => 'account_number', + 'phone' => 'phone', + 'generalLedgerNumber' => 'general_ledger_number', + 'taxType' => 'tax_type', + 'customBillingSettings' => 'custom_billing_settings', + 'groupMemberTaxNumber' => 'group_member_tax_number' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'address' => 'setAddress', + 'emails' => 'setEmails', + 'taxcode' => 'setTaxcode', + 'iban' => 'setIban', + 'swift' => 'setSwift', + 'accountNumber' => 'setAccountNumber', + 'phone' => 'setPhone', + 'generalLedgerNumber' => 'setGeneralLedgerNumber', + 'taxType' => 'setTaxType', + 'customBillingSettings' => 'setCustomBillingSettings', + 'groupMemberTaxNumber' => 'setGroupMemberTaxNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'address' => 'getAddress', + 'emails' => 'getEmails', + 'taxcode' => 'getTaxcode', + 'iban' => 'getIban', + 'swift' => 'getSwift', + 'accountNumber' => 'getAccountNumber', + 'phone' => 'getPhone', + 'generalLedgerNumber' => 'getGeneralLedgerNumber', + 'taxType' => 'getTaxType', + 'customBillingSettings' => 'getCustomBillingSettings', + 'groupMemberTaxNumber' => 'getGroupMemberTaxNumber' + ]; + + /** + * 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[] $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('address', $data ?? [], null); + $this->setIfExists('emails', $data ?? [], null); + $this->setIfExists('taxcode', $data ?? [], null); + $this->setIfExists('iban', $data ?? [], null); + $this->setIfExists('swift', $data ?? [], null); + $this->setIfExists('accountNumber', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('generalLedgerNumber', $data ?? [], null); + $this->setIfExists('taxType', $data ?? [], null); + $this->setIfExists('customBillingSettings', $data ?? [], null); + $this->setIfExists('groupMemberTaxNumber', $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 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)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets address + * + * @return \Cone\Billingo\Model\Address|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \Cone\Billingo\Model\Address|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + throw new \InvalidArgumentException('non-nullable address cannot be null'); + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets emails + * + * @return string[]|null + */ + public function getEmails() + { + return $this->container['emails']; + } + + /** + * Sets emails + * + * @param string[]|null $emails emails + * + * @return self + */ + public function setEmails($emails) + { + if (is_null($emails)) { + throw new \InvalidArgumentException('non-nullable emails cannot be null'); + } + $this->container['emails'] = $emails; + + return $this; + } + + /** + * Gets taxcode + * + * @return string|null + */ + public function getTaxcode() + { + return $this->container['taxcode']; + } + + /** + * Sets taxcode + * + * @param string|null $taxcode taxcode + * + * @return self + */ + public function setTaxcode($taxcode) + { + if (is_null($taxcode)) { + throw new \InvalidArgumentException('non-nullable taxcode cannot be null'); + } + $this->container['taxcode'] = $taxcode; + + return $this; + } + + /** + * Gets iban + * + * @return string|null + */ + public function getIban() + { + return $this->container['iban']; + } + + /** + * Sets iban + * + * @param string|null $iban iban + * + * @return self + */ + public function setIban($iban) + { + if (is_null($iban)) { + throw new \InvalidArgumentException('non-nullable iban cannot be null'); + } + $this->container['iban'] = $iban; + + return $this; + } + + /** + * Gets swift + * + * @return string|null + */ + public function getSwift() + { + return $this->container['swift']; + } + + /** + * Sets swift + * + * @param string|null $swift swift + * + * @return self + */ + public function setSwift($swift) + { + if (is_null($swift)) { + throw new \InvalidArgumentException('non-nullable swift cannot be null'); + } + $this->container['swift'] = $swift; + + return $this; + } + + /** + * Gets accountNumber + * + * @return string|null + */ + public function getAccountNumber() + { + return $this->container['accountNumber']; + } + + /** + * Sets accountNumber + * + * @param string|null $accountNumber accountNumber + * + * @return self + */ + public function setAccountNumber($accountNumber) + { + if (is_null($accountNumber)) { + throw new \InvalidArgumentException('non-nullable accountNumber cannot be null'); + } + $this->container['accountNumber'] = $accountNumber; + + 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)) { + throw new \InvalidArgumentException('non-nullable phone cannot be null'); + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets generalLedgerNumber + * + * @return string|null + */ + public function getGeneralLedgerNumber() + { + return $this->container['generalLedgerNumber']; + } + + /** + * Sets generalLedgerNumber + * + * @param string|null $generalLedgerNumber generalLedgerNumber + * + * @return self + */ + public function setGeneralLedgerNumber($generalLedgerNumber) + { + if (is_null($generalLedgerNumber)) { + throw new \InvalidArgumentException('non-nullable generalLedgerNumber cannot be null'); + } + $this->container['generalLedgerNumber'] = $generalLedgerNumber; + + return $this; + } + + /** + * Gets taxType + * + * @return \Cone\Billingo\Model\PartnerTaxType|null + */ + public function getTaxType() + { + return $this->container['taxType']; + } + + /** + * Sets taxType + * + * @param \Cone\Billingo\Model\PartnerTaxType|null $taxType taxType + * + * @return self + */ + public function setTaxType($taxType) + { + if (is_null($taxType)) { + throw new \InvalidArgumentException('non-nullable taxType cannot be null'); + } + $this->container['taxType'] = $taxType; + + return $this; + } + + /** + * Gets customBillingSettings + * + * @return \Cone\Billingo\Model\PartnerCustomBillingSettings|null + */ + public function getCustomBillingSettings() + { + return $this->container['customBillingSettings']; + } + + /** + * Sets customBillingSettings + * + * @param \Cone\Billingo\Model\PartnerCustomBillingSettings|null $customBillingSettings customBillingSettings + * + * @return self + */ + public function setCustomBillingSettings($customBillingSettings) + { + if (is_null($customBillingSettings)) { + throw new \InvalidArgumentException('non-nullable customBillingSettings cannot be null'); + } + $this->container['customBillingSettings'] = $customBillingSettings; + + return $this; + } + + /** + * Gets groupMemberTaxNumber + * + * @return string|null + */ + public function getGroupMemberTaxNumber() + { + return $this->container['groupMemberTaxNumber']; + } + + /** + * Sets groupMemberTaxNumber + * + * @param string|null $groupMemberTaxNumber The tax number of group member. Send tax number for update. Send empty string for delete. Ignored if omitted. + * + * @return self + */ + public function setGroupMemberTaxNumber($groupMemberTaxNumber) + { + if (is_null($groupMemberTaxNumber)) { + throw new \InvalidArgumentException('non-nullable groupMemberTaxNumber cannot be null'); + } + $this->container['groupMemberTaxNumber'] = $groupMemberTaxNumber; + + 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/src/Model/PartnerCustomBillingSettings.php b/src/Model/PartnerCustomBillingSettings.php new file mode 100644 index 0000000..e2053e1 --- /dev/null +++ b/src/Model/PartnerCustomBillingSettings.php @@ -0,0 +1,580 @@ + + */ +class PartnerCustomBillingSettings implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PartnerCustomBillingSettings'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'paymentMethod' => '\Cone\Billingo\Model\PaymentMethod', + 'documentForm' => '\Cone\Billingo\Model\DocumentForm', + 'dueDays' => 'int', + 'documentCurrency' => '\Cone\Billingo\Model\Currency', + 'templateLanguageCode' => '\Cone\Billingo\Model\DocumentLanguage', + 'discount' => '\Cone\Billingo\Model\Discount' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'paymentMethod' => null, + 'documentForm' => null, + 'dueDays' => null, + 'documentCurrency' => null, + 'templateLanguageCode' => null, + 'discount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'paymentMethod' => false, + 'documentForm' => false, + 'dueDays' => false, + 'documentCurrency' => false, + 'templateLanguageCode' => false, + 'discount' => 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 = [ + 'paymentMethod' => 'payment_method', + 'documentForm' => 'document_form', + 'dueDays' => 'due_days', + 'documentCurrency' => 'document_currency', + 'templateLanguageCode' => 'template_language_code', + 'discount' => 'discount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'paymentMethod' => 'setPaymentMethod', + 'documentForm' => 'setDocumentForm', + 'dueDays' => 'setDueDays', + 'documentCurrency' => 'setDocumentCurrency', + 'templateLanguageCode' => 'setTemplateLanguageCode', + 'discount' => 'setDiscount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'paymentMethod' => 'getPaymentMethod', + 'documentForm' => 'getDocumentForm', + 'dueDays' => 'getDueDays', + 'documentCurrency' => 'getDocumentCurrency', + 'templateLanguageCode' => 'getTemplateLanguageCode', + 'discount' => 'getDiscount' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('documentForm', $data ?? [], null); + $this->setIfExists('dueDays', $data ?? [], null); + $this->setIfExists('documentCurrency', $data ?? [], null); + $this->setIfExists('templateLanguageCode', $data ?? [], null); + $this->setIfExists('discount', $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 paymentMethod + * + * @return \Cone\Billingo\Model\PaymentMethod|null + */ + public function getPaymentMethod() + { + return $this->container['paymentMethod']; + } + + /** + * Sets paymentMethod + * + * @param \Cone\Billingo\Model\PaymentMethod|null $paymentMethod paymentMethod + * + * @return self + */ + public function setPaymentMethod($paymentMethod) + { + if (is_null($paymentMethod)) { + throw new \InvalidArgumentException('non-nullable paymentMethod cannot be null'); + } + $this->container['paymentMethod'] = $paymentMethod; + + return $this; + } + + /** + * Gets documentForm + * + * @return \Cone\Billingo\Model\DocumentForm|null + */ + public function getDocumentForm() + { + return $this->container['documentForm']; + } + + /** + * Sets documentForm + * + * @param \Cone\Billingo\Model\DocumentForm|null $documentForm documentForm + * + * @return self + */ + public function setDocumentForm($documentForm) + { + if (is_null($documentForm)) { + throw new \InvalidArgumentException('non-nullable documentForm cannot be null'); + } + $this->container['documentForm'] = $documentForm; + + return $this; + } + + /** + * Gets dueDays + * + * @return int|null + */ + public function getDueDays() + { + return $this->container['dueDays']; + } + + /** + * Sets dueDays + * + * @param int|null $dueDays dueDays + * + * @return self + */ + public function setDueDays($dueDays) + { + if (is_null($dueDays)) { + throw new \InvalidArgumentException('non-nullable dueDays cannot be null'); + } + $this->container['dueDays'] = $dueDays; + + return $this; + } + + /** + * Gets documentCurrency + * + * @return \Cone\Billingo\Model\Currency|null + */ + public function getDocumentCurrency() + { + return $this->container['documentCurrency']; + } + + /** + * Sets documentCurrency + * + * @param \Cone\Billingo\Model\Currency|null $documentCurrency documentCurrency + * + * @return self + */ + public function setDocumentCurrency($documentCurrency) + { + if (is_null($documentCurrency)) { + throw new \InvalidArgumentException('non-nullable documentCurrency cannot be null'); + } + $this->container['documentCurrency'] = $documentCurrency; + + return $this; + } + + /** + * Gets templateLanguageCode + * + * @return \Cone\Billingo\Model\DocumentLanguage|null + */ + public function getTemplateLanguageCode() + { + return $this->container['templateLanguageCode']; + } + + /** + * Sets templateLanguageCode + * + * @param \Cone\Billingo\Model\DocumentLanguage|null $templateLanguageCode templateLanguageCode + * + * @return self + */ + public function setTemplateLanguageCode($templateLanguageCode) + { + if (is_null($templateLanguageCode)) { + throw new \InvalidArgumentException('non-nullable templateLanguageCode cannot be null'); + } + $this->container['templateLanguageCode'] = $templateLanguageCode; + + return $this; + } + + /** + * Gets discount + * + * @return \Cone\Billingo\Model\Discount|null + */ + public function getDiscount() + { + return $this->container['discount']; + } + + /** + * Sets discount + * + * @param \Cone\Billingo\Model\Discount|null $discount discount + * + * @return self + */ + public function setDiscount($discount) + { + if (is_null($discount)) { + throw new \InvalidArgumentException('non-nullable discount cannot be null'); + } + $this->container['discount'] = $discount; + + 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/src/Model/PartnerList.php b/src/Model/PartnerList.php new file mode 100644 index 0000000..d84fbe2 --- /dev/null +++ b/src/Model/PartnerList.php @@ -0,0 +1,615 @@ + + */ +class PartnerList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PartnerList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Cone\Billingo\Model\Partner[]', + 'total' => 'int', + 'perPage' => 'int', + 'currentPage' => 'int', + 'lastPage' => 'int', + 'prevPageUrl' => 'string', + 'nextPageUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'total' => null, + 'perPage' => null, + 'currentPage' => null, + 'lastPage' => null, + 'prevPageUrl' => null, + 'nextPageUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'total' => false, + 'perPage' => false, + 'currentPage' => false, + 'lastPage' => false, + 'prevPageUrl' => false, + 'nextPageUrl' => 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 = [ + 'data' => 'data', + 'total' => 'total', + 'perPage' => 'per_page', + 'currentPage' => 'current_page', + 'lastPage' => 'last_page', + 'prevPageUrl' => 'prev_page_url', + 'nextPageUrl' => 'next_page_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'total' => 'setTotal', + 'perPage' => 'setPerPage', + 'currentPage' => 'setCurrentPage', + 'lastPage' => 'setLastPage', + 'prevPageUrl' => 'setPrevPageUrl', + 'nextPageUrl' => 'setNextPageUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'total' => 'getTotal', + 'perPage' => 'getPerPage', + 'currentPage' => 'getCurrentPage', + 'lastPage' => 'getLastPage', + 'prevPageUrl' => 'getPrevPageUrl', + 'nextPageUrl' => 'getNextPageUrl' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('perPage', $data ?? [], null); + $this->setIfExists('currentPage', $data ?? [], null); + $this->setIfExists('lastPage', $data ?? [], null); + $this->setIfExists('prevPageUrl', $data ?? [], null); + $this->setIfExists('nextPageUrl', $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 data + * + * @return \Cone\Billingo\Model\Partner[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Cone\Billingo\Model\Partner[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total 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; + } + + /** + * Gets perPage + * + * @return int|null + */ + public function getPerPage() + { + return $this->container['perPage']; + } + + /** + * Sets perPage + * + * @param int|null $perPage perPage + * + * @return self + */ + public function setPerPage($perPage) + { + if (is_null($perPage)) { + throw new \InvalidArgumentException('non-nullable perPage cannot be null'); + } + $this->container['perPage'] = $perPage; + + return $this; + } + + /** + * Gets currentPage + * + * @return int|null + */ + public function getCurrentPage() + { + return $this->container['currentPage']; + } + + /** + * Sets currentPage + * + * @param int|null $currentPage currentPage + * + * @return self + */ + public function setCurrentPage($currentPage) + { + if (is_null($currentPage)) { + throw new \InvalidArgumentException('non-nullable currentPage cannot be null'); + } + $this->container['currentPage'] = $currentPage; + + return $this; + } + + /** + * Gets lastPage + * + * @return int|null + */ + public function getLastPage() + { + return $this->container['lastPage']; + } + + /** + * Sets lastPage + * + * @param int|null $lastPage lastPage + * + * @return self + */ + public function setLastPage($lastPage) + { + if (is_null($lastPage)) { + throw new \InvalidArgumentException('non-nullable lastPage cannot be null'); + } + $this->container['lastPage'] = $lastPage; + + return $this; + } + + /** + * Gets prevPageUrl + * + * @return string|null + */ + public function getPrevPageUrl() + { + return $this->container['prevPageUrl']; + } + + /** + * Sets prevPageUrl + * + * @param string|null $prevPageUrl prevPageUrl + * + * @return self + */ + public function setPrevPageUrl($prevPageUrl) + { + if (is_null($prevPageUrl)) { + throw new \InvalidArgumentException('non-nullable prevPageUrl cannot be null'); + } + $this->container['prevPageUrl'] = $prevPageUrl; + + return $this; + } + + /** + * Gets nextPageUrl + * + * @return string|null + */ + public function getNextPageUrl() + { + return $this->container['nextPageUrl']; + } + + /** + * Sets nextPageUrl + * + * @param string|null $nextPageUrl nextPageUrl + * + * @return self + */ + public function setNextPageUrl($nextPageUrl) + { + if (is_null($nextPageUrl)) { + throw new \InvalidArgumentException('non-nullable nextPageUrl cannot be null'); + } + $this->container['nextPageUrl'] = $nextPageUrl; + + 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/src/Model/PartnerTaxType.php b/src/Model/PartnerTaxType.php new file mode 100644 index 0000000..8866243 --- /dev/null +++ b/src/Model/PartnerTaxType.php @@ -0,0 +1,69 @@ + + */ +class PaymentHistory implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'PaymentHistory'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'date' => '\DateTime', + 'price' => 'float', + 'paymentMethod' => '\Cone\Billingo\Model\PaymentMethod', + 'voucherNumber' => 'string', + 'conversionRate' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'date' => 'date', + 'price' => 'float', + 'paymentMethod' => null, + 'voucherNumber' => null, + 'conversionRate' => 'float' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'date' => false, + 'price' => false, + 'paymentMethod' => false, + 'voucherNumber' => true, + 'conversionRate' => 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 = [ + 'date' => 'date', + 'price' => 'price', + 'paymentMethod' => 'payment_method', + 'voucherNumber' => 'voucher_number', + 'conversionRate' => 'conversion_rate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'date' => 'setDate', + 'price' => 'setPrice', + 'paymentMethod' => 'setPaymentMethod', + 'voucherNumber' => 'setVoucherNumber', + 'conversionRate' => 'setConversionRate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'date' => 'getDate', + 'price' => 'getPrice', + 'paymentMethod' => 'getPaymentMethod', + 'voucherNumber' => 'getVoucherNumber', + 'conversionRate' => 'getConversionRate' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('price', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('voucherNumber', $data ?? [], null); + $this->setIfExists('conversionRate', $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 ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + if ($this->container['price'] === null) { + $invalidProperties[] = "'price' can't be null"; + } + if ($this->container['paymentMethod'] === null) { + $invalidProperties[] = "'paymentMethod' can't be null"; + } + 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 date + * + * @return \DateTime + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime $date date + * + * @return self + */ + public function setDate($date) + { + if (is_null($date)) { + throw new \InvalidArgumentException('non-nullable date cannot be null'); + } + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets price + * + * @return float + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param float $price price + * + * @return self + */ + public function setPrice($price) + { + if (is_null($price)) { + throw new \InvalidArgumentException('non-nullable price cannot be null'); + } + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets paymentMethod + * + * @return \Cone\Billingo\Model\PaymentMethod + */ + public function getPaymentMethod() + { + return $this->container['paymentMethod']; + } + + /** + * Sets paymentMethod + * + * @param \Cone\Billingo\Model\PaymentMethod $paymentMethod paymentMethod + * + * @return self + */ + public function setPaymentMethod($paymentMethod) + { + if (is_null($paymentMethod)) { + throw new \InvalidArgumentException('non-nullable paymentMethod cannot be null'); + } + $this->container['paymentMethod'] = $paymentMethod; + + return $this; + } + + /** + * Gets voucherNumber + * + * @return string|null + */ + public function getVoucherNumber() + { + return $this->container['voucherNumber']; + } + + /** + * Sets voucherNumber + * + * @param string|null $voucherNumber voucherNumber + * + * @return self + */ + public function setVoucherNumber($voucherNumber) + { + if (is_null($voucherNumber)) { + array_push($this->openAPINullablesSetToNull, 'voucherNumber'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('voucherNumber', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['voucherNumber'] = $voucherNumber; + + return $this; + } + + /** + * Gets conversionRate + * + * @return float|null + */ + public function getConversionRate() + { + return $this->container['conversionRate']; + } + + /** + * Sets conversionRate + * + * @param float|null $conversionRate conversionRate + * + * @return self + */ + public function setConversionRate($conversionRate) + { + if (is_null($conversionRate)) { + array_push($this->openAPINullablesSetToNull, 'conversionRate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('conversionRate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['conversionRate'] = $conversionRate; + + 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/src/Model/PaymentMethod.php b/src/Model/PaymentMethod.php new file mode 100644 index 0000000..f9dbaf7 --- /dev/null +++ b/src/Model/PaymentMethod.php @@ -0,0 +1,141 @@ + + */ +class Product implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Product'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'comment' => 'string', + 'currency' => '\Cone\Billingo\Model\Currency', + 'vat' => '\Cone\Billingo\Model\Vat', + 'netUnitPrice' => 'float', + 'unit' => 'string', + 'generalLedgerNumber' => 'string', + 'generalLedgerTaxcode' => 'string', + 'entitlement' => '\Cone\Billingo\Model\Entitlement' + ]; + + /** + * 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, + 'comment' => null, + 'currency' => null, + 'vat' => null, + 'netUnitPrice' => 'float', + 'unit' => null, + 'generalLedgerNumber' => null, + 'generalLedgerTaxcode' => null, + 'entitlement' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'comment' => false, + 'currency' => false, + 'vat' => false, + 'netUnitPrice' => false, + 'unit' => false, + 'generalLedgerNumber' => false, + 'generalLedgerTaxcode' => false, + 'entitlement' => 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', + 'name' => 'name', + 'comment' => 'comment', + 'currency' => 'currency', + 'vat' => 'vat', + 'netUnitPrice' => 'net_unit_price', + 'unit' => 'unit', + 'generalLedgerNumber' => 'general_ledger_number', + 'generalLedgerTaxcode' => 'general_ledger_taxcode', + 'entitlement' => 'entitlement' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'comment' => 'setComment', + 'currency' => 'setCurrency', + 'vat' => 'setVat', + 'netUnitPrice' => 'setNetUnitPrice', + 'unit' => 'setUnit', + 'generalLedgerNumber' => 'setGeneralLedgerNumber', + 'generalLedgerTaxcode' => 'setGeneralLedgerTaxcode', + 'entitlement' => 'setEntitlement' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'comment' => 'getComment', + 'currency' => 'getCurrency', + 'vat' => 'getVat', + 'netUnitPrice' => 'getNetUnitPrice', + 'unit' => 'getUnit', + 'generalLedgerNumber' => 'getGeneralLedgerNumber', + 'generalLedgerTaxcode' => 'getGeneralLedgerTaxcode', + 'entitlement' => 'getEntitlement' + ]; + + /** + * 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[] $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('comment', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('vat', $data ?? [], null); + $this->setIfExists('netUnitPrice', $data ?? [], null); + $this->setIfExists('unit', $data ?? [], null); + $this->setIfExists('generalLedgerNumber', $data ?? [], null); + $this->setIfExists('generalLedgerTaxcode', $data ?? [], null); + $this->setIfExists('entitlement', $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 ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['vat'] === null) { + $invalidProperties[] = "'vat' can't be null"; + } + if ($this->container['unit'] === null) { + $invalidProperties[] = "'unit' can't be null"; + } + 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 name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + throw new \InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets currency + * + * @return \Cone\Billingo\Model\Currency + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Cone\Billingo\Model\Currency $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets vat + * + * @return \Cone\Billingo\Model\Vat + */ + public function getVat() + { + return $this->container['vat']; + } + + /** + * Sets vat + * + * @param \Cone\Billingo\Model\Vat $vat 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 netUnitPrice + * + * @return float|null + */ + public function getNetUnitPrice() + { + return $this->container['netUnitPrice']; + } + + /** + * Sets netUnitPrice + * + * @param float|null $netUnitPrice netUnitPrice + * + * @return self + */ + public function setNetUnitPrice($netUnitPrice) + { + if (is_null($netUnitPrice)) { + throw new \InvalidArgumentException('non-nullable netUnitPrice cannot be null'); + } + $this->container['netUnitPrice'] = $netUnitPrice; + + return $this; + } + + /** + * Gets unit + * + * @return string + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string $unit unit + * + * @return self + */ + public function setUnit($unit) + { + if (is_null($unit)) { + throw new \InvalidArgumentException('non-nullable unit cannot be null'); + } + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets generalLedgerNumber + * + * @return string|null + */ + public function getGeneralLedgerNumber() + { + return $this->container['generalLedgerNumber']; + } + + /** + * Sets generalLedgerNumber + * + * @param string|null $generalLedgerNumber generalLedgerNumber + * + * @return self + */ + public function setGeneralLedgerNumber($generalLedgerNumber) + { + if (is_null($generalLedgerNumber)) { + throw new \InvalidArgumentException('non-nullable generalLedgerNumber cannot be null'); + } + $this->container['generalLedgerNumber'] = $generalLedgerNumber; + + return $this; + } + + /** + * Gets generalLedgerTaxcode + * + * @return string|null + */ + public function getGeneralLedgerTaxcode() + { + return $this->container['generalLedgerTaxcode']; + } + + /** + * Sets generalLedgerTaxcode + * + * @param string|null $generalLedgerTaxcode generalLedgerTaxcode + * + * @return self + */ + public function setGeneralLedgerTaxcode($generalLedgerTaxcode) + { + if (is_null($generalLedgerTaxcode)) { + throw new \InvalidArgumentException('non-nullable generalLedgerTaxcode cannot be null'); + } + $this->container['generalLedgerTaxcode'] = $generalLedgerTaxcode; + + return $this; + } + + /** + * Gets entitlement + * + * @return \Cone\Billingo\Model\Entitlement|null + */ + public function getEntitlement() + { + return $this->container['entitlement']; + } + + /** + * Sets entitlement + * + * @param \Cone\Billingo\Model\Entitlement|null $entitlement entitlement + * + * @return self + */ + public function setEntitlement($entitlement) + { + if (is_null($entitlement)) { + throw new \InvalidArgumentException('non-nullable entitlement cannot be null'); + } + $this->container['entitlement'] = $entitlement; + + 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/src/Model/ProductList.php b/src/Model/ProductList.php new file mode 100644 index 0000000..fdf60a1 --- /dev/null +++ b/src/Model/ProductList.php @@ -0,0 +1,615 @@ + + */ +class ProductList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ProductList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Cone\Billingo\Model\Product[]', + 'total' => 'int', + 'perPage' => 'int', + 'currentPage' => 'int', + 'lastPage' => 'int', + 'prevPageUrl' => 'string', + 'nextPageUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'total' => null, + 'perPage' => null, + 'currentPage' => null, + 'lastPage' => null, + 'prevPageUrl' => null, + 'nextPageUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'total' => false, + 'perPage' => false, + 'currentPage' => false, + 'lastPage' => false, + 'prevPageUrl' => false, + 'nextPageUrl' => 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 = [ + 'data' => 'data', + 'total' => 'total', + 'perPage' => 'per_page', + 'currentPage' => 'current_page', + 'lastPage' => 'last_page', + 'prevPageUrl' => 'prev_page_url', + 'nextPageUrl' => 'next_page_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'total' => 'setTotal', + 'perPage' => 'setPerPage', + 'currentPage' => 'setCurrentPage', + 'lastPage' => 'setLastPage', + 'prevPageUrl' => 'setPrevPageUrl', + 'nextPageUrl' => 'setNextPageUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'total' => 'getTotal', + 'perPage' => 'getPerPage', + 'currentPage' => 'getCurrentPage', + 'lastPage' => 'getLastPage', + 'prevPageUrl' => 'getPrevPageUrl', + 'nextPageUrl' => 'getNextPageUrl' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('perPage', $data ?? [], null); + $this->setIfExists('currentPage', $data ?? [], null); + $this->setIfExists('lastPage', $data ?? [], null); + $this->setIfExists('prevPageUrl', $data ?? [], null); + $this->setIfExists('nextPageUrl', $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 data + * + * @return \Cone\Billingo\Model\Product[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Cone\Billingo\Model\Product[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total 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; + } + + /** + * Gets perPage + * + * @return int|null + */ + public function getPerPage() + { + return $this->container['perPage']; + } + + /** + * Sets perPage + * + * @param int|null $perPage perPage + * + * @return self + */ + public function setPerPage($perPage) + { + if (is_null($perPage)) { + throw new \InvalidArgumentException('non-nullable perPage cannot be null'); + } + $this->container['perPage'] = $perPage; + + return $this; + } + + /** + * Gets currentPage + * + * @return int|null + */ + public function getCurrentPage() + { + return $this->container['currentPage']; + } + + /** + * Sets currentPage + * + * @param int|null $currentPage currentPage + * + * @return self + */ + public function setCurrentPage($currentPage) + { + if (is_null($currentPage)) { + throw new \InvalidArgumentException('non-nullable currentPage cannot be null'); + } + $this->container['currentPage'] = $currentPage; + + return $this; + } + + /** + * Gets lastPage + * + * @return int|null + */ + public function getLastPage() + { + return $this->container['lastPage']; + } + + /** + * Sets lastPage + * + * @param int|null $lastPage lastPage + * + * @return self + */ + public function setLastPage($lastPage) + { + if (is_null($lastPage)) { + throw new \InvalidArgumentException('non-nullable lastPage cannot be null'); + } + $this->container['lastPage'] = $lastPage; + + return $this; + } + + /** + * Gets prevPageUrl + * + * @return string|null + */ + public function getPrevPageUrl() + { + return $this->container['prevPageUrl']; + } + + /** + * Sets prevPageUrl + * + * @param string|null $prevPageUrl prevPageUrl + * + * @return self + */ + public function setPrevPageUrl($prevPageUrl) + { + if (is_null($prevPageUrl)) { + throw new \InvalidArgumentException('non-nullable prevPageUrl cannot be null'); + } + $this->container['prevPageUrl'] = $prevPageUrl; + + return $this; + } + + /** + * Gets nextPageUrl + * + * @return string|null + */ + public function getNextPageUrl() + { + return $this->container['nextPageUrl']; + } + + /** + * Sets nextPageUrl + * + * @param string|null $nextPageUrl nextPageUrl + * + * @return self + */ + public function setNextPageUrl($nextPageUrl) + { + if (is_null($nextPageUrl)) { + throw new \InvalidArgumentException('non-nullable nextPageUrl cannot be null'); + } + $this->container['nextPageUrl'] = $nextPageUrl; + + 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/src/Model/ReceiptInsert.php b/src/Model/ReceiptInsert.php new file mode 100644 index 0000000..dc311a5 --- /dev/null +++ b/src/Model/ReceiptInsert.php @@ -0,0 +1,762 @@ + + */ +class ReceiptInsert implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReceiptInsert'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'vendorId' => 'string', + 'partnerId' => 'int', + 'name' => 'string', + 'emails' => 'string[]', + 'blockId' => 'int', + 'type' => '\Cone\Billingo\Model\DocumentType', + 'paymentMethod' => '\Cone\Billingo\Model\PaymentMethod', + 'currency' => '\Cone\Billingo\Model\Currency', + 'conversionRate' => 'float', + 'electronic' => 'bool', + 'items' => '\Cone\Billingo\Model\ReceiptInsertItemsInner[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'vendorId' => null, + 'partnerId' => null, + 'name' => null, + 'emails' => null, + 'blockId' => null, + 'type' => null, + 'paymentMethod' => null, + 'currency' => null, + 'conversionRate' => 'float', + 'electronic' => null, + 'items' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'vendorId' => false, + 'partnerId' => false, + 'name' => false, + 'emails' => false, + 'blockId' => false, + 'type' => false, + 'paymentMethod' => false, + 'currency' => false, + 'conversionRate' => false, + 'electronic' => false, + 'items' => 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 = [ + 'vendorId' => 'vendor_id', + 'partnerId' => 'partner_id', + 'name' => 'name', + 'emails' => 'emails', + 'blockId' => 'block_id', + 'type' => 'type', + 'paymentMethod' => 'payment_method', + 'currency' => 'currency', + 'conversionRate' => 'conversion_rate', + 'electronic' => 'electronic', + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'vendorId' => 'setVendorId', + 'partnerId' => 'setPartnerId', + 'name' => 'setName', + 'emails' => 'setEmails', + 'blockId' => 'setBlockId', + 'type' => 'setType', + 'paymentMethod' => 'setPaymentMethod', + 'currency' => 'setCurrency', + 'conversionRate' => 'setConversionRate', + 'electronic' => 'setElectronic', + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'vendorId' => 'getVendorId', + 'partnerId' => 'getPartnerId', + 'name' => 'getName', + 'emails' => 'getEmails', + 'blockId' => 'getBlockId', + 'type' => 'getType', + 'paymentMethod' => 'getPaymentMethod', + 'currency' => 'getCurrency', + 'conversionRate' => 'getConversionRate', + 'electronic' => 'getElectronic', + 'items' => 'getItems' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('vendorId', $data ?? [], null); + $this->setIfExists('partnerId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('emails', $data ?? [], null); + $this->setIfExists('blockId', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('conversionRate', $data ?? [], null); + $this->setIfExists('electronic', $data ?? [], false); + $this->setIfExists('items', $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 ($this->container['blockId'] === null) { + $invalidProperties[] = "'blockId' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + if ($this->container['paymentMethod'] === null) { + $invalidProperties[] = "'paymentMethod' can't be null"; + } + if ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + 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 vendorId + * + * @return string|null + */ + public function getVendorId() + { + return $this->container['vendorId']; + } + + /** + * Sets vendorId + * + * @param string|null $vendorId vendorId + * + * @return self + */ + public function setVendorId($vendorId) + { + if (is_null($vendorId)) { + throw new \InvalidArgumentException('non-nullable vendorId cannot be null'); + } + $this->container['vendorId'] = $vendorId; + + return $this; + } + + /** + * Gets partnerId + * + * @return int|null + */ + public function getPartnerId() + { + return $this->container['partnerId']; + } + + /** + * Sets partnerId + * + * @param int|null $partnerId partnerId + * + * @return self + */ + public function setPartnerId($partnerId) + { + if (is_null($partnerId)) { + throw new \InvalidArgumentException('non-nullable partnerId cannot be null'); + } + $this->container['partnerId'] = $partnerId; + + 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)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets emails + * + * @return string[]|null + */ + public function getEmails() + { + return $this->container['emails']; + } + + /** + * Sets emails + * + * @param string[]|null $emails emails + * + * @return self + */ + public function setEmails($emails) + { + if (is_null($emails)) { + throw new \InvalidArgumentException('non-nullable emails cannot be null'); + } + $this->container['emails'] = $emails; + + return $this; + } + + /** + * Gets blockId + * + * @return int + */ + public function getBlockId() + { + return $this->container['blockId']; + } + + /** + * Sets blockId + * + * @param int $blockId blockId + * + * @return self + */ + public function setBlockId($blockId) + { + if (is_null($blockId)) { + throw new \InvalidArgumentException('non-nullable blockId cannot be null'); + } + $this->container['blockId'] = $blockId; + + return $this; + } + + /** + * Gets type + * + * @return \Cone\Billingo\Model\DocumentType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Cone\Billingo\Model\DocumentType $type type + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets paymentMethod + * + * @return \Cone\Billingo\Model\PaymentMethod + */ + public function getPaymentMethod() + { + return $this->container['paymentMethod']; + } + + /** + * Sets paymentMethod + * + * @param \Cone\Billingo\Model\PaymentMethod $paymentMethod paymentMethod + * + * @return self + */ + public function setPaymentMethod($paymentMethod) + { + if (is_null($paymentMethod)) { + throw new \InvalidArgumentException('non-nullable paymentMethod cannot be null'); + } + $this->container['paymentMethod'] = $paymentMethod; + + return $this; + } + + /** + * Gets currency + * + * @return \Cone\Billingo\Model\Currency + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Cone\Billingo\Model\Currency $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets conversionRate + * + * @return float|null + */ + public function getConversionRate() + { + return $this->container['conversionRate']; + } + + /** + * Sets conversionRate + * + * @param float|null $conversionRate conversionRate + * + * @return self + */ + public function setConversionRate($conversionRate) + { + if (is_null($conversionRate)) { + throw new \InvalidArgumentException('non-nullable conversionRate cannot be null'); + } + $this->container['conversionRate'] = $conversionRate; + + return $this; + } + + /** + * Gets electronic + * + * @return bool|null + */ + public function getElectronic() + { + return $this->container['electronic']; + } + + /** + * Sets electronic + * + * @param bool|null $electronic electronic + * + * @return self + */ + public function setElectronic($electronic) + { + if (is_null($electronic)) { + throw new \InvalidArgumentException('non-nullable electronic cannot be null'); + } + $this->container['electronic'] = $electronic; + + return $this; + } + + /** + * Gets items + * + * @return \Cone\Billingo\Model\ReceiptInsertItemsInner[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Cone\Billingo\Model\ReceiptInsertItemsInner[]|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; + } + /** + * 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/src/Model/ReceiptInsertItemsInner.php b/src/Model/ReceiptInsertItemsInner.php new file mode 100644 index 0000000..08c12af --- /dev/null +++ b/src/Model/ReceiptInsertItemsInner.php @@ -0,0 +1,521 @@ + + */ +class ReceiptInsertItemsInner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReceiptInsert_items_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'productId' => 'int', + 'name' => 'string', + 'unitPrice' => 'float', + 'vat' => '\Cone\Billingo\Model\Vat' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'productId' => null, + 'name' => null, + 'unitPrice' => 'float', + 'vat' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'productId' => false, + 'name' => false, + 'unitPrice' => false, + 'vat' => 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 = [ + 'productId' => 'product_id', + 'name' => 'name', + 'unitPrice' => 'unit_price', + 'vat' => 'vat' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'productId' => 'setProductId', + 'name' => 'setName', + 'unitPrice' => 'setUnitPrice', + 'vat' => 'setVat' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'productId' => 'getProductId', + 'name' => 'getName', + 'unitPrice' => 'getUnitPrice', + 'vat' => 'getVat' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('productId', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('unitPrice', $data ?? [], null); + $this->setIfExists('vat', $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 ($this->container['productId'] === null) { + $invalidProperties[] = "'productId' can't be null"; + } + if ($this->container['unitPrice'] === null) { + $invalidProperties[] = "'unitPrice' can't be null"; + } + if ($this->container['vat'] === null) { + $invalidProperties[] = "'vat' can't be null"; + } + 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 productId + * + * @return int + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param int $productId productId + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + 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)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets unitPrice + * + * @return float + */ + public function getUnitPrice() + { + return $this->container['unitPrice']; + } + + /** + * Sets unitPrice + * + * @param float $unitPrice unitPrice + * + * @return self + */ + public function setUnitPrice($unitPrice) + { + if (is_null($unitPrice)) { + throw new \InvalidArgumentException('non-nullable unitPrice cannot be null'); + } + $this->container['unitPrice'] = $unitPrice; + + return $this; + } + + /** + * Gets vat + * + * @return \Cone\Billingo\Model\Vat + */ + public function getVat() + { + return $this->container['vat']; + } + + /** + * Sets vat + * + * @param \Cone\Billingo\Model\Vat $vat 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; + } + /** + * 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/src/Model/ReceiptItemData.php b/src/Model/ReceiptItemData.php new file mode 100644 index 0000000..5b6d85c --- /dev/null +++ b/src/Model/ReceiptItemData.php @@ -0,0 +1,413 @@ + + */ +class ReceiptItemData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReceiptItemData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'productId' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'productId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'productId' => 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 = [ + 'productId' => 'product_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'productId' => 'setProductId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'productId' => 'getProductId' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('productId', $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 ($this->container['productId'] === null) { + $invalidProperties[] = "'productId' can't be null"; + } + 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 productId + * + * @return int + */ + public function getProductId() + { + return $this->container['productId']; + } + + /** + * Sets productId + * + * @param int $productId productId + * + * @return self + */ + public function setProductId($productId) + { + if (is_null($productId)) { + throw new \InvalidArgumentException('non-nullable productId cannot be null'); + } + $this->container['productId'] = $productId; + + 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/src/Model/ReceiptProductData.php b/src/Model/ReceiptProductData.php new file mode 100644 index 0000000..a01d4ef --- /dev/null +++ b/src/Model/ReceiptProductData.php @@ -0,0 +1,484 @@ + + */ +class ReceiptProductData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ReceiptProductData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'unitPrice' => 'float', + 'vat' => '\Cone\Billingo\Model\Vat' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'unitPrice' => 'float', + 'vat' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'unitPrice' => false, + 'vat' => 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 = [ + 'name' => 'name', + 'unitPrice' => 'unit_price', + 'vat' => 'vat' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'unitPrice' => 'setUnitPrice', + 'vat' => 'setVat' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'unitPrice' => 'getUnitPrice', + 'vat' => 'getVat' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('unitPrice', $data ?? [], null); + $this->setIfExists('vat', $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 ($this->container['unitPrice'] === null) { + $invalidProperties[] = "'unitPrice' can't be null"; + } + if ($this->container['vat'] === null) { + $invalidProperties[] = "'vat' can't be null"; + } + 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 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)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets unitPrice + * + * @return float + */ + public function getUnitPrice() + { + return $this->container['unitPrice']; + } + + /** + * Sets unitPrice + * + * @param float $unitPrice unitPrice + * + * @return self + */ + public function setUnitPrice($unitPrice) + { + if (is_null($unitPrice)) { + throw new \InvalidArgumentException('non-nullable unitPrice cannot be null'); + } + $this->container['unitPrice'] = $unitPrice; + + return $this; + } + + /** + * Gets vat + * + * @return \Cone\Billingo\Model\Vat + */ + public function getVat() + { + return $this->container['vat']; + } + + /** + * Sets vat + * + * @param \Cone\Billingo\Model\Vat $vat 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; + } + /** + * 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/src/Model/Round.php b/src/Model/Round.php new file mode 100644 index 0000000..763c112 --- /dev/null +++ b/src/Model/Round.php @@ -0,0 +1,69 @@ + + */ +class SendDocument implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SendDocument'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'emails' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'emails' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'emails' => 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 = [ + 'emails' => 'emails' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'emails' => 'setEmails' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'emails' => 'getEmails' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('emails', $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 emails + * + * @return string[]|null + */ + public function getEmails() + { + return $this->container['emails']; + } + + /** + * Sets emails + * + * @param string[]|null $emails emails + * + * @return self + */ + public function setEmails($emails) + { + if (is_null($emails)) { + throw new \InvalidArgumentException('non-nullable emails cannot be null'); + } + $this->container['emails'] = $emails; + + 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/src/Model/ServerError.php b/src/Model/ServerError.php new file mode 100644 index 0000000..75fa303 --- /dev/null +++ b/src/Model/ServerError.php @@ -0,0 +1,444 @@ + + */ +class ServerError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ServerError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'traceId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'traceId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'traceId' => 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 = [ + 'message' => 'message', + 'traceId' => 'trace_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'traceId' => 'setTraceId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'traceId' => 'getTraceId' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('traceId', $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 message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets traceId + * + * @return string|null + */ + public function getTraceId() + { + return $this->container['traceId']; + } + + /** + * Sets traceId + * + * @param string|null $traceId You should send us this ID to investigate the issue. + * + * @return self + */ + public function setTraceId($traceId) + { + if (is_null($traceId)) { + throw new \InvalidArgumentException('non-nullable traceId cannot be null'); + } + $this->container['traceId'] = $traceId; + + 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/src/Model/ServerErrorResponse.php b/src/Model/ServerErrorResponse.php new file mode 100644 index 0000000..e6d515a --- /dev/null +++ b/src/Model/ServerErrorResponse.php @@ -0,0 +1,410 @@ + + */ +class ServerErrorResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ServerErrorResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => '\Cone\Billingo\Model\ServerError' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => 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 = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error' => 'getError' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $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 error + * + * @return \Cone\Billingo\Model\ServerError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \Cone\Billingo\Model\ServerError|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + 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/src/Model/ServerTime.php b/src/Model/ServerTime.php new file mode 100644 index 0000000..eba24d1 --- /dev/null +++ b/src/Model/ServerTime.php @@ -0,0 +1,512 @@ + + */ +class ServerTime implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ServerTime'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'epoch' => 'int', + 'formatted' => 'string', + 'w3c' => 'string', + 'timezone' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'epoch' => null, + 'formatted' => null, + 'w3c' => null, + 'timezone' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'epoch' => false, + 'formatted' => false, + 'w3c' => false, + 'timezone' => 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 = [ + 'epoch' => 'epoch', + 'formatted' => 'formatted', + 'w3c' => 'w3c', + 'timezone' => 'timezone' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'epoch' => 'setEpoch', + 'formatted' => 'setFormatted', + 'w3c' => 'setW3c', + 'timezone' => 'setTimezone' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'epoch' => 'getEpoch', + 'formatted' => 'getFormatted', + 'w3c' => 'getW3c', + 'timezone' => 'getTimezone' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('epoch', $data ?? [], null); + $this->setIfExists('formatted', $data ?? [], null); + $this->setIfExists('w3c', $data ?? [], null); + $this->setIfExists('timezone', $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 epoch + * + * @return int|null + */ + public function getEpoch() + { + return $this->container['epoch']; + } + + /** + * Sets epoch + * + * @param int|null $epoch epoch + * + * @return self + */ + public function setEpoch($epoch) + { + if (is_null($epoch)) { + throw new \InvalidArgumentException('non-nullable epoch cannot be null'); + } + $this->container['epoch'] = $epoch; + + return $this; + } + + /** + * Gets formatted + * + * @return string|null + */ + public function getFormatted() + { + return $this->container['formatted']; + } + + /** + * Sets formatted + * + * @param string|null $formatted formatted + * + * @return self + */ + public function setFormatted($formatted) + { + if (is_null($formatted)) { + throw new \InvalidArgumentException('non-nullable formatted cannot be null'); + } + $this->container['formatted'] = $formatted; + + return $this; + } + + /** + * Gets w3c + * + * @return string|null + */ + public function getW3c() + { + return $this->container['w3c']; + } + + /** + * Sets w3c + * + * @param string|null $w3c w3c + * + * @return self + */ + public function setW3c($w3c) + { + if (is_null($w3c)) { + throw new \InvalidArgumentException('non-nullable w3c cannot be null'); + } + $this->container['w3c'] = $w3c; + + return $this; + } + + /** + * Gets timezone + * + * @return string|null + */ + public function getTimezone() + { + return $this->container['timezone']; + } + + /** + * Sets timezone + * + * @param string|null $timezone timezone + * + * @return self + */ + public function setTimezone($timezone) + { + if (is_null($timezone)) { + throw new \InvalidArgumentException('non-nullable timezone cannot be null'); + } + $this->container['timezone'] = $timezone; + + 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/src/Model/Source.php b/src/Model/Source.php new file mode 100644 index 0000000..e2678de --- /dev/null +++ b/src/Model/Source.php @@ -0,0 +1,66 @@ + + */ +class Spending implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Spending'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'organizationId' => 'int', + 'category' => '\Cone\Billingo\Model\Category', + 'paidAt' => '\DateTime', + 'fulfillmentDate' => '\DateTime', + 'partner' => '\Cone\Billingo\Model\SpendingPartner', + 'invoiceNumber' => 'string', + 'currency' => '\Cone\Billingo\Model\Currency', + 'conversionRate' => 'float', + 'totalGross' => 'float', + 'totalGrossLocal' => 'float', + 'totalVatAmount' => 'float', + 'totalVatAmountLocal' => 'float', + 'invoiceDate' => '\DateTime', + 'dueDate' => '\DateTime', + 'paymentMethod' => '\Cone\Billingo\Model\SpendingPaymentMethod', + 'comment' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'organizationId' => null, + 'category' => null, + 'paidAt' => 'date', + 'fulfillmentDate' => 'date', + 'partner' => null, + 'invoiceNumber' => null, + 'currency' => null, + 'conversionRate' => 'float', + 'totalGross' => 'float', + 'totalGrossLocal' => 'float', + 'totalVatAmount' => 'float', + 'totalVatAmountLocal' => 'float', + 'invoiceDate' => 'date', + 'dueDate' => 'date', + 'paymentMethod' => null, + 'comment' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'organizationId' => false, + 'category' => false, + 'paidAt' => true, + 'fulfillmentDate' => false, + 'partner' => false, + 'invoiceNumber' => false, + 'currency' => false, + 'conversionRate' => false, + 'totalGross' => false, + 'totalGrossLocal' => false, + 'totalVatAmount' => false, + 'totalVatAmountLocal' => false, + 'invoiceDate' => false, + 'dueDate' => false, + 'paymentMethod' => false, + 'comment' => 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', + 'organizationId' => 'organization_id', + 'category' => 'category', + 'paidAt' => 'paid_at', + 'fulfillmentDate' => 'fulfillment_date', + 'partner' => 'partner', + 'invoiceNumber' => 'invoice_number', + 'currency' => 'currency', + 'conversionRate' => 'conversion_rate', + 'totalGross' => 'total_gross', + 'totalGrossLocal' => 'total_gross_local', + 'totalVatAmount' => 'total_vat_amount', + 'totalVatAmountLocal' => 'total_vat_amount_local', + 'invoiceDate' => 'invoice_date', + 'dueDate' => 'due_date', + 'paymentMethod' => 'payment_method', + 'comment' => 'comment' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'organizationId' => 'setOrganizationId', + 'category' => 'setCategory', + 'paidAt' => 'setPaidAt', + 'fulfillmentDate' => 'setFulfillmentDate', + 'partner' => 'setPartner', + 'invoiceNumber' => 'setInvoiceNumber', + 'currency' => 'setCurrency', + 'conversionRate' => 'setConversionRate', + 'totalGross' => 'setTotalGross', + 'totalGrossLocal' => 'setTotalGrossLocal', + 'totalVatAmount' => 'setTotalVatAmount', + 'totalVatAmountLocal' => 'setTotalVatAmountLocal', + 'invoiceDate' => 'setInvoiceDate', + 'dueDate' => 'setDueDate', + 'paymentMethod' => 'setPaymentMethod', + 'comment' => 'setComment' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'organizationId' => 'getOrganizationId', + 'category' => 'getCategory', + 'paidAt' => 'getPaidAt', + 'fulfillmentDate' => 'getFulfillmentDate', + 'partner' => 'getPartner', + 'invoiceNumber' => 'getInvoiceNumber', + 'currency' => 'getCurrency', + 'conversionRate' => 'getConversionRate', + 'totalGross' => 'getTotalGross', + 'totalGrossLocal' => 'getTotalGrossLocal', + 'totalVatAmount' => 'getTotalVatAmount', + 'totalVatAmountLocal' => 'getTotalVatAmountLocal', + 'invoiceDate' => 'getInvoiceDate', + 'dueDate' => 'getDueDate', + 'paymentMethod' => 'getPaymentMethod', + 'comment' => 'getComment' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('organizationId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('paidAt', $data ?? [], null); + $this->setIfExists('fulfillmentDate', $data ?? [], null); + $this->setIfExists('partner', $data ?? [], null); + $this->setIfExists('invoiceNumber', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('conversionRate', $data ?? [], null); + $this->setIfExists('totalGross', $data ?? [], null); + $this->setIfExists('totalGrossLocal', $data ?? [], null); + $this->setIfExists('totalVatAmount', $data ?? [], null); + $this->setIfExists('totalVatAmountLocal', $data ?? [], null); + $this->setIfExists('invoiceDate', $data ?? [], null); + $this->setIfExists('dueDate', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('comment', $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 organizationId + * + * @return int|null + */ + public function getOrganizationId() + { + return $this->container['organizationId']; + } + + /** + * Sets organizationId + * + * @param int|null $organizationId organizationId + * + * @return self + */ + public function setOrganizationId($organizationId) + { + if (is_null($organizationId)) { + throw new \InvalidArgumentException('non-nullable organizationId cannot be null'); + } + $this->container['organizationId'] = $organizationId; + + return $this; + } + + /** + * Gets category + * + * @return \Cone\Billingo\Model\Category|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param \Cone\Billingo\Model\Category|null $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets paidAt + * + * @return \DateTime|null + */ + public function getPaidAt() + { + return $this->container['paidAt']; + } + + /** + * Sets paidAt + * + * @param \DateTime|null $paidAt paidAt + * + * @return self + */ + public function setPaidAt($paidAt) + { + if (is_null($paidAt)) { + array_push($this->openAPINullablesSetToNull, 'paidAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('paidAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['paidAt'] = $paidAt; + + return $this; + } + + /** + * Gets fulfillmentDate + * + * @return \DateTime|null + */ + public function getFulfillmentDate() + { + return $this->container['fulfillmentDate']; + } + + /** + * Sets fulfillmentDate + * + * @param \DateTime|null $fulfillmentDate fulfillmentDate + * + * @return self + */ + public function setFulfillmentDate($fulfillmentDate) + { + if (is_null($fulfillmentDate)) { + throw new \InvalidArgumentException('non-nullable fulfillmentDate cannot be null'); + } + $this->container['fulfillmentDate'] = $fulfillmentDate; + + return $this; + } + + /** + * Gets partner + * + * @return \Cone\Billingo\Model\SpendingPartner|null + */ + public function getPartner() + { + return $this->container['partner']; + } + + /** + * Sets partner + * + * @param \Cone\Billingo\Model\SpendingPartner|null $partner partner + * + * @return self + */ + public function setPartner($partner) + { + if (is_null($partner)) { + throw new \InvalidArgumentException('non-nullable partner cannot be null'); + } + $this->container['partner'] = $partner; + + return $this; + } + + /** + * Gets invoiceNumber + * + * @return string|null + */ + public function getInvoiceNumber() + { + return $this->container['invoiceNumber']; + } + + /** + * Sets invoiceNumber + * + * @param string|null $invoiceNumber invoiceNumber + * + * @return self + */ + public function setInvoiceNumber($invoiceNumber) + { + if (is_null($invoiceNumber)) { + throw new \InvalidArgumentException('non-nullable invoiceNumber cannot be null'); + } + $this->container['invoiceNumber'] = $invoiceNumber; + + return $this; + } + + /** + * Gets currency + * + * @return \Cone\Billingo\Model\Currency|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Cone\Billingo\Model\Currency|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets conversionRate + * + * @return float|null + */ + public function getConversionRate() + { + return $this->container['conversionRate']; + } + + /** + * Sets conversionRate + * + * @param float|null $conversionRate conversionRate + * + * @return self + */ + public function setConversionRate($conversionRate) + { + if (is_null($conversionRate)) { + throw new \InvalidArgumentException('non-nullable conversionRate cannot be null'); + } + $this->container['conversionRate'] = $conversionRate; + + return $this; + } + + /** + * Gets totalGross + * + * @return float|null + */ + public function getTotalGross() + { + return $this->container['totalGross']; + } + + /** + * Sets totalGross + * + * @param float|null $totalGross totalGross + * + * @return self + */ + public function setTotalGross($totalGross) + { + if (is_null($totalGross)) { + throw new \InvalidArgumentException('non-nullable totalGross cannot be null'); + } + $this->container['totalGross'] = $totalGross; + + return $this; + } + + /** + * Gets totalGrossLocal + * + * @return float|null + */ + public function getTotalGrossLocal() + { + return $this->container['totalGrossLocal']; + } + + /** + * Sets totalGrossLocal + * + * @param float|null $totalGrossLocal totalGrossLocal + * + * @return self + */ + public function setTotalGrossLocal($totalGrossLocal) + { + if (is_null($totalGrossLocal)) { + throw new \InvalidArgumentException('non-nullable totalGrossLocal cannot be null'); + } + $this->container['totalGrossLocal'] = $totalGrossLocal; + + return $this; + } + + /** + * Gets totalVatAmount + * + * @return float|null + */ + public function getTotalVatAmount() + { + return $this->container['totalVatAmount']; + } + + /** + * Sets totalVatAmount + * + * @param float|null $totalVatAmount totalVatAmount + * + * @return self + */ + public function setTotalVatAmount($totalVatAmount) + { + if (is_null($totalVatAmount)) { + throw new \InvalidArgumentException('non-nullable totalVatAmount cannot be null'); + } + $this->container['totalVatAmount'] = $totalVatAmount; + + return $this; + } + + /** + * Gets totalVatAmountLocal + * + * @return float|null + */ + public function getTotalVatAmountLocal() + { + return $this->container['totalVatAmountLocal']; + } + + /** + * Sets totalVatAmountLocal + * + * @param float|null $totalVatAmountLocal totalVatAmountLocal + * + * @return self + */ + public function setTotalVatAmountLocal($totalVatAmountLocal) + { + if (is_null($totalVatAmountLocal)) { + throw new \InvalidArgumentException('non-nullable totalVatAmountLocal cannot be null'); + } + $this->container['totalVatAmountLocal'] = $totalVatAmountLocal; + + return $this; + } + + /** + * Gets invoiceDate + * + * @return \DateTime|null + */ + public function getInvoiceDate() + { + return $this->container['invoiceDate']; + } + + /** + * Sets invoiceDate + * + * @param \DateTime|null $invoiceDate invoiceDate + * + * @return self + */ + public function setInvoiceDate($invoiceDate) + { + if (is_null($invoiceDate)) { + throw new \InvalidArgumentException('non-nullable invoiceDate cannot be null'); + } + $this->container['invoiceDate'] = $invoiceDate; + + return $this; + } + + /** + * Gets dueDate + * + * @return \DateTime|null + */ + public function getDueDate() + { + return $this->container['dueDate']; + } + + /** + * Sets dueDate + * + * @param \DateTime|null $dueDate dueDate + * + * @return self + */ + public function setDueDate($dueDate) + { + if (is_null($dueDate)) { + throw new \InvalidArgumentException('non-nullable dueDate cannot be null'); + } + $this->container['dueDate'] = $dueDate; + + return $this; + } + + /** + * Gets paymentMethod + * + * @return \Cone\Billingo\Model\SpendingPaymentMethod|null + */ + public function getPaymentMethod() + { + return $this->container['paymentMethod']; + } + + /** + * Sets paymentMethod + * + * @param \Cone\Billingo\Model\SpendingPaymentMethod|null $paymentMethod paymentMethod + * + * @return self + */ + public function setPaymentMethod($paymentMethod) + { + if (is_null($paymentMethod)) { + throw new \InvalidArgumentException('non-nullable paymentMethod cannot be null'); + } + $this->container['paymentMethod'] = $paymentMethod; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + array_push($this->openAPINullablesSetToNull, 'comment'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('comment', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['comment'] = $comment; + + 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/src/Model/SpendingList.php b/src/Model/SpendingList.php new file mode 100644 index 0000000..3dd8cef --- /dev/null +++ b/src/Model/SpendingList.php @@ -0,0 +1,615 @@ + + */ +class SpendingList implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SpendingList'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Cone\Billingo\Model\SpendingListItem[]', + 'total' => 'int', + 'perPage' => 'int', + 'currentPage' => 'int', + 'lastPage' => 'int', + 'prevPageUrl' => 'string', + 'nextPageUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'total' => null, + 'perPage' => null, + 'currentPage' => null, + 'lastPage' => null, + 'prevPageUrl' => null, + 'nextPageUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'total' => false, + 'perPage' => false, + 'currentPage' => false, + 'lastPage' => false, + 'prevPageUrl' => false, + 'nextPageUrl' => 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 = [ + 'data' => 'data', + 'total' => 'total', + 'perPage' => 'per_page', + 'currentPage' => 'current_page', + 'lastPage' => 'last_page', + 'prevPageUrl' => 'prev_page_url', + 'nextPageUrl' => 'next_page_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'total' => 'setTotal', + 'perPage' => 'setPerPage', + 'currentPage' => 'setCurrentPage', + 'lastPage' => 'setLastPage', + 'prevPageUrl' => 'setPrevPageUrl', + 'nextPageUrl' => 'setNextPageUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'total' => 'getTotal', + 'perPage' => 'getPerPage', + 'currentPage' => 'getCurrentPage', + 'lastPage' => 'getLastPage', + 'prevPageUrl' => 'getPrevPageUrl', + 'nextPageUrl' => 'getNextPageUrl' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('perPage', $data ?? [], null); + $this->setIfExists('currentPage', $data ?? [], null); + $this->setIfExists('lastPage', $data ?? [], null); + $this->setIfExists('prevPageUrl', $data ?? [], null); + $this->setIfExists('nextPageUrl', $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 data + * + * @return \Cone\Billingo\Model\SpendingListItem[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Cone\Billingo\Model\SpendingListItem[]|null $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total 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; + } + + /** + * Gets perPage + * + * @return int|null + */ + public function getPerPage() + { + return $this->container['perPage']; + } + + /** + * Sets perPage + * + * @param int|null $perPage perPage + * + * @return self + */ + public function setPerPage($perPage) + { + if (is_null($perPage)) { + throw new \InvalidArgumentException('non-nullable perPage cannot be null'); + } + $this->container['perPage'] = $perPage; + + return $this; + } + + /** + * Gets currentPage + * + * @return int|null + */ + public function getCurrentPage() + { + return $this->container['currentPage']; + } + + /** + * Sets currentPage + * + * @param int|null $currentPage currentPage + * + * @return self + */ + public function setCurrentPage($currentPage) + { + if (is_null($currentPage)) { + throw new \InvalidArgumentException('non-nullable currentPage cannot be null'); + } + $this->container['currentPage'] = $currentPage; + + return $this; + } + + /** + * Gets lastPage + * + * @return int|null + */ + public function getLastPage() + { + return $this->container['lastPage']; + } + + /** + * Sets lastPage + * + * @param int|null $lastPage lastPage + * + * @return self + */ + public function setLastPage($lastPage) + { + if (is_null($lastPage)) { + throw new \InvalidArgumentException('non-nullable lastPage cannot be null'); + } + $this->container['lastPage'] = $lastPage; + + return $this; + } + + /** + * Gets prevPageUrl + * + * @return string|null + */ + public function getPrevPageUrl() + { + return $this->container['prevPageUrl']; + } + + /** + * Sets prevPageUrl + * + * @param string|null $prevPageUrl prevPageUrl + * + * @return self + */ + public function setPrevPageUrl($prevPageUrl) + { + if (is_null($prevPageUrl)) { + throw new \InvalidArgumentException('non-nullable prevPageUrl cannot be null'); + } + $this->container['prevPageUrl'] = $prevPageUrl; + + return $this; + } + + /** + * Gets nextPageUrl + * + * @return string|null + */ + public function getNextPageUrl() + { + return $this->container['nextPageUrl']; + } + + /** + * Sets nextPageUrl + * + * @param string|null $nextPageUrl nextPageUrl + * + * @return self + */ + public function setNextPageUrl($nextPageUrl) + { + if (is_null($nextPageUrl)) { + throw new \InvalidArgumentException('non-nullable nextPageUrl cannot be null'); + } + $this->container['nextPageUrl'] = $nextPageUrl; + + 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/src/Model/SpendingListItem.php b/src/Model/SpendingListItem.php new file mode 100644 index 0000000..7c6e870 --- /dev/null +++ b/src/Model/SpendingListItem.php @@ -0,0 +1,1002 @@ + + */ +class SpendingListItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SpendingListItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'organizationId' => 'int', + 'category' => '\Cone\Billingo\Model\Category', + 'paidAt' => '\DateTime', + 'fulfillmentDate' => '\DateTime', + 'partner' => '\Cone\Billingo\Model\SpendingPartner', + 'invoiceNumber' => 'string', + 'currency' => '\Cone\Billingo\Model\Currency', + 'conversionRate' => 'float', + 'totalGross' => 'float', + 'totalGrossLocal' => 'float', + 'totalVatAmount' => 'float', + 'totalVatAmountLocal' => 'float', + 'invoiceDate' => '\DateTime', + 'dueDate' => '\DateTime', + 'paymentMethod' => '\Cone\Billingo\Model\SpendingPaymentMethod', + 'comment' => 'string', + 'isCreatedByNav' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'organizationId' => null, + 'category' => null, + 'paidAt' => 'date', + 'fulfillmentDate' => 'date', + 'partner' => null, + 'invoiceNumber' => null, + 'currency' => null, + 'conversionRate' => 'float', + 'totalGross' => 'float', + 'totalGrossLocal' => 'float', + 'totalVatAmount' => 'float', + 'totalVatAmountLocal' => 'float', + 'invoiceDate' => 'date', + 'dueDate' => 'date', + 'paymentMethod' => null, + 'comment' => null, + 'isCreatedByNav' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'organizationId' => false, + 'category' => false, + 'paidAt' => true, + 'fulfillmentDate' => false, + 'partner' => false, + 'invoiceNumber' => false, + 'currency' => false, + 'conversionRate' => false, + 'totalGross' => false, + 'totalGrossLocal' => false, + 'totalVatAmount' => false, + 'totalVatAmountLocal' => false, + 'invoiceDate' => false, + 'dueDate' => false, + 'paymentMethod' => false, + 'comment' => true, + 'isCreatedByNav' => 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', + 'organizationId' => 'organization_id', + 'category' => 'category', + 'paidAt' => 'paid_at', + 'fulfillmentDate' => 'fulfillment_date', + 'partner' => 'partner', + 'invoiceNumber' => 'invoice_number', + 'currency' => 'currency', + 'conversionRate' => 'conversion_rate', + 'totalGross' => 'total_gross', + 'totalGrossLocal' => 'total_gross_local', + 'totalVatAmount' => 'total_vat_amount', + 'totalVatAmountLocal' => 'total_vat_amount_local', + 'invoiceDate' => 'invoice_date', + 'dueDate' => 'due_date', + 'paymentMethod' => 'payment_method', + 'comment' => 'comment', + 'isCreatedByNav' => 'is_created_by_nav' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'organizationId' => 'setOrganizationId', + 'category' => 'setCategory', + 'paidAt' => 'setPaidAt', + 'fulfillmentDate' => 'setFulfillmentDate', + 'partner' => 'setPartner', + 'invoiceNumber' => 'setInvoiceNumber', + 'currency' => 'setCurrency', + 'conversionRate' => 'setConversionRate', + 'totalGross' => 'setTotalGross', + 'totalGrossLocal' => 'setTotalGrossLocal', + 'totalVatAmount' => 'setTotalVatAmount', + 'totalVatAmountLocal' => 'setTotalVatAmountLocal', + 'invoiceDate' => 'setInvoiceDate', + 'dueDate' => 'setDueDate', + 'paymentMethod' => 'setPaymentMethod', + 'comment' => 'setComment', + 'isCreatedByNav' => 'setIsCreatedByNav' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'organizationId' => 'getOrganizationId', + 'category' => 'getCategory', + 'paidAt' => 'getPaidAt', + 'fulfillmentDate' => 'getFulfillmentDate', + 'partner' => 'getPartner', + 'invoiceNumber' => 'getInvoiceNumber', + 'currency' => 'getCurrency', + 'conversionRate' => 'getConversionRate', + 'totalGross' => 'getTotalGross', + 'totalGrossLocal' => 'getTotalGrossLocal', + 'totalVatAmount' => 'getTotalVatAmount', + 'totalVatAmountLocal' => 'getTotalVatAmountLocal', + 'invoiceDate' => 'getInvoiceDate', + 'dueDate' => 'getDueDate', + 'paymentMethod' => 'getPaymentMethod', + 'comment' => 'getComment', + 'isCreatedByNav' => 'getIsCreatedByNav' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('organizationId', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('paidAt', $data ?? [], null); + $this->setIfExists('fulfillmentDate', $data ?? [], null); + $this->setIfExists('partner', $data ?? [], null); + $this->setIfExists('invoiceNumber', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('conversionRate', $data ?? [], null); + $this->setIfExists('totalGross', $data ?? [], null); + $this->setIfExists('totalGrossLocal', $data ?? [], null); + $this->setIfExists('totalVatAmount', $data ?? [], null); + $this->setIfExists('totalVatAmountLocal', $data ?? [], null); + $this->setIfExists('invoiceDate', $data ?? [], null); + $this->setIfExists('dueDate', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('isCreatedByNav', $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 organizationId + * + * @return int|null + */ + public function getOrganizationId() + { + return $this->container['organizationId']; + } + + /** + * Sets organizationId + * + * @param int|null $organizationId organizationId + * + * @return self + */ + public function setOrganizationId($organizationId) + { + if (is_null($organizationId)) { + throw new \InvalidArgumentException('non-nullable organizationId cannot be null'); + } + $this->container['organizationId'] = $organizationId; + + return $this; + } + + /** + * Gets category + * + * @return \Cone\Billingo\Model\Category|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param \Cone\Billingo\Model\Category|null $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets paidAt + * + * @return \DateTime|null + */ + public function getPaidAt() + { + return $this->container['paidAt']; + } + + /** + * Sets paidAt + * + * @param \DateTime|null $paidAt paidAt + * + * @return self + */ + public function setPaidAt($paidAt) + { + if (is_null($paidAt)) { + array_push($this->openAPINullablesSetToNull, 'paidAt'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('paidAt', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['paidAt'] = $paidAt; + + return $this; + } + + /** + * Gets fulfillmentDate + * + * @return \DateTime|null + */ + public function getFulfillmentDate() + { + return $this->container['fulfillmentDate']; + } + + /** + * Sets fulfillmentDate + * + * @param \DateTime|null $fulfillmentDate fulfillmentDate + * + * @return self + */ + public function setFulfillmentDate($fulfillmentDate) + { + if (is_null($fulfillmentDate)) { + throw new \InvalidArgumentException('non-nullable fulfillmentDate cannot be null'); + } + $this->container['fulfillmentDate'] = $fulfillmentDate; + + return $this; + } + + /** + * Gets partner + * + * @return \Cone\Billingo\Model\SpendingPartner|null + */ + public function getPartner() + { + return $this->container['partner']; + } + + /** + * Sets partner + * + * @param \Cone\Billingo\Model\SpendingPartner|null $partner partner + * + * @return self + */ + public function setPartner($partner) + { + if (is_null($partner)) { + throw new \InvalidArgumentException('non-nullable partner cannot be null'); + } + $this->container['partner'] = $partner; + + return $this; + } + + /** + * Gets invoiceNumber + * + * @return string|null + */ + public function getInvoiceNumber() + { + return $this->container['invoiceNumber']; + } + + /** + * Sets invoiceNumber + * + * @param string|null $invoiceNumber invoiceNumber + * + * @return self + */ + public function setInvoiceNumber($invoiceNumber) + { + if (is_null($invoiceNumber)) { + throw new \InvalidArgumentException('non-nullable invoiceNumber cannot be null'); + } + $this->container['invoiceNumber'] = $invoiceNumber; + + return $this; + } + + /** + * Gets currency + * + * @return \Cone\Billingo\Model\Currency|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Cone\Billingo\Model\Currency|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets conversionRate + * + * @return float|null + */ + public function getConversionRate() + { + return $this->container['conversionRate']; + } + + /** + * Sets conversionRate + * + * @param float|null $conversionRate conversionRate + * + * @return self + */ + public function setConversionRate($conversionRate) + { + if (is_null($conversionRate)) { + throw new \InvalidArgumentException('non-nullable conversionRate cannot be null'); + } + $this->container['conversionRate'] = $conversionRate; + + return $this; + } + + /** + * Gets totalGross + * + * @return float|null + */ + public function getTotalGross() + { + return $this->container['totalGross']; + } + + /** + * Sets totalGross + * + * @param float|null $totalGross totalGross + * + * @return self + */ + public function setTotalGross($totalGross) + { + if (is_null($totalGross)) { + throw new \InvalidArgumentException('non-nullable totalGross cannot be null'); + } + $this->container['totalGross'] = $totalGross; + + return $this; + } + + /** + * Gets totalGrossLocal + * + * @return float|null + */ + public function getTotalGrossLocal() + { + return $this->container['totalGrossLocal']; + } + + /** + * Sets totalGrossLocal + * + * @param float|null $totalGrossLocal totalGrossLocal + * + * @return self + */ + public function setTotalGrossLocal($totalGrossLocal) + { + if (is_null($totalGrossLocal)) { + throw new \InvalidArgumentException('non-nullable totalGrossLocal cannot be null'); + } + $this->container['totalGrossLocal'] = $totalGrossLocal; + + return $this; + } + + /** + * Gets totalVatAmount + * + * @return float|null + */ + public function getTotalVatAmount() + { + return $this->container['totalVatAmount']; + } + + /** + * Sets totalVatAmount + * + * @param float|null $totalVatAmount totalVatAmount + * + * @return self + */ + public function setTotalVatAmount($totalVatAmount) + { + if (is_null($totalVatAmount)) { + throw new \InvalidArgumentException('non-nullable totalVatAmount cannot be null'); + } + $this->container['totalVatAmount'] = $totalVatAmount; + + return $this; + } + + /** + * Gets totalVatAmountLocal + * + * @return float|null + */ + public function getTotalVatAmountLocal() + { + return $this->container['totalVatAmountLocal']; + } + + /** + * Sets totalVatAmountLocal + * + * @param float|null $totalVatAmountLocal totalVatAmountLocal + * + * @return self + */ + public function setTotalVatAmountLocal($totalVatAmountLocal) + { + if (is_null($totalVatAmountLocal)) { + throw new \InvalidArgumentException('non-nullable totalVatAmountLocal cannot be null'); + } + $this->container['totalVatAmountLocal'] = $totalVatAmountLocal; + + return $this; + } + + /** + * Gets invoiceDate + * + * @return \DateTime|null + */ + public function getInvoiceDate() + { + return $this->container['invoiceDate']; + } + + /** + * Sets invoiceDate + * + * @param \DateTime|null $invoiceDate invoiceDate + * + * @return self + */ + public function setInvoiceDate($invoiceDate) + { + if (is_null($invoiceDate)) { + throw new \InvalidArgumentException('non-nullable invoiceDate cannot be null'); + } + $this->container['invoiceDate'] = $invoiceDate; + + return $this; + } + + /** + * Gets dueDate + * + * @return \DateTime|null + */ + public function getDueDate() + { + return $this->container['dueDate']; + } + + /** + * Sets dueDate + * + * @param \DateTime|null $dueDate dueDate + * + * @return self + */ + public function setDueDate($dueDate) + { + if (is_null($dueDate)) { + throw new \InvalidArgumentException('non-nullable dueDate cannot be null'); + } + $this->container['dueDate'] = $dueDate; + + return $this; + } + + /** + * Gets paymentMethod + * + * @return \Cone\Billingo\Model\SpendingPaymentMethod|null + */ + public function getPaymentMethod() + { + return $this->container['paymentMethod']; + } + + /** + * Sets paymentMethod + * + * @param \Cone\Billingo\Model\SpendingPaymentMethod|null $paymentMethod paymentMethod + * + * @return self + */ + public function setPaymentMethod($paymentMethod) + { + if (is_null($paymentMethod)) { + throw new \InvalidArgumentException('non-nullable paymentMethod cannot be null'); + } + $this->container['paymentMethod'] = $paymentMethod; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + array_push($this->openAPINullablesSetToNull, 'comment'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('comment', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets isCreatedByNav + * + * @return bool|null + */ + public function getIsCreatedByNav() + { + return $this->container['isCreatedByNav']; + } + + /** + * Sets isCreatedByNav + * + * @param bool|null $isCreatedByNav isCreatedByNav + * + * @return self + */ + public function setIsCreatedByNav($isCreatedByNav) + { + if (is_null($isCreatedByNav)) { + throw new \InvalidArgumentException('non-nullable isCreatedByNav cannot be null'); + } + $this->container['isCreatedByNav'] = $isCreatedByNav; + + 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/src/Model/SpendingPartner.php b/src/Model/SpendingPartner.php new file mode 100644 index 0000000..1c51a84 --- /dev/null +++ b/src/Model/SpendingPartner.php @@ -0,0 +1,716 @@ + + */ +class SpendingPartner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SpendingPartner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'taxCode' => 'string', + 'address' => '\Cone\Billingo\Model\Address', + 'iban' => 'string', + 'swift' => 'string', + 'accountNumber' => 'string', + 'phone' => 'string', + 'internalComment' => 'string', + 'groupMemberTaxNumber' => '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, + 'taxCode' => null, + 'address' => null, + 'iban' => null, + 'swift' => null, + 'accountNumber' => null, + 'phone' => null, + 'internalComment' => null, + 'groupMemberTaxNumber' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'taxCode' => false, + 'address' => false, + 'iban' => false, + 'swift' => false, + 'accountNumber' => false, + 'phone' => false, + 'internalComment' => false, + 'groupMemberTaxNumber' => 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', + 'name' => 'name', + 'taxCode' => 'tax_code', + 'address' => 'address', + 'iban' => 'iban', + 'swift' => 'swift', + 'accountNumber' => 'account_number', + 'phone' => 'phone', + 'internalComment' => 'internal_comment', + 'groupMemberTaxNumber' => 'group_member_tax_number' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'taxCode' => 'setTaxCode', + 'address' => 'setAddress', + 'iban' => 'setIban', + 'swift' => 'setSwift', + 'accountNumber' => 'setAccountNumber', + 'phone' => 'setPhone', + 'internalComment' => 'setInternalComment', + 'groupMemberTaxNumber' => 'setGroupMemberTaxNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'taxCode' => 'getTaxCode', + 'address' => 'getAddress', + 'iban' => 'getIban', + 'swift' => 'getSwift', + 'accountNumber' => 'getAccountNumber', + 'phone' => 'getPhone', + 'internalComment' => 'getInternalComment', + 'groupMemberTaxNumber' => 'getGroupMemberTaxNumber' + ]; + + /** + * 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[] $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('taxCode', $data ?? [], null); + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('iban', $data ?? [], null); + $this->setIfExists('swift', $data ?? [], null); + $this->setIfExists('accountNumber', $data ?? [], null); + $this->setIfExists('phone', $data ?? [], null); + $this->setIfExists('internalComment', $data ?? [], null); + $this->setIfExists('groupMemberTaxNumber', $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 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)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets taxCode + * + * @return string|null + */ + public function getTaxCode() + { + return $this->container['taxCode']; + } + + /** + * Sets taxCode + * + * @param string|null $taxCode taxCode + * + * @return self + */ + public function setTaxCode($taxCode) + { + if (is_null($taxCode)) { + throw new \InvalidArgumentException('non-nullable taxCode cannot be null'); + } + $this->container['taxCode'] = $taxCode; + + return $this; + } + + /** + * Gets address + * + * @return \Cone\Billingo\Model\Address|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param \Cone\Billingo\Model\Address|null $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + throw new \InvalidArgumentException('non-nullable address cannot be null'); + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets iban + * + * @return string|null + */ + public function getIban() + { + return $this->container['iban']; + } + + /** + * Sets iban + * + * @param string|null $iban iban + * + * @return self + */ + public function setIban($iban) + { + if (is_null($iban)) { + throw new \InvalidArgumentException('non-nullable iban cannot be null'); + } + $this->container['iban'] = $iban; + + return $this; + } + + /** + * Gets swift + * + * @return string|null + */ + public function getSwift() + { + return $this->container['swift']; + } + + /** + * Sets swift + * + * @param string|null $swift swift + * + * @return self + */ + public function setSwift($swift) + { + if (is_null($swift)) { + throw new \InvalidArgumentException('non-nullable swift cannot be null'); + } + $this->container['swift'] = $swift; + + return $this; + } + + /** + * Gets accountNumber + * + * @return string|null + */ + public function getAccountNumber() + { + return $this->container['accountNumber']; + } + + /** + * Sets accountNumber + * + * @param string|null $accountNumber accountNumber + * + * @return self + */ + public function setAccountNumber($accountNumber) + { + if (is_null($accountNumber)) { + throw new \InvalidArgumentException('non-nullable accountNumber cannot be null'); + } + $this->container['accountNumber'] = $accountNumber; + + 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)) { + throw new \InvalidArgumentException('non-nullable phone cannot be null'); + } + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets internalComment + * + * @return string|null + */ + public function getInternalComment() + { + return $this->container['internalComment']; + } + + /** + * Sets internalComment + * + * @param string|null $internalComment internalComment + * + * @return self + */ + public function setInternalComment($internalComment) + { + if (is_null($internalComment)) { + throw new \InvalidArgumentException('non-nullable internalComment cannot be null'); + } + $this->container['internalComment'] = $internalComment; + + return $this; + } + + /** + * Gets groupMemberTaxNumber + * + * @return string|null + */ + public function getGroupMemberTaxNumber() + { + return $this->container['groupMemberTaxNumber']; + } + + /** + * Sets groupMemberTaxNumber + * + * @param string|null $groupMemberTaxNumber groupMemberTaxNumber + * + * @return self + */ + public function setGroupMemberTaxNumber($groupMemberTaxNumber) + { + if (is_null($groupMemberTaxNumber)) { + throw new \InvalidArgumentException('non-nullable groupMemberTaxNumber cannot be null'); + } + $this->container['groupMemberTaxNumber'] = $groupMemberTaxNumber; + + 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/src/Model/SpendingPaymentMethod.php b/src/Model/SpendingPaymentMethod.php new file mode 100644 index 0000000..e172654 --- /dev/null +++ b/src/Model/SpendingPaymentMethod.php @@ -0,0 +1,141 @@ + + */ +class SpendingSave implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SpendingSave'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'currency' => '\Cone\Billingo\Model\Currency', + 'conversionRate' => 'float', + 'totalGross' => 'float', + 'totalGrossHuf' => 'float', + 'totalVatAmount' => 'float', + 'totalVatAmountHuf' => 'float', + 'fulfillmentDate' => '\DateTime', + 'paidAt' => '\DateTime', + 'category' => '\Cone\Billingo\Model\Category', + 'comment' => 'string', + 'invoiceNumber' => 'string', + 'invoiceDate' => '\DateTime', + 'dueDate' => '\DateTime', + 'paymentMethod' => '\Cone\Billingo\Model\SpendingPaymentMethod', + 'partnerId' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'currency' => null, + 'conversionRate' => 'float', + 'totalGross' => 'float', + 'totalGrossHuf' => 'float', + 'totalVatAmount' => 'float', + 'totalVatAmountHuf' => 'float', + 'fulfillmentDate' => 'date', + 'paidAt' => 'date', + 'category' => null, + 'comment' => null, + 'invoiceNumber' => null, + 'invoiceDate' => 'date', + 'dueDate' => 'date', + 'paymentMethod' => null, + 'partnerId' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'currency' => false, + 'conversionRate' => false, + 'totalGross' => false, + 'totalGrossHuf' => false, + 'totalVatAmount' => false, + 'totalVatAmountHuf' => false, + 'fulfillmentDate' => false, + 'paidAt' => false, + 'category' => false, + 'comment' => false, + 'invoiceNumber' => false, + 'invoiceDate' => false, + 'dueDate' => false, + 'paymentMethod' => false, + 'partnerId' => 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 = [ + 'currency' => 'currency', + 'conversionRate' => 'conversion_rate', + 'totalGross' => 'total_gross', + 'totalGrossHuf' => 'total_gross_huf', + 'totalVatAmount' => 'total_vat_amount', + 'totalVatAmountHuf' => 'total_vat_amount_huf', + 'fulfillmentDate' => 'fulfillment_date', + 'paidAt' => 'paid_at', + 'category' => 'category', + 'comment' => 'comment', + 'invoiceNumber' => 'invoice_number', + 'invoiceDate' => 'invoice_date', + 'dueDate' => 'due_date', + 'paymentMethod' => 'payment_method', + 'partnerId' => 'partner_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency' => 'setCurrency', + 'conversionRate' => 'setConversionRate', + 'totalGross' => 'setTotalGross', + 'totalGrossHuf' => 'setTotalGrossHuf', + 'totalVatAmount' => 'setTotalVatAmount', + 'totalVatAmountHuf' => 'setTotalVatAmountHuf', + 'fulfillmentDate' => 'setFulfillmentDate', + 'paidAt' => 'setPaidAt', + 'category' => 'setCategory', + 'comment' => 'setComment', + 'invoiceNumber' => 'setInvoiceNumber', + 'invoiceDate' => 'setInvoiceDate', + 'dueDate' => 'setDueDate', + 'paymentMethod' => 'setPaymentMethod', + 'partnerId' => 'setPartnerId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency' => 'getCurrency', + 'conversionRate' => 'getConversionRate', + 'totalGross' => 'getTotalGross', + 'totalGrossHuf' => 'getTotalGrossHuf', + 'totalVatAmount' => 'getTotalVatAmount', + 'totalVatAmountHuf' => 'getTotalVatAmountHuf', + 'fulfillmentDate' => 'getFulfillmentDate', + 'paidAt' => 'getPaidAt', + 'category' => 'getCategory', + 'comment' => 'getComment', + 'invoiceNumber' => 'getInvoiceNumber', + 'invoiceDate' => 'getInvoiceDate', + 'dueDate' => 'getDueDate', + 'paymentMethod' => 'getPaymentMethod', + 'partnerId' => 'getPartnerId' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('conversionRate', $data ?? [], null); + $this->setIfExists('totalGross', $data ?? [], null); + $this->setIfExists('totalGrossHuf', $data ?? [], null); + $this->setIfExists('totalVatAmount', $data ?? [], null); + $this->setIfExists('totalVatAmountHuf', $data ?? [], null); + $this->setIfExists('fulfillmentDate', $data ?? [], null); + $this->setIfExists('paidAt', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('comment', $data ?? [], null); + $this->setIfExists('invoiceNumber', $data ?? [], null); + $this->setIfExists('invoiceDate', $data ?? [], null); + $this->setIfExists('dueDate', $data ?? [], null); + $this->setIfExists('paymentMethod', $data ?? [], null); + $this->setIfExists('partnerId', $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 ($this->container['currency'] === null) { + $invalidProperties[] = "'currency' can't be null"; + } + if ($this->container['totalGross'] === null) { + $invalidProperties[] = "'totalGross' can't be null"; + } + if ($this->container['totalGrossHuf'] === null) { + $invalidProperties[] = "'totalGrossHuf' can't be null"; + } + if ($this->container['totalVatAmount'] === null) { + $invalidProperties[] = "'totalVatAmount' can't be null"; + } + if ($this->container['totalVatAmountHuf'] === null) { + $invalidProperties[] = "'totalVatAmountHuf' can't be null"; + } + if ($this->container['fulfillmentDate'] === null) { + $invalidProperties[] = "'fulfillmentDate' can't be null"; + } + if ($this->container['category'] === null) { + $invalidProperties[] = "'category' can't be null"; + } + if ($this->container['paymentMethod'] === null) { + $invalidProperties[] = "'paymentMethod' can't be null"; + } + 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 currency + * + * @return \Cone\Billingo\Model\Currency + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Cone\Billingo\Model\Currency $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets conversionRate + * + * @return float|null + */ + public function getConversionRate() + { + return $this->container['conversionRate']; + } + + /** + * Sets conversionRate + * + * @param float|null $conversionRate conversionRate + * + * @return self + */ + public function setConversionRate($conversionRate) + { + if (is_null($conversionRate)) { + throw new \InvalidArgumentException('non-nullable conversionRate cannot be null'); + } + $this->container['conversionRate'] = $conversionRate; + + return $this; + } + + /** + * Gets totalGross + * + * @return float + */ + public function getTotalGross() + { + return $this->container['totalGross']; + } + + /** + * Sets totalGross + * + * @param float $totalGross totalGross + * + * @return self + */ + public function setTotalGross($totalGross) + { + if (is_null($totalGross)) { + throw new \InvalidArgumentException('non-nullable totalGross cannot be null'); + } + $this->container['totalGross'] = $totalGross; + + return $this; + } + + /** + * Gets totalGrossHuf + * + * @return float + */ + public function getTotalGrossHuf() + { + return $this->container['totalGrossHuf']; + } + + /** + * Sets totalGrossHuf + * + * @param float $totalGrossHuf totalGrossHuf + * + * @return self + */ + public function setTotalGrossHuf($totalGrossHuf) + { + if (is_null($totalGrossHuf)) { + throw new \InvalidArgumentException('non-nullable totalGrossHuf cannot be null'); + } + $this->container['totalGrossHuf'] = $totalGrossHuf; + + return $this; + } + + /** + * Gets totalVatAmount + * + * @return float + */ + public function getTotalVatAmount() + { + return $this->container['totalVatAmount']; + } + + /** + * Sets totalVatAmount + * + * @param float $totalVatAmount totalVatAmount + * + * @return self + */ + public function setTotalVatAmount($totalVatAmount) + { + if (is_null($totalVatAmount)) { + throw new \InvalidArgumentException('non-nullable totalVatAmount cannot be null'); + } + $this->container['totalVatAmount'] = $totalVatAmount; + + return $this; + } + + /** + * Gets totalVatAmountHuf + * + * @return float + */ + public function getTotalVatAmountHuf() + { + return $this->container['totalVatAmountHuf']; + } + + /** + * Sets totalVatAmountHuf + * + * @param float $totalVatAmountHuf totalVatAmountHuf + * + * @return self + */ + public function setTotalVatAmountHuf($totalVatAmountHuf) + { + if (is_null($totalVatAmountHuf)) { + throw new \InvalidArgumentException('non-nullable totalVatAmountHuf cannot be null'); + } + $this->container['totalVatAmountHuf'] = $totalVatAmountHuf; + + return $this; + } + + /** + * Gets fulfillmentDate + * + * @return \DateTime + */ + public function getFulfillmentDate() + { + return $this->container['fulfillmentDate']; + } + + /** + * Sets fulfillmentDate + * + * @param \DateTime $fulfillmentDate fulfillmentDate + * + * @return self + */ + public function setFulfillmentDate($fulfillmentDate) + { + if (is_null($fulfillmentDate)) { + throw new \InvalidArgumentException('non-nullable fulfillmentDate cannot be null'); + } + $this->container['fulfillmentDate'] = $fulfillmentDate; + + return $this; + } + + /** + * Gets paidAt + * + * @return \DateTime|null + */ + public function getPaidAt() + { + return $this->container['paidAt']; + } + + /** + * Sets paidAt + * + * @param \DateTime|null $paidAt paidAt + * + * @return self + */ + public function setPaidAt($paidAt) + { + if (is_null($paidAt)) { + throw new \InvalidArgumentException('non-nullable paidAt cannot be null'); + } + $this->container['paidAt'] = $paidAt; + + return $this; + } + + /** + * Gets category + * + * @return \Cone\Billingo\Model\Category + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param \Cone\Billingo\Model\Category $category category + * + * @return self + */ + public function setCategory($category) + { + if (is_null($category)) { + throw new \InvalidArgumentException('non-nullable category cannot be null'); + } + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets comment + * + * @return string|null + */ + public function getComment() + { + return $this->container['comment']; + } + + /** + * Sets comment + * + * @param string|null $comment comment + * + * @return self + */ + public function setComment($comment) + { + if (is_null($comment)) { + throw new \InvalidArgumentException('non-nullable comment cannot be null'); + } + $this->container['comment'] = $comment; + + return $this; + } + + /** + * Gets invoiceNumber + * + * @return string|null + */ + public function getInvoiceNumber() + { + return $this->container['invoiceNumber']; + } + + /** + * Sets invoiceNumber + * + * @param string|null $invoiceNumber invoiceNumber + * + * @return self + */ + public function setInvoiceNumber($invoiceNumber) + { + if (is_null($invoiceNumber)) { + throw new \InvalidArgumentException('non-nullable invoiceNumber cannot be null'); + } + $this->container['invoiceNumber'] = $invoiceNumber; + + return $this; + } + + /** + * Gets invoiceDate + * + * @return \DateTime|null + */ + public function getInvoiceDate() + { + return $this->container['invoiceDate']; + } + + /** + * Sets invoiceDate + * + * @param \DateTime|null $invoiceDate invoiceDate + * + * @return self + */ + public function setInvoiceDate($invoiceDate) + { + if (is_null($invoiceDate)) { + throw new \InvalidArgumentException('non-nullable invoiceDate cannot be null'); + } + $this->container['invoiceDate'] = $invoiceDate; + + return $this; + } + + /** + * Gets dueDate + * + * @return \DateTime|null + */ + public function getDueDate() + { + return $this->container['dueDate']; + } + + /** + * Sets dueDate + * + * @param \DateTime|null $dueDate dueDate + * + * @return self + */ + public function setDueDate($dueDate) + { + if (is_null($dueDate)) { + throw new \InvalidArgumentException('non-nullable dueDate cannot be null'); + } + $this->container['dueDate'] = $dueDate; + + return $this; + } + + /** + * Gets paymentMethod + * + * @return \Cone\Billingo\Model\SpendingPaymentMethod + */ + public function getPaymentMethod() + { + return $this->container['paymentMethod']; + } + + /** + * Sets paymentMethod + * + * @param \Cone\Billingo\Model\SpendingPaymentMethod $paymentMethod paymentMethod + * + * @return self + */ + public function setPaymentMethod($paymentMethod) + { + if (is_null($paymentMethod)) { + throw new \InvalidArgumentException('non-nullable paymentMethod cannot be null'); + } + $this->container['paymentMethod'] = $paymentMethod; + + return $this; + } + + /** + * Gets partnerId + * + * @return int|null + */ + public function getPartnerId() + { + return $this->container['partnerId']; + } + + /** + * Sets partnerId + * + * @param int|null $partnerId partnerId + * + * @return self + */ + public function setPartnerId($partnerId) + { + if (is_null($partnerId)) { + throw new \InvalidArgumentException('non-nullable partnerId cannot be null'); + } + $this->container['partnerId'] = $partnerId; + + 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/src/Model/Subscription.php b/src/Model/Subscription.php new file mode 100644 index 0000000..4d7654f --- /dev/null +++ b/src/Model/Subscription.php @@ -0,0 +1,444 @@ + + */ +class Subscription implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Subscription'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'expirationDate' => '\DateTime', + 'features' => '\Cone\Billingo\Model\Feature[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'expirationDate' => 'date', + 'features' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'expirationDate' => false, + 'features' => 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 = [ + 'expirationDate' => 'expiration_date', + 'features' => 'features' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'expirationDate' => 'setExpirationDate', + 'features' => 'setFeatures' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'expirationDate' => 'getExpirationDate', + 'features' => 'getFeatures' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('expirationDate', $data ?? [], null); + $this->setIfExists('features', $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 expirationDate + * + * @return \DateTime|null + */ + public function getExpirationDate() + { + return $this->container['expirationDate']; + } + + /** + * Sets expirationDate + * + * @param \DateTime|null $expirationDate expirationDate + * + * @return self + */ + public function setExpirationDate($expirationDate) + { + if (is_null($expirationDate)) { + throw new \InvalidArgumentException('non-nullable expirationDate cannot be null'); + } + $this->container['expirationDate'] = $expirationDate; + + return $this; + } + + /** + * Gets features + * + * @return \Cone\Billingo\Model\Feature[]|null + */ + public function getFeatures() + { + return $this->container['features']; + } + + /** + * Sets features + * + * @param \Cone\Billingo\Model\Feature[]|null $features features + * + * @return self + */ + public function setFeatures($features) + { + if (is_null($features)) { + throw new \InvalidArgumentException('non-nullable features cannot be null'); + } + $this->container['features'] = $features; + + 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/src/Model/SubscriptionErrorResponse.php b/src/Model/SubscriptionErrorResponse.php new file mode 100644 index 0000000..a7ebd6b --- /dev/null +++ b/src/Model/SubscriptionErrorResponse.php @@ -0,0 +1,410 @@ + + */ +class SubscriptionErrorResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SubscriptionErrorResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => '\Cone\Billingo\Model\ClientError' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => 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 = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error' => 'getError' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $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 error + * + * @return \Cone\Billingo\Model\ClientError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \Cone\Billingo\Model\ClientError|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + 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/src/Model/TaxNumber.php b/src/Model/TaxNumber.php new file mode 100644 index 0000000..6e1c4f4 --- /dev/null +++ b/src/Model/TaxNumber.php @@ -0,0 +1,444 @@ + + */ +class TaxNumber implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TaxNumber'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'taxNumber' => 'string', + 'result' => '\Cone\Billingo\Model\CheckTaxNumberMessage' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'taxNumber' => null, + 'result' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'taxNumber' => false, + 'result' => 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 = [ + 'taxNumber' => 'tax_number', + 'result' => 'result' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'taxNumber' => 'setTaxNumber', + 'result' => 'setResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'taxNumber' => 'getTaxNumber', + 'result' => 'getResult' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('taxNumber', $data ?? [], null); + $this->setIfExists('result', $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 taxNumber + * + * @return string|null + */ + public function getTaxNumber() + { + return $this->container['taxNumber']; + } + + /** + * Sets taxNumber + * + * @param string|null $taxNumber taxNumber + * + * @return self + */ + public function setTaxNumber($taxNumber) + { + if (is_null($taxNumber)) { + throw new \InvalidArgumentException('non-nullable taxNumber cannot be null'); + } + $this->container['taxNumber'] = $taxNumber; + + return $this; + } + + /** + * Gets result + * + * @return \Cone\Billingo\Model\CheckTaxNumberMessage|null + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \Cone\Billingo\Model\CheckTaxNumberMessage|null $result result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } + $this->container['result'] = $result; + + 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/src/Model/TooManyRequestsResponse.php b/src/Model/TooManyRequestsResponse.php new file mode 100644 index 0000000..6686024 --- /dev/null +++ b/src/Model/TooManyRequestsResponse.php @@ -0,0 +1,410 @@ + + */ +class TooManyRequestsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TooManyRequestsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => '\Cone\Billingo\Model\ClientError' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => 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 = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error' => 'getError' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $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 error + * + * @return \Cone\Billingo\Model\ClientError|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \Cone\Billingo\Model\ClientError|null $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + 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/src/Model/UnitPriceType.php b/src/Model/UnitPriceType.php new file mode 100644 index 0000000..8886125 --- /dev/null +++ b/src/Model/UnitPriceType.php @@ -0,0 +1,63 @@ + + */ +class ValidationError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationError'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'field' => 'string', + 'message' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'field' => null, + 'message' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'field' => false, + 'message' => 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 = [ + 'field' => 'field', + 'message' => 'message' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'field' => 'setField', + 'message' => 'setMessage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'field' => 'getField', + 'message' => 'getMessage' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('field', $data ?? [], null); + $this->setIfExists('message', $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 field + * + * @return string|null + */ + public function getField() + { + return $this->container['field']; + } + + /** + * Sets field + * + * @param string|null $field field + * + * @return self + */ + public function setField($field) + { + if (is_null($field)) { + throw new \InvalidArgumentException('non-nullable field cannot be null'); + } + $this->container['field'] = $field; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + 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/src/Model/ValidationErrorResponse.php b/src/Model/ValidationErrorResponse.php new file mode 100644 index 0000000..400d6d1 --- /dev/null +++ b/src/Model/ValidationErrorResponse.php @@ -0,0 +1,444 @@ + + */ +class ValidationErrorResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ValidationErrorResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + 'errors' => '\Cone\Billingo\Model\ValidationError[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'message' => false, + 'errors' => 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 = [ + 'message' => 'message', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + 'errors' => 'getErrors' + ]; + + /** + * 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[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('errors', $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 message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @return self + */ + public function setMessage($message) + { + if (is_null($message)) { + throw new \InvalidArgumentException('non-nullable message cannot be null'); + } + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets errors + * + * @return \Cone\Billingo\Model\ValidationError[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Cone\Billingo\Model\ValidationError[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + 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/src/Model/Vat.php b/src/Model/Vat.php new file mode 100644 index 0000000..bfb93be --- /dev/null +++ b/src/Model/Vat.php @@ -0,0 +1,183 @@ +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 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); + + 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 string|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[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @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 = '\Cone\Billingo\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; + } + } + + /** + * Native `http_build_query` wrapper. + * @see https://www.php.net/manual/en/function.http-build-query + * + * @param array|object $data May be an array or object containing properties. + * @param string $numeric_prefix If numeric indices are used in the base array and this parameter is provided, it will be prepended to the numeric index for elements in the base array only. + * @param string|null $arg_separator arg_separator.output is used to separate arguments but may be overridden by specifying this parameter. + * @param int $encoding_type Encoding type. By default, PHP_QUERY_RFC1738. + * + * @return string + */ + public static function buildQuery( + $data, + string $numeric_prefix = '', + ?string $arg_separator = null, + int $encoding_type = \PHP_QUERY_RFC3986 + ): string { + return \GuzzleHttp\Psr7\Query::build($data, $encoding_type); + } +} diff --git a/test/Api/DocumentBlockApiTest.php b/test/Api/DocumentBlockApiTest.php new file mode 100644 index 0000000..4ed44e7 --- /dev/null +++ b/test/Api/DocumentBlockApiTest.php @@ -0,0 +1,86 @@ +markTestIncomplete('Not implemented'); + } +}