From f23442c393f7cac67e47790316e131874f45b506 Mon Sep 17 00:00:00 2001 From: Bevan Wishart Date: Tue, 15 Aug 2023 22:21:24 +1000 Subject: [PATCH] All the generated files --- .openapi-generator-ignore | 23 + .openapi-generator/FILES | 166 + .openapi-generator/VERSION | 1 + .php-cs-fixer.dist.php | 29 + .travis.yml | 8 + README.md | 223 + composer.json | 38 + composer.lock | 4246 +++++++++++++++++ docs/Api/AccountsApi.md | 453 ++ docs/Api/AttachmentsApi.md | 519 ++ docs/Api/BudgetingApi.md | 280 ++ docs/Api/CategoriesApi.md | 325 ++ docs/Api/CategoryRulesApi.md | 135 + docs/Api/CurrenciesApi.md | 130 + docs/Api/EventsApi.md | 398 ++ docs/Api/InstitutionsApi.md | 327 ++ docs/Api/LabelsApi.md | 70 + docs/Api/SavedSearchesApi.md | 70 + docs/Api/TimeZonesApi.md | 67 + docs/Api/TransactionAccountsApi.md | 198 + docs/Api/TransactionsApi.md | 578 +++ docs/Api/UsersApi.md | 195 + docs/Model/Account.md | 25 + docs/Model/AccountsIdPutRequest.md | 12 + docs/Model/Attachment.md | 18 + docs/Model/AttachmentContentTypeMeta.md | 11 + docs/Model/AttachmentVariants.md | 10 + docs/Model/AttachmentsIdPutRequest.md | 9 + docs/Model/BudgetAnalysis.md | 18 + docs/Model/BudgetAnalysisPackage.md | 12 + .../CategoriesIdCategoryRulesPostRequest.md | 11 + docs/Model/CategoriesIdPutRequest.md | 15 + docs/Model/Category.md | 19 + docs/Model/CategoryRule.md | 13 + docs/Model/Currency.md | 13 + docs/Model/CurrencySeparators.md | 10 + docs/Model/Error.md | 9 + docs/Model/Event.md | 22 + docs/Model/EventsIdPutRequest.md | 13 + docs/Model/Institution.md | 13 + docs/Model/InstitutionsIdPutRequest.md | 10 + docs/Model/Period.md | 20 + docs/Model/SavedSearch.md | 12 + docs/Model/Scenario.md | 29 + docs/Model/ScenariosIdEventsPostRequest.md | 14 + docs/Model/TimeZone.md | 14 + docs/Model/Transaction.md | 28 + docs/Model/TransactionAccount.md | 24 + docs/Model/TransactionAccountsIdPutRequest.md | 11 + ...actionAccountsIdTransactionsPostRequest.md | 18 + .../TransactionsIdAttachmentsPostRequest.md | 9 + docs/Model/TransactionsIdPutRequest.md | 18 + docs/Model/User.md | 32 + docs/Model/UsersIdAccountsPostRequest.md | 12 + docs/Model/UsersIdAccountsPutRequest.md | 9 + docs/Model/UsersIdAttachmentsPostRequest.md | 11 + docs/Model/UsersIdCategoriesPostRequest.md | 15 + docs/Model/UsersIdInstitutionsPostRequest.md | 10 + docs/Model/UsersIdPutRequest.md | 15 + git_push.sh | 57 + lib/Api/AccountsApi.php | 2532 ++++++++++ lib/Api/AttachmentsApi.php | 2789 +++++++++++ lib/Api/BudgetingApi.php | 1653 +++++++ lib/Api/CategoriesApi.php | 1814 +++++++ lib/Api/CategoryRulesApi.php | 851 ++++ lib/Api/CurrenciesApi.php | 726 +++ lib/Api/EventsApi.php | 2341 +++++++++ lib/Api/InstitutionsApi.php | 1837 +++++++ lib/Api/LabelsApi.php | 478 ++ lib/Api/SavedSearchesApi.php | 478 ++ lib/Api/TimeZonesApi.php | 412 ++ lib/Api/TransactionAccountsApi.php | 1188 +++++ lib/Api/TransactionsApi.php | 3397 +++++++++++++ lib/Api/UsersApi.php | 1145 +++++ lib/ApiException.php | 120 + lib/Configuration.php | 532 +++ lib/HeaderSelector.php | 246 + lib/Model/Account.php | 1006 ++++ lib/Model/AccountsIdPutRequest.php | 564 +++ lib/Model/Attachment.php | 716 +++ lib/Model/AttachmentContentTypeMeta.php | 478 ++ lib/Model/AttachmentVariants.php | 444 ++ lib/Model/AttachmentsIdPutRequest.php | 410 ++ lib/Model/BudgetAnalysis.php | 716 +++ lib/Model/BudgetAnalysisPackage.php | 512 ++ .../CategoriesIdCategoryRulesPostRequest.php | 481 ++ lib/Model/CategoriesIdPutRequest.php | 657 +++ lib/Model/Category.php | 793 +++ lib/Model/CategoryRule.php | 546 +++ lib/Model/Currency.php | 546 +++ lib/Model/CurrencySeparators.php | 444 ++ lib/Model/Error.php | 410 ++ lib/Model/Event.php | 896 ++++ lib/Model/EventsIdPutRequest.php | 629 +++ lib/Model/Institution.php | 546 +++ lib/Model/InstitutionsIdPutRequest.php | 444 ++ lib/Model/ModelInterface.php | 112 + lib/Model/Period.php | 784 +++ lib/Model/SavedSearch.php | 512 ++ lib/Model/Scenario.php | 1126 +++++ lib/Model/ScenariosIdEventsPostRequest.php | 636 +++ lib/Model/TimeZone.php | 580 +++ lib/Model/Transaction.php | 1124 +++++ lib/Model/TransactionAccount.php | 972 ++++ lib/Model/TransactionAccountsIdPutRequest.php | 478 ++ ...ctionAccountsIdTransactionsPostRequest.php | 725 +++ .../TransactionsIdAttachmentsPostRequest.php | 410 ++ lib/Model/TransactionsIdPutRequest.php | 716 +++ lib/Model/User.php | 1192 +++++ lib/Model/UsersIdAccountsPostRequest.php | 576 +++ lib/Model/UsersIdAccountsPutRequest.php | 413 ++ lib/Model/UsersIdAttachmentsPostRequest.php | 478 ++ lib/Model/UsersIdCategoriesPostRequest.php | 660 +++ lib/Model/UsersIdInstitutionsPostRequest.php | 450 ++ lib/Model/UsersIdPutRequest.php | 614 +++ lib/ObjectSerializer.php | 568 +++ phpunit.xml.dist | 18 + test/Api/AccountsApiTest.php | 158 + test/Api/AttachmentsApiTest.php | 170 + test/Api/BudgetingApiTest.php | 122 + test/Api/CategoriesApiTest.php | 134 + test/Api/CategoryRulesApiTest.php | 98 + test/Api/CurrenciesApiTest.php | 98 + test/Api/EventsApiTest.php | 146 + test/Api/InstitutionsApiTest.php | 134 + test/Api/LabelsApiTest.php | 86 + test/Api/SavedSearchesApiTest.php | 86 + test/Api/TimeZonesApiTest.php | 86 + test/Api/TransactionAccountsApiTest.php | 110 + test/Api/TransactionsApiTest.php | 170 + test/Api/UsersApiTest.php | 110 + test/Model/AccountTest.php | 235 + test/Model/AccountsIdPutRequestTest.php | 118 + test/Model/AttachmentContentTypeMetaTest.php | 109 + test/Model/AttachmentTest.php | 172 + test/Model/AttachmentVariantsTest.php | 100 + test/Model/AttachmentsIdPutRequestTest.php | 91 + test/Model/BudgetAnalysisPackageTest.php | 118 + test/Model/BudgetAnalysisTest.php | 172 + ...tegoriesIdCategoryRulesPostRequestTest.php | 109 + test/Model/CategoriesIdPutRequestTest.php | 145 + test/Model/CategoryRuleTest.php | 127 + test/Model/CategoryTest.php | 181 + test/Model/CurrencySeparatorsTest.php | 100 + test/Model/CurrencyTest.php | 127 + test/Model/ErrorTest.php | 91 + test/Model/EventTest.php | 208 + test/Model/EventsIdPutRequestTest.php | 127 + test/Model/InstitutionTest.php | 127 + test/Model/InstitutionsIdPutRequestTest.php | 100 + test/Model/PeriodTest.php | 190 + test/Model/SavedSearchTest.php | 118 + test/Model/ScenarioTest.php | 271 ++ .../ScenariosIdEventsPostRequestTest.php | 136 + test/Model/TimeZoneTest.php | 136 + test/Model/TransactionAccountTest.php | 226 + .../TransactionAccountsIdPutRequestTest.php | 109 + ...nAccountsIdTransactionsPostRequestTest.php | 172 + test/Model/TransactionTest.php | 262 + ...ansactionsIdAttachmentsPostRequestTest.php | 91 + test/Model/TransactionsIdPutRequestTest.php | 172 + test/Model/UserTest.php | 298 ++ test/Model/UsersIdAccountsPostRequestTest.php | 118 + test/Model/UsersIdAccountsPutRequestTest.php | 91 + .../UsersIdAttachmentsPostRequestTest.php | 109 + .../UsersIdCategoriesPostRequestTest.php | 145 + .../UsersIdInstitutionsPostRequestTest.php | 100 + test/Model/UsersIdPutRequestTest.php | 145 + 168 files changed, 63175 insertions(+) create mode 100644 .openapi-generator-ignore create mode 100644 .openapi-generator/FILES create mode 100644 .openapi-generator/VERSION create mode 100644 .php-cs-fixer.dist.php create mode 100644 .travis.yml create mode 100644 README.md create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 docs/Api/AccountsApi.md create mode 100644 docs/Api/AttachmentsApi.md create mode 100644 docs/Api/BudgetingApi.md create mode 100644 docs/Api/CategoriesApi.md create mode 100644 docs/Api/CategoryRulesApi.md create mode 100644 docs/Api/CurrenciesApi.md create mode 100644 docs/Api/EventsApi.md create mode 100644 docs/Api/InstitutionsApi.md create mode 100644 docs/Api/LabelsApi.md create mode 100644 docs/Api/SavedSearchesApi.md create mode 100644 docs/Api/TimeZonesApi.md create mode 100644 docs/Api/TransactionAccountsApi.md create mode 100644 docs/Api/TransactionsApi.md create mode 100644 docs/Api/UsersApi.md create mode 100644 docs/Model/Account.md create mode 100644 docs/Model/AccountsIdPutRequest.md create mode 100644 docs/Model/Attachment.md create mode 100644 docs/Model/AttachmentContentTypeMeta.md create mode 100644 docs/Model/AttachmentVariants.md create mode 100644 docs/Model/AttachmentsIdPutRequest.md create mode 100644 docs/Model/BudgetAnalysis.md create mode 100644 docs/Model/BudgetAnalysisPackage.md create mode 100644 docs/Model/CategoriesIdCategoryRulesPostRequest.md create mode 100644 docs/Model/CategoriesIdPutRequest.md create mode 100644 docs/Model/Category.md create mode 100644 docs/Model/CategoryRule.md create mode 100644 docs/Model/Currency.md create mode 100644 docs/Model/CurrencySeparators.md create mode 100644 docs/Model/Error.md create mode 100644 docs/Model/Event.md create mode 100644 docs/Model/EventsIdPutRequest.md create mode 100644 docs/Model/Institution.md create mode 100644 docs/Model/InstitutionsIdPutRequest.md create mode 100644 docs/Model/Period.md create mode 100644 docs/Model/SavedSearch.md create mode 100644 docs/Model/Scenario.md create mode 100644 docs/Model/ScenariosIdEventsPostRequest.md create mode 100644 docs/Model/TimeZone.md create mode 100644 docs/Model/Transaction.md create mode 100644 docs/Model/TransactionAccount.md create mode 100644 docs/Model/TransactionAccountsIdPutRequest.md create mode 100644 docs/Model/TransactionAccountsIdTransactionsPostRequest.md create mode 100644 docs/Model/TransactionsIdAttachmentsPostRequest.md create mode 100644 docs/Model/TransactionsIdPutRequest.md create mode 100644 docs/Model/User.md create mode 100644 docs/Model/UsersIdAccountsPostRequest.md create mode 100644 docs/Model/UsersIdAccountsPutRequest.md create mode 100644 docs/Model/UsersIdAttachmentsPostRequest.md create mode 100644 docs/Model/UsersIdCategoriesPostRequest.md create mode 100644 docs/Model/UsersIdInstitutionsPostRequest.md create mode 100644 docs/Model/UsersIdPutRequest.md create mode 100644 git_push.sh create mode 100644 lib/Api/AccountsApi.php create mode 100644 lib/Api/AttachmentsApi.php create mode 100644 lib/Api/BudgetingApi.php create mode 100644 lib/Api/CategoriesApi.php create mode 100644 lib/Api/CategoryRulesApi.php create mode 100644 lib/Api/CurrenciesApi.php create mode 100644 lib/Api/EventsApi.php create mode 100644 lib/Api/InstitutionsApi.php create mode 100644 lib/Api/LabelsApi.php create mode 100644 lib/Api/SavedSearchesApi.php create mode 100644 lib/Api/TimeZonesApi.php create mode 100644 lib/Api/TransactionAccountsApi.php create mode 100644 lib/Api/TransactionsApi.php create mode 100644 lib/Api/UsersApi.php create mode 100644 lib/ApiException.php create mode 100644 lib/Configuration.php create mode 100644 lib/HeaderSelector.php create mode 100644 lib/Model/Account.php create mode 100644 lib/Model/AccountsIdPutRequest.php create mode 100644 lib/Model/Attachment.php create mode 100644 lib/Model/AttachmentContentTypeMeta.php create mode 100644 lib/Model/AttachmentVariants.php create mode 100644 lib/Model/AttachmentsIdPutRequest.php create mode 100644 lib/Model/BudgetAnalysis.php create mode 100644 lib/Model/BudgetAnalysisPackage.php create mode 100644 lib/Model/CategoriesIdCategoryRulesPostRequest.php create mode 100644 lib/Model/CategoriesIdPutRequest.php create mode 100644 lib/Model/Category.php create mode 100644 lib/Model/CategoryRule.php create mode 100644 lib/Model/Currency.php create mode 100644 lib/Model/CurrencySeparators.php create mode 100644 lib/Model/Error.php create mode 100644 lib/Model/Event.php create mode 100644 lib/Model/EventsIdPutRequest.php create mode 100644 lib/Model/Institution.php create mode 100644 lib/Model/InstitutionsIdPutRequest.php create mode 100644 lib/Model/ModelInterface.php create mode 100644 lib/Model/Period.php create mode 100644 lib/Model/SavedSearch.php create mode 100644 lib/Model/Scenario.php create mode 100644 lib/Model/ScenariosIdEventsPostRequest.php create mode 100644 lib/Model/TimeZone.php create mode 100644 lib/Model/Transaction.php create mode 100644 lib/Model/TransactionAccount.php create mode 100644 lib/Model/TransactionAccountsIdPutRequest.php create mode 100644 lib/Model/TransactionAccountsIdTransactionsPostRequest.php create mode 100644 lib/Model/TransactionsIdAttachmentsPostRequest.php create mode 100644 lib/Model/TransactionsIdPutRequest.php create mode 100644 lib/Model/User.php create mode 100644 lib/Model/UsersIdAccountsPostRequest.php create mode 100644 lib/Model/UsersIdAccountsPutRequest.php create mode 100644 lib/Model/UsersIdAttachmentsPostRequest.php create mode 100644 lib/Model/UsersIdCategoriesPostRequest.php create mode 100644 lib/Model/UsersIdInstitutionsPostRequest.php create mode 100644 lib/Model/UsersIdPutRequest.php create mode 100644 lib/ObjectSerializer.php create mode 100644 phpunit.xml.dist create mode 100644 test/Api/AccountsApiTest.php create mode 100644 test/Api/AttachmentsApiTest.php create mode 100644 test/Api/BudgetingApiTest.php create mode 100644 test/Api/CategoriesApiTest.php create mode 100644 test/Api/CategoryRulesApiTest.php create mode 100644 test/Api/CurrenciesApiTest.php create mode 100644 test/Api/EventsApiTest.php create mode 100644 test/Api/InstitutionsApiTest.php create mode 100644 test/Api/LabelsApiTest.php create mode 100644 test/Api/SavedSearchesApiTest.php create mode 100644 test/Api/TimeZonesApiTest.php create mode 100644 test/Api/TransactionAccountsApiTest.php create mode 100644 test/Api/TransactionsApiTest.php create mode 100644 test/Api/UsersApiTest.php create mode 100644 test/Model/AccountTest.php create mode 100644 test/Model/AccountsIdPutRequestTest.php create mode 100644 test/Model/AttachmentContentTypeMetaTest.php create mode 100644 test/Model/AttachmentTest.php create mode 100644 test/Model/AttachmentVariantsTest.php create mode 100644 test/Model/AttachmentsIdPutRequestTest.php create mode 100644 test/Model/BudgetAnalysisPackageTest.php create mode 100644 test/Model/BudgetAnalysisTest.php create mode 100644 test/Model/CategoriesIdCategoryRulesPostRequestTest.php create mode 100644 test/Model/CategoriesIdPutRequestTest.php create mode 100644 test/Model/CategoryRuleTest.php create mode 100644 test/Model/CategoryTest.php create mode 100644 test/Model/CurrencySeparatorsTest.php create mode 100644 test/Model/CurrencyTest.php create mode 100644 test/Model/ErrorTest.php create mode 100644 test/Model/EventTest.php create mode 100644 test/Model/EventsIdPutRequestTest.php create mode 100644 test/Model/InstitutionTest.php create mode 100644 test/Model/InstitutionsIdPutRequestTest.php create mode 100644 test/Model/PeriodTest.php create mode 100644 test/Model/SavedSearchTest.php create mode 100644 test/Model/ScenarioTest.php create mode 100644 test/Model/ScenariosIdEventsPostRequestTest.php create mode 100644 test/Model/TimeZoneTest.php create mode 100644 test/Model/TransactionAccountTest.php create mode 100644 test/Model/TransactionAccountsIdPutRequestTest.php create mode 100644 test/Model/TransactionAccountsIdTransactionsPostRequestTest.php create mode 100644 test/Model/TransactionTest.php create mode 100644 test/Model/TransactionsIdAttachmentsPostRequestTest.php create mode 100644 test/Model/TransactionsIdPutRequestTest.php create mode 100644 test/Model/UserTest.php create mode 100644 test/Model/UsersIdAccountsPostRequestTest.php create mode 100644 test/Model/UsersIdAccountsPutRequestTest.php create mode 100644 test/Model/UsersIdAttachmentsPostRequestTest.php create mode 100644 test/Model/UsersIdCategoriesPostRequestTest.php create mode 100644 test/Model/UsersIdInstitutionsPostRequestTest.php create mode 100644 test/Model/UsersIdPutRequestTest.php diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..75a6104 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,166 @@ +.gitignore +.openapi-generator-ignore +.php-cs-fixer.dist.php +.travis.yml +README.md +composer.json +docs/Api/AccountsApi.md +docs/Api/AttachmentsApi.md +docs/Api/BudgetingApi.md +docs/Api/CategoriesApi.md +docs/Api/CategoryRulesApi.md +docs/Api/CurrenciesApi.md +docs/Api/EventsApi.md +docs/Api/InstitutionsApi.md +docs/Api/LabelsApi.md +docs/Api/SavedSearchesApi.md +docs/Api/TimeZonesApi.md +docs/Api/TransactionAccountsApi.md +docs/Api/TransactionsApi.md +docs/Api/UsersApi.md +docs/Model/Account.md +docs/Model/AccountsIdPutRequest.md +docs/Model/Attachment.md +docs/Model/AttachmentContentTypeMeta.md +docs/Model/AttachmentVariants.md +docs/Model/AttachmentsIdPutRequest.md +docs/Model/BudgetAnalysis.md +docs/Model/BudgetAnalysisPackage.md +docs/Model/CategoriesIdCategoryRulesPostRequest.md +docs/Model/CategoriesIdPutRequest.md +docs/Model/Category.md +docs/Model/CategoryRule.md +docs/Model/Currency.md +docs/Model/CurrencySeparators.md +docs/Model/Error.md +docs/Model/Event.md +docs/Model/EventsIdPutRequest.md +docs/Model/Institution.md +docs/Model/InstitutionsIdPutRequest.md +docs/Model/Period.md +docs/Model/SavedSearch.md +docs/Model/Scenario.md +docs/Model/ScenariosIdEventsPostRequest.md +docs/Model/TimeZone.md +docs/Model/Transaction.md +docs/Model/TransactionAccount.md +docs/Model/TransactionAccountsIdPutRequest.md +docs/Model/TransactionAccountsIdTransactionsPostRequest.md +docs/Model/TransactionsIdAttachmentsPostRequest.md +docs/Model/TransactionsIdPutRequest.md +docs/Model/User.md +docs/Model/UsersIdAccountsPostRequest.md +docs/Model/UsersIdAccountsPutRequest.md +docs/Model/UsersIdAttachmentsPostRequest.md +docs/Model/UsersIdCategoriesPostRequest.md +docs/Model/UsersIdInstitutionsPostRequest.md +docs/Model/UsersIdPutRequest.md +git_push.sh +lib/Api/AccountsApi.php +lib/Api/AttachmentsApi.php +lib/Api/BudgetingApi.php +lib/Api/CategoriesApi.php +lib/Api/CategoryRulesApi.php +lib/Api/CurrenciesApi.php +lib/Api/EventsApi.php +lib/Api/InstitutionsApi.php +lib/Api/LabelsApi.php +lib/Api/SavedSearchesApi.php +lib/Api/TimeZonesApi.php +lib/Api/TransactionAccountsApi.php +lib/Api/TransactionsApi.php +lib/Api/UsersApi.php +lib/ApiException.php +lib/Configuration.php +lib/HeaderSelector.php +lib/Model/Account.php +lib/Model/AccountsIdPutRequest.php +lib/Model/Attachment.php +lib/Model/AttachmentContentTypeMeta.php +lib/Model/AttachmentVariants.php +lib/Model/AttachmentsIdPutRequest.php +lib/Model/BudgetAnalysis.php +lib/Model/BudgetAnalysisPackage.php +lib/Model/CategoriesIdCategoryRulesPostRequest.php +lib/Model/CategoriesIdPutRequest.php +lib/Model/Category.php +lib/Model/CategoryRule.php +lib/Model/Currency.php +lib/Model/CurrencySeparators.php +lib/Model/Error.php +lib/Model/Event.php +lib/Model/EventsIdPutRequest.php +lib/Model/Institution.php +lib/Model/InstitutionsIdPutRequest.php +lib/Model/ModelInterface.php +lib/Model/Period.php +lib/Model/SavedSearch.php +lib/Model/Scenario.php +lib/Model/ScenariosIdEventsPostRequest.php +lib/Model/TimeZone.php +lib/Model/Transaction.php +lib/Model/TransactionAccount.php +lib/Model/TransactionAccountsIdPutRequest.php +lib/Model/TransactionAccountsIdTransactionsPostRequest.php +lib/Model/TransactionsIdAttachmentsPostRequest.php +lib/Model/TransactionsIdPutRequest.php +lib/Model/User.php +lib/Model/UsersIdAccountsPostRequest.php +lib/Model/UsersIdAccountsPutRequest.php +lib/Model/UsersIdAttachmentsPostRequest.php +lib/Model/UsersIdCategoriesPostRequest.php +lib/Model/UsersIdInstitutionsPostRequest.php +lib/Model/UsersIdPutRequest.php +lib/ObjectSerializer.php +phpunit.xml.dist +test/Api/AccountsApiTest.php +test/Api/AttachmentsApiTest.php +test/Api/BudgetingApiTest.php +test/Api/CategoriesApiTest.php +test/Api/CategoryRulesApiTest.php +test/Api/CurrenciesApiTest.php +test/Api/EventsApiTest.php +test/Api/InstitutionsApiTest.php +test/Api/LabelsApiTest.php +test/Api/SavedSearchesApiTest.php +test/Api/TimeZonesApiTest.php +test/Api/TransactionAccountsApiTest.php +test/Api/TransactionsApiTest.php +test/Api/UsersApiTest.php +test/Model/AccountTest.php +test/Model/AccountsIdPutRequestTest.php +test/Model/AttachmentContentTypeMetaTest.php +test/Model/AttachmentTest.php +test/Model/AttachmentVariantsTest.php +test/Model/AttachmentsIdPutRequestTest.php +test/Model/BudgetAnalysisPackageTest.php +test/Model/BudgetAnalysisTest.php +test/Model/CategoriesIdCategoryRulesPostRequestTest.php +test/Model/CategoriesIdPutRequestTest.php +test/Model/CategoryRuleTest.php +test/Model/CategoryTest.php +test/Model/CurrencySeparatorsTest.php +test/Model/CurrencyTest.php +test/Model/ErrorTest.php +test/Model/EventTest.php +test/Model/EventsIdPutRequestTest.php +test/Model/InstitutionTest.php +test/Model/InstitutionsIdPutRequestTest.php +test/Model/PeriodTest.php +test/Model/SavedSearchTest.php +test/Model/ScenarioTest.php +test/Model/ScenariosIdEventsPostRequestTest.php +test/Model/TimeZoneTest.php +test/Model/TransactionAccountTest.php +test/Model/TransactionAccountsIdPutRequestTest.php +test/Model/TransactionAccountsIdTransactionsPostRequestTest.php +test/Model/TransactionTest.php +test/Model/TransactionsIdAttachmentsPostRequestTest.php +test/Model/TransactionsIdPutRequestTest.php +test/Model/UserTest.php +test/Model/UsersIdAccountsPostRequestTest.php +test/Model/UsersIdAccountsPutRequestTest.php +test/Model/UsersIdAttachmentsPostRequestTest.php +test/Model/UsersIdCategoriesPostRequestTest.php +test/Model/UsersIdInstitutionsPostRequestTest.php +test/Model/UsersIdPutRequestTest.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..cd802a1 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..af9cf39 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..667b815 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: php +# Bionic environment has preinstalled PHP from 7.1 to 7.4 +# https://docs.travis-ci.com/user/reference/bionic/#php-support +dist: bionic +php: + - 7.4 +before_install: "composer install" +script: "vendor/bin/phpunit" diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e7538c --- /dev/null +++ b/README.md @@ -0,0 +1,223 @@ +# thursdaybw/pocketsmith-php + +The PocketSmith API + +## Installation & Usage + +### Requirements + +PHP 7.4 and later. +Should also work with PHP 8.0. + +### Composer + +To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: + +```json +{ + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/thursdaybw/pocketsmith-api.git" + } + ], + "require": { + "thursdaybw/pocketsmith-api": "*@dev" + } +} +``` + +Then run `composer install` + +### Manual Installation + +Download the files and include `autoload.php`: + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AccountsApi( + // 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 = 42; // int | The unique identifier of the account. + +try { + $apiInstance->accountsIdDelete($id); +} catch (Exception $e) { + echo 'Exception when calling AccountsApi->accountsIdDelete: ', $e->getMessage(), PHP_EOL; +} + +``` + +## API Endpoints + +All URIs are relative to *https://api.pocketsmith.com/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AccountsApi* | [**accountsIdDelete**](docs/Api/AccountsApi.md#accountsiddelete) | **DELETE** /accounts/{id} | Delete account +*AccountsApi* | [**accountsIdGet**](docs/Api/AccountsApi.md#accountsidget) | **GET** /accounts/{id} | Get account +*AccountsApi* | [**accountsIdPut**](docs/Api/AccountsApi.md#accountsidput) | **PUT** /accounts/{id} | Update account +*AccountsApi* | [**institutionsIdAccountsGet**](docs/Api/AccountsApi.md#institutionsidaccountsget) | **GET** /institutions/{id}/accounts | List accounts in institution +*AccountsApi* | [**usersIdAccountsGet**](docs/Api/AccountsApi.md#usersidaccountsget) | **GET** /users/{id}/accounts | List accounts in user +*AccountsApi* | [**usersIdAccountsPost**](docs/Api/AccountsApi.md#usersidaccountspost) | **POST** /users/{id}/accounts | Create an account in user +*AccountsApi* | [**usersIdAccountsPut**](docs/Api/AccountsApi.md#usersidaccountsput) | **PUT** /users/{id}/accounts | Update the display order of accounts in user +*AttachmentsApi* | [**attachmentsIdDelete**](docs/Api/AttachmentsApi.md#attachmentsiddelete) | **DELETE** /attachments/{id} | Delete attachment +*AttachmentsApi* | [**attachmentsIdGet**](docs/Api/AttachmentsApi.md#attachmentsidget) | **GET** /attachments/{id} | Get attachment +*AttachmentsApi* | [**attachmentsIdPut**](docs/Api/AttachmentsApi.md#attachmentsidput) | **PUT** /attachments/{id} | Update attachment +*AttachmentsApi* | [**transactionsIdAttachmentsGet**](docs/Api/AttachmentsApi.md#transactionsidattachmentsget) | **GET** /transactions/{id}/attachments | List attachments in transaction +*AttachmentsApi* | [**transactionsIdAttachmentsPost**](docs/Api/AttachmentsApi.md#transactionsidattachmentspost) | **POST** /transactions/{id}/attachments | Assigns attachment to transaction +*AttachmentsApi* | [**transactionsTransactionIdAttachmentsAttachmentIdDelete**](docs/Api/AttachmentsApi.md#transactionstransactionidattachmentsattachmentiddelete) | **DELETE** /transactions/{transaction_id}/attachments/{attachment_id} | Unassigns attachment in transaction +*AttachmentsApi* | [**usersIdAttachmentsGet**](docs/Api/AttachmentsApi.md#usersidattachmentsget) | **GET** /users/{id}/attachments | Lists attachments in user +*AttachmentsApi* | [**usersIdAttachmentsPost**](docs/Api/AttachmentsApi.md#usersidattachmentspost) | **POST** /users/{id}/attachments | Create attachment in user +*BudgetingApi* | [**usersIdBudgetGet**](docs/Api/BudgetingApi.md#usersidbudgetget) | **GET** /users/{id}/budget | List budget for user +*BudgetingApi* | [**usersIdBudgetSummaryGet**](docs/Api/BudgetingApi.md#usersidbudgetsummaryget) | **GET** /users/{id}/budget_summary | Get budget summary for user +*BudgetingApi* | [**usersIdForecastCacheDelete**](docs/Api/BudgetingApi.md#usersidforecastcachedelete) | **DELETE** /users/{id}/forecast_cache | Delete forecast cache for user +*BudgetingApi* | [**usersIdTrendAnalysisGet**](docs/Api/BudgetingApi.md#usersidtrendanalysisget) | **GET** /users/{id}/trend_analysis | Get trend analysis for user +*CategoriesApi* | [**categoriesIdDelete**](docs/Api/CategoriesApi.md#categoriesiddelete) | **DELETE** /categories/{id} | Delete category +*CategoriesApi* | [**categoriesIdGet**](docs/Api/CategoriesApi.md#categoriesidget) | **GET** /categories/{id} | Get category +*CategoriesApi* | [**categoriesIdPut**](docs/Api/CategoriesApi.md#categoriesidput) | **PUT** /categories/{id} | Update category +*CategoriesApi* | [**usersIdCategoriesGet**](docs/Api/CategoriesApi.md#usersidcategoriesget) | **GET** /users/{id}/categories | List categories in user +*CategoriesApi* | [**usersIdCategoriesPost**](docs/Api/CategoriesApi.md#usersidcategoriespost) | **POST** /users/{id}/categories | Create category in user +*CategoryRulesApi* | [**categoriesIdCategoryRulesPost**](docs/Api/CategoryRulesApi.md#categoriesidcategoryrulespost) | **POST** /categories/{id}/category_rules | Create category rule in category +*CategoryRulesApi* | [**usersIdCategoryRulesGet**](docs/Api/CategoryRulesApi.md#usersidcategoryrulesget) | **GET** /users/{id}/category_rules | List category rules in user +*CurrenciesApi* | [**currenciesGet**](docs/Api/CurrenciesApi.md#currenciesget) | **GET** /currencies | List currencies +*CurrenciesApi* | [**currenciesIdGet**](docs/Api/CurrenciesApi.md#currenciesidget) | **GET** /currencies/{id} | Get currency +*EventsApi* | [**eventsIdDelete**](docs/Api/EventsApi.md#eventsiddelete) | **DELETE** /events/{id} | Delete event +*EventsApi* | [**eventsIdGet**](docs/Api/EventsApi.md#eventsidget) | **GET** /events/{id} | Get event +*EventsApi* | [**eventsIdPut**](docs/Api/EventsApi.md#eventsidput) | **PUT** /events/{id} | Update event +*EventsApi* | [**scenariosIdEventsGet**](docs/Api/EventsApi.md#scenariosideventsget) | **GET** /scenarios/{id}/events | List events in scenario. +*EventsApi* | [**scenariosIdEventsPost**](docs/Api/EventsApi.md#scenariosideventspost) | **POST** /scenarios/{id}/events | Create event in scenario +*EventsApi* | [**usersIdEventsGet**](docs/Api/EventsApi.md#usersideventsget) | **GET** /users/{id}/events | List events in user. +*InstitutionsApi* | [**institutionsIdDelete**](docs/Api/InstitutionsApi.md#institutionsiddelete) | **DELETE** /institutions/{id} | Delete institution +*InstitutionsApi* | [**institutionsIdGet**](docs/Api/InstitutionsApi.md#institutionsidget) | **GET** /institutions/{id} | Get institution +*InstitutionsApi* | [**institutionsIdPut**](docs/Api/InstitutionsApi.md#institutionsidput) | **PUT** /institutions/{id} | Update institution +*InstitutionsApi* | [**usersIdInstitutionsGet**](docs/Api/InstitutionsApi.md#usersidinstitutionsget) | **GET** /users/{id}/institutions | List institutions in user +*InstitutionsApi* | [**usersIdInstitutionsPost**](docs/Api/InstitutionsApi.md#usersidinstitutionspost) | **POST** /users/{id}/institutions | Create institution in user +*LabelsApi* | [**usersIdLabelsGet**](docs/Api/LabelsApi.md#usersidlabelsget) | **GET** /users/{id}/labels | List labels in user +*SavedSearchesApi* | [**usersIdSavedSearchesGet**](docs/Api/SavedSearchesApi.md#usersidsavedsearchesget) | **GET** /users/{id}/saved_searches | List saved searches in user +*TimeZonesApi* | [**timeZonesGet**](docs/Api/TimeZonesApi.md#timezonesget) | **GET** /time_zones | List time zones +*TransactionAccountsApi* | [**transactionAccountsIdGet**](docs/Api/TransactionAccountsApi.md#transactionaccountsidget) | **GET** /transaction_accounts/{id} | Get transaction account +*TransactionAccountsApi* | [**transactionAccountsIdPut**](docs/Api/TransactionAccountsApi.md#transactionaccountsidput) | **PUT** /transaction_accounts/{id} | Update transaction account +*TransactionAccountsApi* | [**usersIdTransactionAccountsGet**](docs/Api/TransactionAccountsApi.md#usersidtransactionaccountsget) | **GET** /users/{id}/transaction_accounts | List transaction accounts in user +*TransactionsApi* | [**accountsIdTransactionsGet**](docs/Api/TransactionsApi.md#accountsidtransactionsget) | **GET** /accounts/{id}/transactions | List transactions in account +*TransactionsApi* | [**categoriesIdTransactionsGet**](docs/Api/TransactionsApi.md#categoriesidtransactionsget) | **GET** /categories/{id}/transactions | List transactions in categories +*TransactionsApi* | [**transactionAccountsIdTransactionsGet**](docs/Api/TransactionsApi.md#transactionaccountsidtransactionsget) | **GET** /transaction_accounts/{id}/transactions | List transactions in transaction account +*TransactionsApi* | [**transactionAccountsIdTransactionsPost**](docs/Api/TransactionsApi.md#transactionaccountsidtransactionspost) | **POST** /transaction_accounts/{id}/transactions | Create a transaction in transaction account +*TransactionsApi* | [**transactionsIdDelete**](docs/Api/TransactionsApi.md#transactionsiddelete) | **DELETE** /transactions/{id} | Delete transaction +*TransactionsApi* | [**transactionsIdGet**](docs/Api/TransactionsApi.md#transactionsidget) | **GET** /transactions/{id} | Get a transaction +*TransactionsApi* | [**transactionsIdPut**](docs/Api/TransactionsApi.md#transactionsidput) | **PUT** /transactions/{id} | Update a transaction +*TransactionsApi* | [**usersIdTransactionsGet**](docs/Api/TransactionsApi.md#usersidtransactionsget) | **GET** /users/{id}/transactions | List transactions in user +*UsersApi* | [**meGet**](docs/Api/UsersApi.md#meget) | **GET** /me | Get the authorised user +*UsersApi* | [**usersIdGet**](docs/Api/UsersApi.md#usersidget) | **GET** /users/{id} | Get user +*UsersApi* | [**usersIdPut**](docs/Api/UsersApi.md#usersidput) | **PUT** /users/{id} | Update user + +## Models + +- [Account](docs/Model/Account.md) +- [AccountsIdPutRequest](docs/Model/AccountsIdPutRequest.md) +- [Attachment](docs/Model/Attachment.md) +- [AttachmentContentTypeMeta](docs/Model/AttachmentContentTypeMeta.md) +- [AttachmentVariants](docs/Model/AttachmentVariants.md) +- [AttachmentsIdPutRequest](docs/Model/AttachmentsIdPutRequest.md) +- [BudgetAnalysis](docs/Model/BudgetAnalysis.md) +- [BudgetAnalysisPackage](docs/Model/BudgetAnalysisPackage.md) +- [CategoriesIdCategoryRulesPostRequest](docs/Model/CategoriesIdCategoryRulesPostRequest.md) +- [CategoriesIdPutRequest](docs/Model/CategoriesIdPutRequest.md) +- [Category](docs/Model/Category.md) +- [CategoryRule](docs/Model/CategoryRule.md) +- [Currency](docs/Model/Currency.md) +- [CurrencySeparators](docs/Model/CurrencySeparators.md) +- [Error](docs/Model/Error.md) +- [Event](docs/Model/Event.md) +- [EventsIdPutRequest](docs/Model/EventsIdPutRequest.md) +- [Institution](docs/Model/Institution.md) +- [InstitutionsIdPutRequest](docs/Model/InstitutionsIdPutRequest.md) +- [Period](docs/Model/Period.md) +- [SavedSearch](docs/Model/SavedSearch.md) +- [Scenario](docs/Model/Scenario.md) +- [ScenariosIdEventsPostRequest](docs/Model/ScenariosIdEventsPostRequest.md) +- [TimeZone](docs/Model/TimeZone.md) +- [Transaction](docs/Model/Transaction.md) +- [TransactionAccount](docs/Model/TransactionAccount.md) +- [TransactionAccountsIdPutRequest](docs/Model/TransactionAccountsIdPutRequest.md) +- [TransactionAccountsIdTransactionsPostRequest](docs/Model/TransactionAccountsIdTransactionsPostRequest.md) +- [TransactionsIdAttachmentsPostRequest](docs/Model/TransactionsIdAttachmentsPostRequest.md) +- [TransactionsIdPutRequest](docs/Model/TransactionsIdPutRequest.md) +- [User](docs/Model/User.md) +- [UsersIdAccountsPostRequest](docs/Model/UsersIdAccountsPostRequest.md) +- [UsersIdAccountsPutRequest](docs/Model/UsersIdAccountsPutRequest.md) +- [UsersIdAttachmentsPostRequest](docs/Model/UsersIdAttachmentsPostRequest.md) +- [UsersIdCategoriesPostRequest](docs/Model/UsersIdCategoriesPostRequest.md) +- [UsersIdInstitutionsPostRequest](docs/Model/UsersIdInstitutionsPostRequest.md) +- [UsersIdPutRequest](docs/Model/UsersIdPutRequest.md) + +## Authorization + +Authentication schemes defined for the API: +### developerKey + +- **Type**: API key +- **API key parameter name**: X-Developer-Key +- **Location**: HTTP header + + +### oauth2 + +- **Type**: `OAuth` +- **Flow**: `accessCode` +- **Authorization URL**: `https://my.pocketsmith.com/oauth/authorize` +- **Scopes**: + - **user.read**: Access the user's details and preferences + - **user.write**: Access to change the user's details and preferences + - **accounts.read**: Access to list and view transaction accounts + - **accounts.write**: Access to update and delete transaction accounts + - **transactions.read**: Access to list and view accounts and transactions + - **transactions.write**: Access to create, update and delete transactions + - **categories.read**: Access to view categories + - **categories.write**: Ability to edit and delete categories + - **attachments.read**: Access to view attachments + - **attachments.write**: Ability to create, update and delete attachments + - **events.read**: Access to view events + - **events.write**: Ability to create, update and delete events + +## Tests + +To run the tests, use: + +```bash +composer install +vendor/bin/phpunit +``` + +## Author + +api@pocketsmith.com + +## About this package + +This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: `2.0` +- Build package: `org.openapitools.codegen.languages.PhpClientCodegen` diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4d77d4a --- /dev/null +++ b/composer.json @@ -0,0 +1,38 @@ +{ + "description": "The PocketSmith API", + "keywords": [ + "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI-Generator contributors", + "homepage": "https://openapi-generator.tech" + } + ], + "require": { + "php": "^7.4 || ^8.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^7.3", + "guzzlehttp/psr7": "^1.7 || ^2.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0 || ^9.0", + "friendsofphp/php-cs-fixer": "^3.5" + }, + "autoload": { + "psr-4": { "OpenAPI\\Client\\" : "lib/" } + }, + "autoload-dev": { + "psr-4": { "OpenAPI\\Client\\Test\\" : "test/" } + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..23f0bd9 --- /dev/null +++ b/composer.lock @@ -0,0 +1,4246 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "db93d9cb3dc7148aa83465a68c0b1af1", + "packages": [ + { + "name": "guzzlehttp/guzzle", + "version": "7.7.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/fb7566caccf22d74d1ab270de3551f72a58399f5", + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0", + "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.1", + "ext-curl": "*", + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.29 || ^9.5.23", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.7.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2023-05-21T14:04:53+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "111166291a0f8130081195ac4556a5587d7f1b5d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/111166291a0f8130081195ac4556a5587d7f1b5d", + "reference": "111166291a0f8130081195ac4556a5587d7f1b5d", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.1", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.0.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2023-08-03T15:11:55+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/8bd7c33a0734ae1c5d074360512beb716bef3f77", + "reference": "8bd7c33a0734ae1c5d074360512beb716bef3f77", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.6.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2023-08-03T15:06:02+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client/tree/1.0.2" + }, + "time": "2023-04-10T20:12:12+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "e616d01114759c4c489f93b099585439f795fe35" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + }, + "time": "2023-04-10T20:10:41+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-05-23T14:45:45+00:00" + } + ], + "packages-dev": [ + { + "name": "composer/pcre", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.1.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-11-17T09:50:14+00:00" + }, + { + "name": "composer/semver", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", + "symfony/phpunit-bridge": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-04-01T19:23:25+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "ced299686f41dce890debac69273b47ffe98a40c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-02-25T21:32:43+00:00" + }, + { + "name": "doctrine/annotations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", + "reference": "e157ef3f3124bbf6fe7ce0ffd109e8a8ef284e7f", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^2 || ^3", + "ext-tokenizer": "*", + "php": "^7.2 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" + }, + "require-dev": { + "doctrine/cache": "^2.0", + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.8.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "symfony/cache": "^5.4 || ^6", + "vimeo/psalm": "^4.10" + }, + "suggest": { + "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/2.0.1" + }, + "time": "2023-02-02T22:02:53+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "doctrine/coding-standard": "^11", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-12-30T00:23:10+00:00" + }, + { + "name": "doctrine/lexer", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "84a527db05647743d50373e0ec53a152f2cde568" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/84a527db05647743d50373e0ec53a152f2cde568", + "reference": "84a527db05647743d50373e0ec53a152f2cde568", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.9", + "phpunit/phpunit": "^9.5", + "psalm/plugin-phpunit": "^0.18.3", + "vimeo/psalm": "^5.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/3.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2022-12-15T16:57:16+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.23.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "35af3cbbacfa91e164b252a28ec0b644f1ed4e78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/35af3cbbacfa91e164b252a28ec0b644f1ed4e78", + "reference": "35af3cbbacfa91e164b252a28ec0b644f1ed4e78", + "shasum": "" + }, + "require": { + "composer/semver": "^3.3", + "composer/xdebug-handler": "^3.0.3", + "doctrine/annotations": "^2", + "doctrine/lexer": "^2 || ^3", + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0", + "sebastian/diff": "^4.0 || ^5.0", + "symfony/console": "^5.4 || ^6.0", + "symfony/event-dispatcher": "^5.4 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0", + "symfony/finder": "^5.4 || ^6.0", + "symfony/options-resolver": "^5.4 || ^6.0", + "symfony/polyfill-mbstring": "^1.27", + "symfony/polyfill-php80": "^1.27", + "symfony/polyfill-php81": "^1.27", + "symfony/process": "^5.4 || ^6.0", + "symfony/stopwatch": "^5.4 || ^6.0" + }, + "require-dev": { + "facile-it/paraunit": "^1.3 || ^2.0", + "justinrainbow/json-schema": "^5.2", + "keradus/cli-executor": "^2.0", + "mikey179/vfsstream": "^1.6.11", + "php-coveralls/php-coveralls": "^2.5.3", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", + "phpspec/prophecy": "^1.16", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "phpunitgoodpractices/polyfill": "^1.6", + "phpunitgoodpractices/traits": "^1.9.2", + "symfony/phpunit-bridge": "^6.2.3", + "symfony/yaml": "^5.4 || ^6.0" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.23.0" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2023-08-14T12:27:35+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2023-03-08T13:26:56+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.17.1", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + }, + "time": "2023-08-13T19:53:39+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.27", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1", + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.15", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-07-26T13:44:30+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.6.10", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a6d351645c3fe5a30f5e86be6577d946af65a328", + "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1 || ^2", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.8", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.5", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^3.2", + "sebastian/version": "^3.0.2" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.6-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.10" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2023-07-10T04:04:23+00:00" + }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T12:41:17+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-05-07T05:35:17+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:03:51+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-09-14T06:03:37+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bde739e7565280bda77be70044ac1047bc007e34" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-08-02T09:26:13+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:07:39+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" + }, + { + "name": "sebastian/type", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2023-02-03T06:13:03+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" + }, + { + "name": "symfony/console", + "version": "v6.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/aa5d64ad3f63f2e48964fc81ee45cb318a723898", + "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^5.4|^6.0" + }, + "conflict": { + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v6.3.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-19T20:17:28+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v6.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "adb01fe097a4ee930db9258a3cc906b5beb5cf2e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/adb01fe097a4ee930db9258a3cc906b5beb5cf2e", + "reference": "adb01fe097a4ee930db9258a3cc906b5beb5cf2e", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/event-dispatcher-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/dependency-injection": "<5.4", + "symfony/service-contracts": "<2.5" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/error-handler": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v6.3.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-06T06:56:43+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-05-23T14:45:45+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v6.3.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", + "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v6.3.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-06-01T08:30:39+00:00" + }, + { + "name": "symfony/finder", + "version": "v6.3.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "9915db259f67d21eefee768c1abcf1cc61b1fc9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/9915db259f67d21eefee768c1abcf1cc61b1fc9e", + "reference": "9915db259f67d21eefee768c1abcf1cc61b1fc9e", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "symfony/filesystem": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v6.3.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-31T08:31:44+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v6.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "a10f19f5198d589d5c33333cffe98dc9820332dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/a10f19f5198d589d5c33333cffe98dc9820332dd", + "reference": "a10f19f5198d589d5c33333cffe98dc9820332dd", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v6.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-05-12T14:21:09+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, + { + "name": "symfony/process", + "version": "v6.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "c5ce962db0d9b6e80247ca5eb9af6472bd4d7b5d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/c5ce962db0d9b6e80247ca5eb9af6472bd4d7b5d", + "reference": "c5ce962db0d9b6e80247ca5eb9af6472bd4d7b5d", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v6.3.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-12T16:00:22+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^2.0" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-05-23T14:45:45+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v6.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2", + "reference": "fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/service-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v6.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-02-16T10:14:28+00:00" + }, + { + "name": "symfony/string", + "version": "v6.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "53d1a83225002635bca3482fcbf963001313fb68" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", + "reference": "53d1a83225002635bca3482fcbf963001313fb68", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/intl": "^6.2", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v6.3.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-05T08:41:27+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2021-07-28T10:34:58+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.4 || ^8.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*" + }, + "platform-dev": [], + "plugin-api-version": "2.3.0" +} diff --git a/docs/Api/AccountsApi.md b/docs/Api/AccountsApi.md new file mode 100644 index 0000000..3961491 --- /dev/null +++ b/docs/Api/AccountsApi.md @@ -0,0 +1,453 @@ +# OpenAPI\Client\AccountsApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**accountsIdDelete()**](AccountsApi.md#accountsIdDelete) | **DELETE** /accounts/{id} | Delete account | +| [**accountsIdGet()**](AccountsApi.md#accountsIdGet) | **GET** /accounts/{id} | Get account | +| [**accountsIdPut()**](AccountsApi.md#accountsIdPut) | **PUT** /accounts/{id} | Update account | +| [**institutionsIdAccountsGet()**](AccountsApi.md#institutionsIdAccountsGet) | **GET** /institutions/{id}/accounts | List accounts in institution | +| [**usersIdAccountsGet()**](AccountsApi.md#usersIdAccountsGet) | **GET** /users/{id}/accounts | List accounts in user | +| [**usersIdAccountsPost()**](AccountsApi.md#usersIdAccountsPost) | **POST** /users/{id}/accounts | Create an account in user | +| [**usersIdAccountsPut()**](AccountsApi.md#usersIdAccountsPut) | **PUT** /users/{id}/accounts | Update the display order of accounts in user | + + +## `accountsIdDelete()` + +```php +accountsIdDelete($id) +``` + +Delete account + +Deletes an account and all its data by ID, optionally merge scenarios into another account. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AccountsApi( + // 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 = 42; // int | The unique identifier of the account. + +try { + $apiInstance->accountsIdDelete($id); +} catch (Exception $e) { + echo 'Exception when calling AccountsApi->accountsIdDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the account. | | + +### Return type + +void (empty response body) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `accountsIdGet()` + +```php +accountsIdGet($id): \OpenAPI\Client\Model\Account +``` + +Get account + +Gets an account by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AccountsApi( + // 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 = 42; // int | The unique identifier of the account. + +try { + $result = $apiInstance->accountsIdGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AccountsApi->accountsIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the account. | | + +### Return type + +[**\OpenAPI\Client\Model\Account**](../Model/Account.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `accountsIdPut()` + +```php +accountsIdPut($id, $accounts_id_put_request): \OpenAPI\Client\Model\Account +``` + +Update account + +Updates and returns an account by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AccountsApi( + // 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 = 42; // int | The unique identifier of the account. +$accounts_id_put_request = new \OpenAPI\Client\Model\AccountsIdPutRequest(); // \OpenAPI\Client\Model\AccountsIdPutRequest + +try { + $result = $apiInstance->accountsIdPut($id, $accounts_id_put_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AccountsApi->accountsIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the account. | | +| **accounts_id_put_request** | [**\OpenAPI\Client\Model\AccountsIdPutRequest**](../Model/AccountsIdPutRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Account**](../Model/Account.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `institutionsIdAccountsGet()` + +```php +institutionsIdAccountsGet($id): \OpenAPI\Client\Model\Account[] +``` + +List accounts in institution + +Lists accounts belonging to an institution by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AccountsApi( + // 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 = 42; // int | The unique identifier of the institution. + +try { + $result = $apiInstance->institutionsIdAccountsGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AccountsApi->institutionsIdAccountsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the institution. | | + +### Return type + +[**\OpenAPI\Client\Model\Account[]**](../Model/Account.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdAccountsGet()` + +```php +usersIdAccountsGet($id): \OpenAPI\Client\Model\Account[] +``` + +List accounts in user + +Lists all accounts belonging to the user by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AccountsApi( + // 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 = 42; // int | The unique identifier of the user. + +try { + $result = $apiInstance->usersIdAccountsGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AccountsApi->usersIdAccountsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | + +### Return type + +[**\OpenAPI\Client\Model\Account[]**](../Model/Account.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdAccountsPost()` + +```php +usersIdAccountsPost($id, $users_id_accounts_post_request): \OpenAPI\Client\Model\Account +``` + +Create an account in user + +Creates and returns an account belonging to the user by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AccountsApi( + // 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 = 42; // int | The unique identifier of the user. +$users_id_accounts_post_request = new \OpenAPI\Client\Model\UsersIdAccountsPostRequest(); // \OpenAPI\Client\Model\UsersIdAccountsPostRequest + +try { + $result = $apiInstance->usersIdAccountsPost($id, $users_id_accounts_post_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AccountsApi->usersIdAccountsPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | +| **users_id_accounts_post_request** | [**\OpenAPI\Client\Model\UsersIdAccountsPostRequest**](../Model/UsersIdAccountsPostRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Account**](../Model/Account.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdAccountsPut()` + +```php +usersIdAccountsPut($id, $users_id_accounts_put_request): \OpenAPI\Client\Model\Account[] +``` + +Update the display order of accounts in user + +Updates the display order of accounts belonging to the user, by accepting an array of accounts in their new display order. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AccountsApi( + // 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 = 42; // int | The unique identifier of the user. +$users_id_accounts_put_request = new \OpenAPI\Client\Model\UsersIdAccountsPutRequest(); // \OpenAPI\Client\Model\UsersIdAccountsPutRequest + +try { + $result = $apiInstance->usersIdAccountsPut($id, $users_id_accounts_put_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AccountsApi->usersIdAccountsPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | +| **users_id_accounts_put_request** | [**\OpenAPI\Client\Model\UsersIdAccountsPutRequest**](../Model/UsersIdAccountsPutRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Account[]**](../Model/Account.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/AttachmentsApi.md b/docs/Api/AttachmentsApi.md new file mode 100644 index 0000000..7a83680 --- /dev/null +++ b/docs/Api/AttachmentsApi.md @@ -0,0 +1,519 @@ +# OpenAPI\Client\AttachmentsApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**attachmentsIdDelete()**](AttachmentsApi.md#attachmentsIdDelete) | **DELETE** /attachments/{id} | Delete attachment | +| [**attachmentsIdGet()**](AttachmentsApi.md#attachmentsIdGet) | **GET** /attachments/{id} | Get attachment | +| [**attachmentsIdPut()**](AttachmentsApi.md#attachmentsIdPut) | **PUT** /attachments/{id} | Update attachment | +| [**transactionsIdAttachmentsGet()**](AttachmentsApi.md#transactionsIdAttachmentsGet) | **GET** /transactions/{id}/attachments | List attachments in transaction | +| [**transactionsIdAttachmentsPost()**](AttachmentsApi.md#transactionsIdAttachmentsPost) | **POST** /transactions/{id}/attachments | Assigns attachment to transaction | +| [**transactionsTransactionIdAttachmentsAttachmentIdDelete()**](AttachmentsApi.md#transactionsTransactionIdAttachmentsAttachmentIdDelete) | **DELETE** /transactions/{transaction_id}/attachments/{attachment_id} | Unassigns attachment in transaction | +| [**usersIdAttachmentsGet()**](AttachmentsApi.md#usersIdAttachmentsGet) | **GET** /users/{id}/attachments | Lists attachments in user | +| [**usersIdAttachmentsPost()**](AttachmentsApi.md#usersIdAttachmentsPost) | **POST** /users/{id}/attachments | Create attachment in user | + + +## `attachmentsIdDelete()` + +```php +attachmentsIdDelete($id) +``` + +Delete attachment + +Deletes a particular attachment by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AttachmentsApi( + // 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 = 42; // int | The unique identifier of the attachment. + +try { + $apiInstance->attachmentsIdDelete($id); +} catch (Exception $e) { + echo 'Exception when calling AttachmentsApi->attachmentsIdDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the attachment. | | + +### Return type + +void (empty response body) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `attachmentsIdGet()` + +```php +attachmentsIdGet($id): \OpenAPI\Client\Model\Attachment +``` + +Get attachment + +Gets a particular attachment by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AttachmentsApi( + // 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 = 42; // int | The unique identifier of the attachment. + +try { + $result = $apiInstance->attachmentsIdGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentsApi->attachmentsIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the attachment. | | + +### Return type + +[**\OpenAPI\Client\Model\Attachment**](../Model/Attachment.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `attachmentsIdPut()` + +```php +attachmentsIdPut($id, $attachments_id_put_request): \OpenAPI\Client\Model\Attachment +``` + +Update attachment + +Updates the title of the attachment. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AttachmentsApi( + // 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 = 42; // int | The unique identifier of the attachment. +$attachments_id_put_request = new \OpenAPI\Client\Model\AttachmentsIdPutRequest(); // \OpenAPI\Client\Model\AttachmentsIdPutRequest + +try { + $result = $apiInstance->attachmentsIdPut($id, $attachments_id_put_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentsApi->attachmentsIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the attachment. | | +| **attachments_id_put_request** | [**\OpenAPI\Client\Model\AttachmentsIdPutRequest**](../Model/AttachmentsIdPutRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Attachment**](../Model/Attachment.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `transactionsIdAttachmentsGet()` + +```php +transactionsIdAttachmentsGet($id): \OpenAPI\Client\Model\Attachment[] +``` + +List attachments in transaction + +Lists attachments belonging to a transaction by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AttachmentsApi( + // 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 = 42; // int | The unique identifier of the transaction. + +try { + $result = $apiInstance->transactionsIdAttachmentsGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentsApi->transactionsIdAttachmentsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the transaction. | | + +### Return type + +[**\OpenAPI\Client\Model\Attachment[]**](../Model/Attachment.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `transactionsIdAttachmentsPost()` + +```php +transactionsIdAttachmentsPost($id, $transactions_id_attachments_post_request): \OpenAPI\Client\Model\Attachment +``` + +Assigns attachment to transaction + +Assigns an attachment to the transaction by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AttachmentsApi( + // 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 = 42; // int | The unique identifier of the transaction. +$transactions_id_attachments_post_request = new \OpenAPI\Client\Model\TransactionsIdAttachmentsPostRequest(); // \OpenAPI\Client\Model\TransactionsIdAttachmentsPostRequest + +try { + $result = $apiInstance->transactionsIdAttachmentsPost($id, $transactions_id_attachments_post_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentsApi->transactionsIdAttachmentsPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the transaction. | | +| **transactions_id_attachments_post_request** | [**\OpenAPI\Client\Model\TransactionsIdAttachmentsPostRequest**](../Model/TransactionsIdAttachmentsPostRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Attachment**](../Model/Attachment.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `transactionsTransactionIdAttachmentsAttachmentIdDelete()` + +```php +transactionsTransactionIdAttachmentsAttachmentIdDelete($transaction_id, $attachment_id) +``` + +Unassigns attachment in transaction + +Unassigns a particular attachment by its ID from the transaction ID. This does not delete the attachment, it only removes its association from the transaction. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AttachmentsApi( + // 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 +); +$transaction_id = 42; // int | The unique identifier of the transaction. +$attachment_id = 1438154; // int | The unique identifier of the attachment. + +try { + $apiInstance->transactionsTransactionIdAttachmentsAttachmentIdDelete($transaction_id, $attachment_id); +} catch (Exception $e) { + echo 'Exception when calling AttachmentsApi->transactionsTransactionIdAttachmentsAttachmentIdDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **transaction_id** | **int**| The unique identifier of the transaction. | | +| **attachment_id** | **int**| The unique identifier of the attachment. | | + +### Return type + +void (empty response body) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdAttachmentsGet()` + +```php +usersIdAttachmentsGet($id, $unassigned): \OpenAPI\Client\Model\Attachment[] +``` + +Lists attachments in user + +Lists attachments belonging to a user by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AttachmentsApi( + // 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 = 42; // int | The unique identifier of the user. +$unassigned = 1; // int | If set, returns unassigned attachments, that are available for assigning to a transaction. + +try { + $result = $apiInstance->usersIdAttachmentsGet($id, $unassigned); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentsApi->usersIdAttachmentsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | +| **unassigned** | **int**| If set, returns unassigned attachments, that are available for assigning to a transaction. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Attachment[]**](../Model/Attachment.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdAttachmentsPost()` + +```php +usersIdAttachmentsPost($id, $users_id_attachments_post_request): \OpenAPI\Client\Model\Attachment +``` + +Create attachment in user + +Creates an attachment belonging to the user by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\AttachmentsApi( + // 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 = 42; // int | The unique identifier of the user. +$users_id_attachments_post_request = new \OpenAPI\Client\Model\UsersIdAttachmentsPostRequest(); // \OpenAPI\Client\Model\UsersIdAttachmentsPostRequest + +try { + $result = $apiInstance->usersIdAttachmentsPost($id, $users_id_attachments_post_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AttachmentsApi->usersIdAttachmentsPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | +| **users_id_attachments_post_request** | [**\OpenAPI\Client\Model\UsersIdAttachmentsPostRequest**](../Model/UsersIdAttachmentsPostRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Attachment**](../Model/Attachment.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/BudgetingApi.md b/docs/Api/BudgetingApi.md new file mode 100644 index 0000000..7db304c --- /dev/null +++ b/docs/Api/BudgetingApi.md @@ -0,0 +1,280 @@ +# OpenAPI\Client\BudgetingApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**usersIdBudgetGet()**](BudgetingApi.md#usersIdBudgetGet) | **GET** /users/{id}/budget | List budget for user | +| [**usersIdBudgetSummaryGet()**](BudgetingApi.md#usersIdBudgetSummaryGet) | **GET** /users/{id}/budget_summary | Get budget summary for user | +| [**usersIdForecastCacheDelete()**](BudgetingApi.md#usersIdForecastCacheDelete) | **DELETE** /users/{id}/forecast_cache | Delete forecast cache for user | +| [**usersIdTrendAnalysisGet()**](BudgetingApi.md#usersIdTrendAnalysisGet) | **GET** /users/{id}/trend_analysis | Get trend analysis for user | + + +## `usersIdBudgetGet()` + +```php +usersIdBudgetGet($id, $roll_up): \OpenAPI\Client\Model\BudgetAnalysisPackage[] +``` + +List budget for user + +Lists the user's budget, consisting of one or more budget analysis packages, one per category. Akin to the list on the Budget page in PocketSmith. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\BudgetingApi( + // 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 = 42; // int | The unique identifier of the account. +$roll_up = true; // bool | Whether parent categories should have their children rolled up into them. When used, the children will still appear in the collection on their own, but their actual and forecast figures will be rolled up to the root parent. + +try { + $result = $apiInstance->usersIdBudgetGet($id, $roll_up); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BudgetingApi->usersIdBudgetGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the account. | | +| **roll_up** | **bool**| Whether parent categories should have their children rolled up into them. When used, the children will still appear in the collection on their own, but their actual and forecast figures will be rolled up to the root parent. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\BudgetAnalysisPackage[]**](../Model/BudgetAnalysisPackage.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdBudgetSummaryGet()` + +```php +usersIdBudgetSummaryGet($id, $period, $interval, $start_date, $end_date): \OpenAPI\Client\Model\BudgetAnalysisPackage[] +``` + +Get budget summary for user + +Get the user's budget summary, containing an expense and income analysis for all categories (excluding transfer categories) for the given period and date range. Akin to the overall budget shown on the Budget page in PocketSmith. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\BudgetingApi( + // 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 = 42; // int | The unique identifier of the user. +$period = weeks; // string | The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. +$interval = 2; // int | The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. +$start_date = 2016-11-01; // string | The date to start analysing the budget from. This will be bumped out to make full periods as necessary. +$end_date = 2016-11-30; // string | The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. + +try { + $result = $apiInstance->usersIdBudgetSummaryGet($id, $period, $interval, $start_date, $end_date); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BudgetingApi->usersIdBudgetSummaryGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | +| **period** | **string**| The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. | | +| **interval** | **int**| The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. | | +| **start_date** | **string**| The date to start analysing the budget from. This will be bumped out to make full periods as necessary. | | +| **end_date** | **string**| The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. | | + +### Return type + +[**\OpenAPI\Client\Model\BudgetAnalysisPackage[]**](../Model/BudgetAnalysisPackage.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdForecastCacheDelete()` + +```php +usersIdForecastCacheDelete($id) +``` + +Delete forecast cache for user + +Delete the user's cached forecast by recalculating the forecast. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\BudgetingApi( + // 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 = 42; // int | The unique identifier of the user. + +try { + $apiInstance->usersIdForecastCacheDelete($id); +} catch (Exception $e) { + echo 'Exception when calling BudgetingApi->usersIdForecastCacheDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | + +### Return type + +void (empty response body) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdTrendAnalysisGet()` + +```php +usersIdTrendAnalysisGet($id, $period, $interval, $start_date, $end_date, $categories, $scenarios): \OpenAPI\Client\Model\BudgetAnalysisPackage[] +``` + +Get trend analysis for user + +Get an income and/or expense budget analysis for the given date range and period across any number of categories and scenarios. Akin to the Trends page in PocketSmith. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\BudgetingApi( + // 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 = 42; // int | The unique identifier of the user. +$period = weeks; // string | The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. +$interval = true; // int | The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. +$start_date = 2016-11-01; // string | The date to start analysing the budget from. This will be bumped out to make full periods as necessary. +$end_date = 2016-11-30; // string | The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. +$categories = 42,49; // string | A comma-separated list of category IDs to analyse. +$scenarios = 11,29; // string | A comma-separated list of scenario IDs to analyse. You're likely going to want to include all a user's scenarios here, unless you have reason to only analyse for a subset of scenarios. Regardless of what scenarios are analysed, all actuals (transactions) across all accounts will be included. + +try { + $result = $apiInstance->usersIdTrendAnalysisGet($id, $period, $interval, $start_date, $end_date, $categories, $scenarios); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BudgetingApi->usersIdTrendAnalysisGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | +| **period** | **string**| The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. | | +| **interval** | **int**| The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. | | +| **start_date** | **string**| The date to start analysing the budget from. This will be bumped out to make full periods as necessary. | | +| **end_date** | **string**| The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. | | +| **categories** | **string**| A comma-separated list of category IDs to analyse. | | +| **scenarios** | **string**| A comma-separated list of scenario IDs to analyse. You're likely going to want to include all a user's scenarios here, unless you have reason to only analyse for a subset of scenarios. Regardless of what scenarios are analysed, all actuals (transactions) across all accounts will be included. | | + +### Return type + +[**\OpenAPI\Client\Model\BudgetAnalysisPackage[]**](../Model/BudgetAnalysisPackage.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/CategoriesApi.md b/docs/Api/CategoriesApi.md new file mode 100644 index 0000000..e069f45 --- /dev/null +++ b/docs/Api/CategoriesApi.md @@ -0,0 +1,325 @@ +# OpenAPI\Client\CategoriesApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**categoriesIdDelete()**](CategoriesApi.md#categoriesIdDelete) | **DELETE** /categories/{id} | Delete category | +| [**categoriesIdGet()**](CategoriesApi.md#categoriesIdGet) | **GET** /categories/{id} | Get category | +| [**categoriesIdPut()**](CategoriesApi.md#categoriesIdPut) | **PUT** /categories/{id} | Update category | +| [**usersIdCategoriesGet()**](CategoriesApi.md#usersIdCategoriesGet) | **GET** /users/{id}/categories | List categories in user | +| [**usersIdCategoriesPost()**](CategoriesApi.md#usersIdCategoriesPost) | **POST** /users/{id}/categories | Create category in user | + + +## `categoriesIdDelete()` + +```php +categoriesIdDelete($id) +``` + +Delete category + +Deletes a particular category by its ID. This will delete all budgets within the category, and uncategorize all transactions assigned to the category. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\CategoriesApi( + // 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 = 42; // int | The unique identifier of the category. + +try { + $apiInstance->categoriesIdDelete($id); +} catch (Exception $e) { + echo 'Exception when calling CategoriesApi->categoriesIdDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the category. | | + +### Return type + +void (empty response body) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `categoriesIdGet()` + +```php +categoriesIdGet($id): \OpenAPI\Client\Model\Category +``` + +Get category + +Gets a particular category by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\CategoriesApi( + // 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 = 42; // int | The unique identifier of the category. + +try { + $result = $apiInstance->categoriesIdGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CategoriesApi->categoriesIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the category. | | + +### Return type + +[**\OpenAPI\Client\Model\Category**](../Model/Category.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `categoriesIdPut()` + +```php +categoriesIdPut($id, $categories_id_put_request): \OpenAPI\Client\Model\Category +``` + +Update category + +Updates a category by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\CategoriesApi( + // 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 = 42; // int | The unique identifier of the category. +$categories_id_put_request = new \OpenAPI\Client\Model\CategoriesIdPutRequest(); // \OpenAPI\Client\Model\CategoriesIdPutRequest + +try { + $result = $apiInstance->categoriesIdPut($id, $categories_id_put_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CategoriesApi->categoriesIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the category. | | +| **categories_id_put_request** | [**\OpenAPI\Client\Model\CategoriesIdPutRequest**](../Model/CategoriesIdPutRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Category**](../Model/Category.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdCategoriesGet()` + +```php +usersIdCategoriesGet($id): \OpenAPI\Client\Model\Category[] +``` + +List categories in user + +Lists all categories belonging to a user by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\CategoriesApi( + // 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 = 42; // int | The unique identifier of the user. + +try { + $result = $apiInstance->usersIdCategoriesGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CategoriesApi->usersIdCategoriesGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | + +### Return type + +[**\OpenAPI\Client\Model\Category[]**](../Model/Category.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdCategoriesPost()` + +```php +usersIdCategoriesPost($id, $users_id_categories_post_request): \OpenAPI\Client\Model\Category +``` + +Create category in user + +Creates a category belonging to the user by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\CategoriesApi( + // 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 = 42; // int | The unique identifier of the user. +$users_id_categories_post_request = new \OpenAPI\Client\Model\UsersIdCategoriesPostRequest(); // \OpenAPI\Client\Model\UsersIdCategoriesPostRequest + +try { + $result = $apiInstance->usersIdCategoriesPost($id, $users_id_categories_post_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CategoriesApi->usersIdCategoriesPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | +| **users_id_categories_post_request** | [**\OpenAPI\Client\Model\UsersIdCategoriesPostRequest**](../Model/UsersIdCategoriesPostRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Category**](../Model/Category.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/CategoryRulesApi.md b/docs/Api/CategoryRulesApi.md new file mode 100644 index 0000000..59868e8 --- /dev/null +++ b/docs/Api/CategoryRulesApi.md @@ -0,0 +1,135 @@ +# OpenAPI\Client\CategoryRulesApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**categoriesIdCategoryRulesPost()**](CategoryRulesApi.md#categoriesIdCategoryRulesPost) | **POST** /categories/{id}/category_rules | Create category rule in category | +| [**usersIdCategoryRulesGet()**](CategoryRulesApi.md#usersIdCategoryRulesGet) | **GET** /users/{id}/category_rules | List category rules in user | + + +## `categoriesIdCategoryRulesPost()` + +```php +categoriesIdCategoryRulesPost($id, $categories_id_category_rules_post_request): \OpenAPI\Client\Model\CategoryRule +``` + +Create category rule in category + +Creates a rule to allocate a category to transactions. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\CategoryRulesApi( + // 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 = 42; // int | The unique identifier of the category. +$categories_id_category_rules_post_request = new \OpenAPI\Client\Model\CategoriesIdCategoryRulesPostRequest(); // \OpenAPI\Client\Model\CategoriesIdCategoryRulesPostRequest + +try { + $result = $apiInstance->categoriesIdCategoryRulesPost($id, $categories_id_category_rules_post_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CategoryRulesApi->categoriesIdCategoryRulesPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the category. | | +| **categories_id_category_rules_post_request** | [**\OpenAPI\Client\Model\CategoriesIdCategoryRulesPostRequest**](../Model/CategoriesIdCategoryRulesPostRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\CategoryRule**](../Model/CategoryRule.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdCategoryRulesGet()` + +```php +usersIdCategoryRulesGet($id): \OpenAPI\Client\Model\CategoryRule[] +``` + +List category rules in user + +Lists all category rules belonging to a user by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\CategoryRulesApi( + // 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 = 42; // int | The unique identifier of the user. + +try { + $result = $apiInstance->usersIdCategoryRulesGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CategoryRulesApi->usersIdCategoryRulesGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | + +### Return type + +[**\OpenAPI\Client\Model\CategoryRule[]**](../Model/CategoryRule.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/CurrenciesApi.md b/docs/Api/CurrenciesApi.md new file mode 100644 index 0000000..7d04b49 --- /dev/null +++ b/docs/Api/CurrenciesApi.md @@ -0,0 +1,130 @@ +# OpenAPI\Client\CurrenciesApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**currenciesGet()**](CurrenciesApi.md#currenciesGet) | **GET** /currencies | List currencies | +| [**currenciesIdGet()**](CurrenciesApi.md#currenciesIdGet) | **GET** /currencies/{id} | Get currency | + + +## `currenciesGet()` + +```php +currenciesGet(): \OpenAPI\Client\Model\Currency[] +``` + +List currencies + +Lists currencies supported by PocketSmith. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\CurrenciesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->currenciesGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CurrenciesApi->currenciesGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\OpenAPI\Client\Model\Currency[]**](../Model/Currency.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `currenciesIdGet()` + +```php +currenciesIdGet($id): \OpenAPI\Client\Model\Currency +``` + +Get currency + +Gets a particular currency by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\CurrenciesApi( + // 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 = nzd; // string | The unique identifier of the currency. + +try { + $result = $apiInstance->currenciesIdGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling CurrenciesApi->currenciesIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| The unique identifier of the currency. | | + +### Return type + +[**\OpenAPI\Client\Model\Currency**](../Model/Currency.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/EventsApi.md b/docs/Api/EventsApi.md new file mode 100644 index 0000000..b162adf --- /dev/null +++ b/docs/Api/EventsApi.md @@ -0,0 +1,398 @@ +# OpenAPI\Client\EventsApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**eventsIdDelete()**](EventsApi.md#eventsIdDelete) | **DELETE** /events/{id} | Delete event | +| [**eventsIdGet()**](EventsApi.md#eventsIdGet) | **GET** /events/{id} | Get event | +| [**eventsIdPut()**](EventsApi.md#eventsIdPut) | **PUT** /events/{id} | Update event | +| [**scenariosIdEventsGet()**](EventsApi.md#scenariosIdEventsGet) | **GET** /scenarios/{id}/events | List events in scenario. | +| [**scenariosIdEventsPost()**](EventsApi.md#scenariosIdEventsPost) | **POST** /scenarios/{id}/events | Create event in scenario | +| [**usersIdEventsGet()**](EventsApi.md#usersIdEventsGet) | **GET** /users/{id}/events | List events in user. | + + +## `eventsIdDelete()` + +```php +eventsIdDelete($id, $behaviour) +``` + +Delete event + +Deletes an event by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\EventsApi( + // 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 = 42-1601942400; // string | The unique identifier of the event. +$behaviour = 'behaviour_example'; // string | Whether the delete applies only to this event, to all events within the series from this event or to all events within the series. + +try { + $apiInstance->eventsIdDelete($id, $behaviour); +} catch (Exception $e) { + echo 'Exception when calling EventsApi->eventsIdDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| The unique identifier of the event. | | +| **behaviour** | **string**| Whether the delete applies only to this event, to all events within the series from this event or to all events within the series. | | + +### Return type + +void (empty response body) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `eventsIdGet()` + +```php +eventsIdGet($id): \OpenAPI\Client\Model\Event +``` + +Get event + +Gets a particular event by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\EventsApi( + // 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 = 42-1601942400; // string | The unique identifier of the event. + +try { + $result = $apiInstance->eventsIdGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EventsApi->eventsIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| The unique identifier of the event. | | + +### Return type + +[**\OpenAPI\Client\Model\Event**](../Model/Event.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `eventsIdPut()` + +```php +eventsIdPut($id, $events_id_put_request): \OpenAPI\Client\Model\Event +``` + +Update event + +Updates an event by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\EventsApi( + // 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 = 42-1601942400; // string | The unique identifier of the event. +$events_id_put_request = new \OpenAPI\Client\Model\EventsIdPutRequest(); // \OpenAPI\Client\Model\EventsIdPutRequest + +try { + $result = $apiInstance->eventsIdPut($id, $events_id_put_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EventsApi->eventsIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| The unique identifier of the event. | | +| **events_id_put_request** | [**\OpenAPI\Client\Model\EventsIdPutRequest**](../Model/EventsIdPutRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Event**](../Model/Event.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `scenariosIdEventsGet()` + +```php +scenariosIdEventsGet($id, $start_date, $end_date): \OpenAPI\Client\Model\Event[] +``` + +List events in scenario. + +Lists events belonging to a scenario by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\EventsApi( + // 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 = 42; // int | The unique identifier of the scenario. +$start_date = 2020-10-01; // string | Return the events from and including this date. +$end_date = 2020-10-30; // string | Return the events until and including this date. + +try { + $result = $apiInstance->scenariosIdEventsGet($id, $start_date, $end_date); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EventsApi->scenariosIdEventsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the scenario. | | +| **start_date** | **string**| Return the events from and including this date. | | +| **end_date** | **string**| Return the events until and including this date. | | + +### Return type + +[**\OpenAPI\Client\Model\Event[]**](../Model/Event.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `scenariosIdEventsPost()` + +```php +scenariosIdEventsPost($id, $scenarios_id_events_post_request): \OpenAPI\Client\Model\Event +``` + +Create event in scenario + +Creates an event in a scenario by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\EventsApi( + // 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 = 42; // int | The unique identifier of the scenario. +$scenarios_id_events_post_request = new \OpenAPI\Client\Model\ScenariosIdEventsPostRequest(); // \OpenAPI\Client\Model\ScenariosIdEventsPostRequest + +try { + $result = $apiInstance->scenariosIdEventsPost($id, $scenarios_id_events_post_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EventsApi->scenariosIdEventsPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the scenario. | | +| **scenarios_id_events_post_request** | [**\OpenAPI\Client\Model\ScenariosIdEventsPostRequest**](../Model/ScenariosIdEventsPostRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Event**](../Model/Event.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdEventsGet()` + +```php +usersIdEventsGet($id, $start_date, $end_date): \OpenAPI\Client\Model\Event[] +``` + +List events in user. + +Lists events belonging to a user by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\EventsApi( + // 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 = 42; // int | The unique identifier of the user. +$start_date = 2020-10-01; // string | Return the events from and including this date. +$end_date = 2020-10-30; // string | Return the events until and including this date. + +try { + $result = $apiInstance->usersIdEventsGet($id, $start_date, $end_date); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling EventsApi->usersIdEventsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | +| **start_date** | **string**| Return the events from and including this date. | | +| **end_date** | **string**| Return the events until and including this date. | | + +### Return type + +[**\OpenAPI\Client\Model\Event[]**](../Model/Event.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/InstitutionsApi.md b/docs/Api/InstitutionsApi.md new file mode 100644 index 0000000..d280dcd --- /dev/null +++ b/docs/Api/InstitutionsApi.md @@ -0,0 +1,327 @@ +# OpenAPI\Client\InstitutionsApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**institutionsIdDelete()**](InstitutionsApi.md#institutionsIdDelete) | **DELETE** /institutions/{id} | Delete institution | +| [**institutionsIdGet()**](InstitutionsApi.md#institutionsIdGet) | **GET** /institutions/{id} | Get institution | +| [**institutionsIdPut()**](InstitutionsApi.md#institutionsIdPut) | **PUT** /institutions/{id} | Update institution | +| [**usersIdInstitutionsGet()**](InstitutionsApi.md#usersIdInstitutionsGet) | **GET** /users/{id}/institutions | List institutions in user | +| [**usersIdInstitutionsPost()**](InstitutionsApi.md#usersIdInstitutionsPost) | **POST** /users/{id}/institutions | Create institution in user | + + +## `institutionsIdDelete()` + +```php +institutionsIdDelete($id, $merge_into_institution_id) +``` + +Delete institution + +Deletes an institution and all data within. Alternatively, another institution can be provided to merge the data into to avoid losing it. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\InstitutionsApi( + // 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 = 42; // int | The unique identifier of the institution. +$merge_into_institution_id = 44; // int | The unique identifier of the institution to merge into. + +try { + $apiInstance->institutionsIdDelete($id, $merge_into_institution_id); +} catch (Exception $e) { + echo 'Exception when calling InstitutionsApi->institutionsIdDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the institution. | | +| **merge_into_institution_id** | **int**| The unique identifier of the institution to merge into. | [optional] | + +### Return type + +void (empty response body) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `institutionsIdGet()` + +```php +institutionsIdGet($id): \OpenAPI\Client\Model\Institution +``` + +Get institution + +Gets an institution by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\InstitutionsApi( + // 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 = 42; // int | The unique identifier of the institution. + +try { + $result = $apiInstance->institutionsIdGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InstitutionsApi->institutionsIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the institution. | | + +### Return type + +[**\OpenAPI\Client\Model\Institution**](../Model/Institution.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `institutionsIdPut()` + +```php +institutionsIdPut($id, $institutions_id_put_request): \OpenAPI\Client\Model\Institution +``` + +Update institution + +Updates the title and currency code for an institution. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\InstitutionsApi( + // 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 = 42; // int | The unique identifier of the institution. +$institutions_id_put_request = new \OpenAPI\Client\Model\InstitutionsIdPutRequest(); // \OpenAPI\Client\Model\InstitutionsIdPutRequest + +try { + $result = $apiInstance->institutionsIdPut($id, $institutions_id_put_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InstitutionsApi->institutionsIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the institution. | | +| **institutions_id_put_request** | [**\OpenAPI\Client\Model\InstitutionsIdPutRequest**](../Model/InstitutionsIdPutRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Institution**](../Model/Institution.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdInstitutionsGet()` + +```php +usersIdInstitutionsGet($id): \OpenAPI\Client\Model\Institution[] +``` + +List institutions in user + +Lists all the institutions belonging to the user. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\InstitutionsApi( + // 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 = 42; // int | The unique identifier of the user + +try { + $result = $apiInstance->usersIdInstitutionsGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InstitutionsApi->usersIdInstitutionsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user | | + +### Return type + +[**\OpenAPI\Client\Model\Institution[]**](../Model/Institution.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdInstitutionsPost()` + +```php +usersIdInstitutionsPost($id, $users_id_institutions_post_request): \OpenAPI\Client\Model\Institution +``` + +Create institution in user + +Creates an institution belonging to a user. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\InstitutionsApi( + // 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 = 42; // int | The unique identifier of the user +$users_id_institutions_post_request = new \OpenAPI\Client\Model\UsersIdInstitutionsPostRequest(); // \OpenAPI\Client\Model\UsersIdInstitutionsPostRequest + +try { + $result = $apiInstance->usersIdInstitutionsPost($id, $users_id_institutions_post_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling InstitutionsApi->usersIdInstitutionsPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user | | +| **users_id_institutions_post_request** | [**\OpenAPI\Client\Model\UsersIdInstitutionsPostRequest**](../Model/UsersIdInstitutionsPostRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Institution**](../Model/Institution.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/LabelsApi.md b/docs/Api/LabelsApi.md new file mode 100644 index 0000000..233b462 --- /dev/null +++ b/docs/Api/LabelsApi.md @@ -0,0 +1,70 @@ +# OpenAPI\Client\LabelsApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**usersIdLabelsGet()**](LabelsApi.md#usersIdLabelsGet) | **GET** /users/{id}/labels | List labels in user | + + +## `usersIdLabelsGet()` + +```php +usersIdLabelsGet($id): string[] +``` + +List labels in user + +Lists labels belonging to a user by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\LabelsApi( + // 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 = 42; // int | The unique identifier of the user. + +try { + $result = $apiInstance->usersIdLabelsGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling LabelsApi->usersIdLabelsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | + +### Return type + +**string[]** + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/SavedSearchesApi.md b/docs/Api/SavedSearchesApi.md new file mode 100644 index 0000000..154cb85 --- /dev/null +++ b/docs/Api/SavedSearchesApi.md @@ -0,0 +1,70 @@ +# OpenAPI\Client\SavedSearchesApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**usersIdSavedSearchesGet()**](SavedSearchesApi.md#usersIdSavedSearchesGet) | **GET** /users/{id}/saved_searches | List saved searches in user | + + +## `usersIdSavedSearchesGet()` + +```php +usersIdSavedSearchesGet($id): \OpenAPI\Client\Model\SavedSearch[] +``` + +List saved searches in user + +Lists saved searches belonging to a user by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\SavedSearchesApi( + // 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 = 42; // int | The unique identifier of the user. + +try { + $result = $apiInstance->usersIdSavedSearchesGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling SavedSearchesApi->usersIdSavedSearchesGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | + +### Return type + +[**\OpenAPI\Client\Model\SavedSearch[]**](../Model/SavedSearch.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/TimeZonesApi.md b/docs/Api/TimeZonesApi.md new file mode 100644 index 0000000..cc64932 --- /dev/null +++ b/docs/Api/TimeZonesApi.md @@ -0,0 +1,67 @@ +# OpenAPI\Client\TimeZonesApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**timeZonesGet()**](TimeZonesApi.md#timeZonesGet) | **GET** /time_zones | List time zones | + + +## `timeZonesGet()` + +```php +timeZonesGet(): \OpenAPI\Client\Model\TimeZone[] +``` + +List time zones + +Lists time zones. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TimeZonesApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->timeZonesGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TimeZonesApi->timeZonesGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\OpenAPI\Client\Model\TimeZone[]**](../Model/TimeZone.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/TransactionAccountsApi.md b/docs/Api/TransactionAccountsApi.md new file mode 100644 index 0000000..2ca139e --- /dev/null +++ b/docs/Api/TransactionAccountsApi.md @@ -0,0 +1,198 @@ +# OpenAPI\Client\TransactionAccountsApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**transactionAccountsIdGet()**](TransactionAccountsApi.md#transactionAccountsIdGet) | **GET** /transaction_accounts/{id} | Get transaction account | +| [**transactionAccountsIdPut()**](TransactionAccountsApi.md#transactionAccountsIdPut) | **PUT** /transaction_accounts/{id} | Update transaction account | +| [**usersIdTransactionAccountsGet()**](TransactionAccountsApi.md#usersIdTransactionAccountsGet) | **GET** /users/{id}/transaction_accounts | List transaction accounts in user | + + +## `transactionAccountsIdGet()` + +```php +transactionAccountsIdGet($id): \OpenAPI\Client\Model\TransactionAccount +``` + +Get transaction account + +Gets a transaction account by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TransactionAccountsApi( + // 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 = 42; // int | The unique identifier of the transaction account. + +try { + $result = $apiInstance->transactionAccountsIdGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionAccountsApi->transactionAccountsIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the transaction account. | | + +### Return type + +[**\OpenAPI\Client\Model\TransactionAccount**](../Model/TransactionAccount.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `transactionAccountsIdPut()` + +```php +transactionAccountsIdPut($id, $transaction_accounts_id_put_request): \OpenAPI\Client\Model\TransactionAccount +``` + +Update transaction account + +Updates the transaction account by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TransactionAccountsApi( + // 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 = 42; // int | The unique identifier of the transaction account. +$transaction_accounts_id_put_request = new \OpenAPI\Client\Model\TransactionAccountsIdPutRequest(); // \OpenAPI\Client\Model\TransactionAccountsIdPutRequest + +try { + $result = $apiInstance->transactionAccountsIdPut($id, $transaction_accounts_id_put_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionAccountsApi->transactionAccountsIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the transaction account. | | +| **transaction_accounts_id_put_request** | [**\OpenAPI\Client\Model\TransactionAccountsIdPutRequest**](../Model/TransactionAccountsIdPutRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\TransactionAccount**](../Model/TransactionAccount.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdTransactionAccountsGet()` + +```php +usersIdTransactionAccountsGet($id): \OpenAPI\Client\Model\TransactionAccount[] +``` + +List transaction accounts in user + +List all transaction accounts belonging to a user. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TransactionAccountsApi( + // 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 = 42; // int | The unique identifier of the user. + +try { + $result = $apiInstance->usersIdTransactionAccountsGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionAccountsApi->usersIdTransactionAccountsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | + +### Return type + +[**\OpenAPI\Client\Model\TransactionAccount[]**](../Model/TransactionAccount.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/TransactionsApi.md b/docs/Api/TransactionsApi.md new file mode 100644 index 0000000..1513b17 --- /dev/null +++ b/docs/Api/TransactionsApi.md @@ -0,0 +1,578 @@ +# OpenAPI\Client\TransactionsApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**accountsIdTransactionsGet()**](TransactionsApi.md#accountsIdTransactionsGet) | **GET** /accounts/{id}/transactions | List transactions in account | +| [**categoriesIdTransactionsGet()**](TransactionsApi.md#categoriesIdTransactionsGet) | **GET** /categories/{id}/transactions | List transactions in categories | +| [**transactionAccountsIdTransactionsGet()**](TransactionsApi.md#transactionAccountsIdTransactionsGet) | **GET** /transaction_accounts/{id}/transactions | List transactions in transaction account | +| [**transactionAccountsIdTransactionsPost()**](TransactionsApi.md#transactionAccountsIdTransactionsPost) | **POST** /transaction_accounts/{id}/transactions | Create a transaction in transaction account | +| [**transactionsIdDelete()**](TransactionsApi.md#transactionsIdDelete) | **DELETE** /transactions/{id} | Delete transaction | +| [**transactionsIdGet()**](TransactionsApi.md#transactionsIdGet) | **GET** /transactions/{id} | Get a transaction | +| [**transactionsIdPut()**](TransactionsApi.md#transactionsIdPut) | **PUT** /transactions/{id} | Update a transaction | +| [**usersIdTransactionsGet()**](TransactionsApi.md#usersIdTransactionsGet) | **GET** /users/{id}/transactions | List transactions in user | + + +## `accountsIdTransactionsGet()` + +```php +accountsIdTransactionsGet($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page): \OpenAPI\Client\Model\Transaction[] +``` + +List transactions in account + +Lists transactions belonging to an account by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TransactionsApi( + // 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 = 42; // int | The unique identifier of the account. +$start_date = 2016-11-01; // string | Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. +$end_date = 2016-11-30; // string | Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. +$updated_since = 2020-10-14T09:20:33+13:00; // string | Limit to transactions updated since an ISO 8601 timestamp. +$uncategorised = 1; // int | Limit to uncategorised transactions. +$type = debit; // string | Limit to transactions of this type. +$needs_review = 1; // int | Limit to transactions that need to be reviewed. +$search = Paypal; // string | Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. +$page = 3; // int | Choose a particular page of the results. + +try { + $result = $apiInstance->accountsIdTransactionsGet($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionsApi->accountsIdTransactionsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the account. | | +| **start_date** | **string**| Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. | [optional] | +| **end_date** | **string**| Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. | [optional] | +| **updated_since** | **string**| Limit to transactions updated since an ISO 8601 timestamp. | [optional] | +| **uncategorised** | **int**| Limit to uncategorised transactions. | [optional] | +| **type** | **string**| Limit to transactions of this type. | [optional] | +| **needs_review** | **int**| Limit to transactions that need to be reviewed. | [optional] | +| **search** | **string**| Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. | [optional] | +| **page** | **int**| Choose a particular page of the results. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Transaction[]**](../Model/Transaction.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `categoriesIdTransactionsGet()` + +```php +categoriesIdTransactionsGet($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page): \OpenAPI\Client\Model\Transaction[] +``` + +List transactions in categories + +Lists transactions belonging to one or more categories by their IDs. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TransactionsApi( + // 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 = 42,43; // string | A comma-separated list of category IDs. +$start_date = 2016-11-01; // string | Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. +$end_date = 2016-11-30; // string | Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. +$updated_since = 2020-10-14T09:20:33+13:00; // string | Limit to transactions updated since an ISO 8601 timestamp. +$uncategorised = 1; // int | Limit to uncategorised transactions. +$type = debit; // string | Limit to transactions of this type. +$needs_review = 1; // int | Limit to transactions that need to be reviewed. +$search = Paypal; // string | Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. +$page = 3; // int | Choose a particular page of the results. + +try { + $result = $apiInstance->categoriesIdTransactionsGet($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionsApi->categoriesIdTransactionsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **string**| A comma-separated list of category IDs. | | +| **start_date** | **string**| Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. | [optional] | +| **end_date** | **string**| Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. | [optional] | +| **updated_since** | **string**| Limit to transactions updated since an ISO 8601 timestamp. | [optional] | +| **uncategorised** | **int**| Limit to uncategorised transactions. | [optional] | +| **type** | **string**| Limit to transactions of this type. | [optional] | +| **needs_review** | **int**| Limit to transactions that need to be reviewed. | [optional] | +| **search** | **string**| Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. | [optional] | +| **page** | **int**| Choose a particular page of the results. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Transaction[]**](../Model/Transaction.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `transactionAccountsIdTransactionsGet()` + +```php +transactionAccountsIdTransactionsGet($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page): \OpenAPI\Client\Model\Transaction[] +``` + +List transactions in transaction account + +Lists transactions belonging to a transaction account by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TransactionsApi( + // 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 = 42; // int | The unique identifier of the transaction account. +$start_date = 2016-11-01; // string | Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. +$end_date = 2016-11-30; // string | Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. +$updated_since = 2020-10-14T09:20:33+13:00; // string | Limit to transactions updated since an ISO 8601 timestamp. +$uncategorised = 1; // int | Limit to uncategorised transactions. +$type = debit; // string | Limit to transactions of this type. +$needs_review = 1; // int | Limit to transactions that need to be reviewed. +$search = Paypal; // string | Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. +$page = 3; // int | Choose a particular page of the results. + +try { + $result = $apiInstance->transactionAccountsIdTransactionsGet($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionsApi->transactionAccountsIdTransactionsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the transaction account. | | +| **start_date** | **string**| Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. | [optional] | +| **end_date** | **string**| Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. | [optional] | +| **updated_since** | **string**| Limit to transactions updated since an ISO 8601 timestamp. | [optional] | +| **uncategorised** | **int**| Limit to uncategorised transactions. | [optional] | +| **type** | **string**| Limit to transactions of this type. | [optional] | +| **needs_review** | **int**| Limit to transactions that need to be reviewed. | [optional] | +| **search** | **string**| Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. | [optional] | +| **page** | **int**| Choose a particular page of the results. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Transaction[]**](../Model/Transaction.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `transactionAccountsIdTransactionsPost()` + +```php +transactionAccountsIdTransactionsPost($id, $transaction_accounts_id_transactions_post_request): \OpenAPI\Client\Model\Transaction +``` + +Create a transaction in transaction account + +Creates a transaction in a transaction account by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TransactionsApi( + // 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 = 42; // int | The unique identifier of the transaction account. +$transaction_accounts_id_transactions_post_request = new \OpenAPI\Client\Model\TransactionAccountsIdTransactionsPostRequest(); // \OpenAPI\Client\Model\TransactionAccountsIdTransactionsPostRequest + +try { + $result = $apiInstance->transactionAccountsIdTransactionsPost($id, $transaction_accounts_id_transactions_post_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionsApi->transactionAccountsIdTransactionsPost: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the transaction account. | | +| **transaction_accounts_id_transactions_post_request** | [**\OpenAPI\Client\Model\TransactionAccountsIdTransactionsPostRequest**](../Model/TransactionAccountsIdTransactionsPostRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Transaction**](../Model/Transaction.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `transactionsIdDelete()` + +```php +transactionsIdDelete($id) +``` + +Delete transaction + +Deletes a transaction and all its data by ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TransactionsApi( + // 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 = 42; // int | The unique identifier of the transaction. + +try { + $apiInstance->transactionsIdDelete($id); +} catch (Exception $e) { + echo 'Exception when calling TransactionsApi->transactionsIdDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the transaction. | | + +### Return type + +void (empty response body) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `transactionsIdGet()` + +```php +transactionsIdGet($id): \OpenAPI\Client\Model\Transaction +``` + +Get a transaction + +Gets a transaction by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TransactionsApi( + // 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 = 42; // int | The unique identifier of the transaction. + +try { + $result = $apiInstance->transactionsIdGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionsApi->transactionsIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the transaction. | | + +### Return type + +[**\OpenAPI\Client\Model\Transaction**](../Model/Transaction.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `transactionsIdPut()` + +```php +transactionsIdPut($id, $transactions_id_put_request): \OpenAPI\Client\Model\Transaction +``` + +Update a transaction + +Updates a transaction by its ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TransactionsApi( + // 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 = 42; // int | The unique identifier of the transaction. +$transactions_id_put_request = new \OpenAPI\Client\Model\TransactionsIdPutRequest(); // \OpenAPI\Client\Model\TransactionsIdPutRequest + +try { + $result = $apiInstance->transactionsIdPut($id, $transactions_id_put_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionsApi->transactionsIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the transaction. | | +| **transactions_id_put_request** | [**\OpenAPI\Client\Model\TransactionsIdPutRequest**](../Model/TransactionsIdPutRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Transaction**](../Model/Transaction.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdTransactionsGet()` + +```php +usersIdTransactionsGet($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page): \OpenAPI\Client\Model\Transaction[] +``` + +List transactions in user + +Lists transactions belonging to a user by their ID. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\TransactionsApi( + // 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 = 42; // int | The unique identifier of the account. +$start_date = 2016-11-01; // string | Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. +$end_date = 2016-11-30; // string | Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. +$updated_since = 2020-10-14T09:20:33+13:00; // string | Limit to transactions updated since an ISO 8601 timestamp. +$uncategorised = 1; // int | Limit to uncategorised transactions. +$type = debit; // string | Limit to transactions of this type. +$needs_review = 1; // int | Limit to transactions that need to be reviewed. +$search = Paypal; // string | Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. +$page = 3; // int | Choose a particular page of the results. + +try { + $result = $apiInstance->usersIdTransactionsGet($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling TransactionsApi->usersIdTransactionsGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the account. | | +| **start_date** | **string**| Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. | [optional] | +| **end_date** | **string**| Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. | [optional] | +| **updated_since** | **string**| Limit to transactions updated since an ISO 8601 timestamp. | [optional] | +| **uncategorised** | **int**| Limit to uncategorised transactions. | [optional] | +| **type** | **string**| Limit to transactions of this type. | [optional] | +| **needs_review** | **int**| Limit to transactions that need to be reviewed. | [optional] | +| **search** | **string**| Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. | [optional] | +| **page** | **int**| Choose a particular page of the results. | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\Transaction[]**](../Model/Transaction.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/UsersApi.md b/docs/Api/UsersApi.md new file mode 100644 index 0000000..562dd0e --- /dev/null +++ b/docs/Api/UsersApi.md @@ -0,0 +1,195 @@ +# OpenAPI\Client\UsersApi + +All URIs are relative to https://api.pocketsmith.com/v2, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**meGet()**](UsersApi.md#meGet) | **GET** /me | Get the authorised user | +| [**usersIdGet()**](UsersApi.md#usersIdGet) | **GET** /users/{id} | Get user | +| [**usersIdPut()**](UsersApi.md#usersIdPut) | **PUT** /users/{id} | Update user | + + +## `meGet()` + +```php +meGet(): \OpenAPI\Client\Model\User +``` + +Get the authorised user + +Gets the user that corresponds to the access token used in the request. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\UsersApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->meGet(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling UsersApi->meGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\OpenAPI\Client\Model\User**](../Model/User.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdGet()` + +```php +usersIdGet($id): \OpenAPI\Client\Model\User +``` + +Get user + +Gets a user by ID. You must be authorised as the target user in order to make this request. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\UsersApi( + // 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 = 42; // int | The unique identifier of the user. + +try { + $result = $apiInstance->usersIdGet($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling UsersApi->usersIdGet: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | + +### Return type + +[**\OpenAPI\Client\Model\User**](../Model/User.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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) + +## `usersIdPut()` + +```php +usersIdPut($id, $users_id_put_request): \OpenAPI\Client\Model\User +``` + +Update user + +Updates the user by their ID. You must be authorised as the target user in order to make this request. + +### Example + +```php +setApiKey('X-Developer-Key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Developer-Key', 'Bearer'); + + +$apiInstance = new OpenAPI\Client\Api\UsersApi( + // 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 = 42; // int | The unique identifier of the user. +$users_id_put_request = new \OpenAPI\Client\Model\UsersIdPutRequest(); // \OpenAPI\Client\Model\UsersIdPutRequest + +try { + $result = $apiInstance->usersIdPut($id, $users_id_put_request); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling UsersApi->usersIdPut: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **id** | **int**| The unique identifier of the user. | | +| **users_id_put_request** | [**\OpenAPI\Client\Model\UsersIdPutRequest**](../Model/UsersIdPutRequest.md)| | [optional] | + +### Return type + +[**\OpenAPI\Client\Model\User**](../Model/User.md) + +### Authorization + +[developerKey](../../README.md#developerKey) + +### 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/Model/Account.md b/docs/Model/Account.md new file mode 100644 index 0000000..9b4eca7 --- /dev/null +++ b/docs/Model/Account.md @@ -0,0 +1,25 @@ +# # Account + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The unique identifier of the account. | [optional] +**title** | **string** | The title of the account. | [optional] +**currency_code** | **string** | The currency code for the account. | [optional] +**type** | **string** | The type of the account. | [optional] +**is_net_worth** | **bool** | Whether the account is a net worth asset. | [optional] +**primary_transaction_account** | [**\OpenAPI\Client\Model\TransactionAccount**](TransactionAccount.md) | | [optional] +**primary_scenario** | [**\OpenAPI\Client\Model\Scenario**](Scenario.md) | | [optional] +**transaction_accounts** | [**\OpenAPI\Client\Model\TransactionAccount[]**](TransactionAccount.md) | All transaction accounts that compose the account, including the primary. | [optional] +**scenarios** | [**\OpenAPI\Client\Model\Scenario[]**](Scenario.md) | All scenarios that compose the account, including the primary. | [optional] +**created_at** | **string** | When the account was created. | [optional] +**updated_at** | **string** | When the account was last updated. | [optional] +**current_balance** | **float** | The current balance of the account. | [optional] +**current_balance_date** | **string** | The date of the current balance. | [optional] +**current_balance_in_base_currency** | **float** | The current balance of the account in the user's base currency. | [optional] +**current_balance_exchange_rate** | **float** | The exchange rate between the account's currency and the user's base currency, when different. If the currencies are the same, null is returned. | [optional] +**safe_balance** | **float** | The current safe balance, if safe balance is activated on the account. If safe balance is not activated, then null is returned. | [optional] +**safe_balance_in_base_currency** | **float** | The current safe balance in the user's base currency, if safe balance is activated on the account. If safe balance is not activated, then null is returned. | [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/AccountsIdPutRequest.md b/docs/Model/AccountsIdPutRequest.md new file mode 100644 index 0000000..b3f41e3 --- /dev/null +++ b/docs/Model/AccountsIdPutRequest.md @@ -0,0 +1,12 @@ +# # AccountsIdPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | A new title for the account. | [optional] +**currency_code** | **string** | A new currency code for the account. | [optional] +**type** | **string** | The type of the account. | [optional] +**is_net_worth** | **bool** | Whether the account is a net worth account. | [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/Attachment.md b/docs/Model/Attachment.md new file mode 100644 index 0000000..9155556 --- /dev/null +++ b/docs/Model/Attachment.md @@ -0,0 +1,18 @@ +# # Attachment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The unique identifier of the attachment | [optional] +**title** | **string** | The title of the attachment. If blank or not provided, the title will be derived from the file name. | [optional] +**file_name** | **string** | The file name of the attachment. | [optional] +**type** | **string** | The type of attachment. | [optional] +**content_type** | **string** | The content type of the attachment. | [optional] +**content_type_meta** | [**\OpenAPI\Client\Model\AttachmentContentTypeMeta**](AttachmentContentTypeMeta.md) | | [optional] +**original_url** | **string** | The url of the attachment. | [optional] +**variants** | [**\OpenAPI\Client\Model\AttachmentVariants**](AttachmentVariants.md) | | [optional] +**created_at** | **string** | When the attachment was created. | [optional] +**updated_at** | **string** | When the attachment was last updated. | [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/AttachmentContentTypeMeta.md b/docs/Model/AttachmentContentTypeMeta.md new file mode 100644 index 0000000..72f1ca7 --- /dev/null +++ b/docs/Model/AttachmentContentTypeMeta.md @@ -0,0 +1,11 @@ +# # AttachmentContentTypeMeta + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The content type title of the attachment. | [optional] +**description** | **string** | The content type description of the attachment. | [optional] +**extension** | **string** | The extension type of the attachment. | [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/AttachmentVariants.md b/docs/Model/AttachmentVariants.md new file mode 100644 index 0000000..aa09f3e --- /dev/null +++ b/docs/Model/AttachmentVariants.md @@ -0,0 +1,10 @@ +# # AttachmentVariants + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**large_url** | **string** | The url of the large version of the attachment. | [optional] +**thumb_url** | **string** | The url of the thumb version of the attachment. | [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/AttachmentsIdPutRequest.md b/docs/Model/AttachmentsIdPutRequest.md new file mode 100644 index 0000000..74c6c08 --- /dev/null +++ b/docs/Model/AttachmentsIdPutRequest.md @@ -0,0 +1,9 @@ +# # AttachmentsIdPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The new title of the attachment. If the title is blank or not provided, the server will derive a title from the file name. | [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/BudgetAnalysis.md b/docs/Model/BudgetAnalysis.md new file mode 100644 index 0000000..b314682 --- /dev/null +++ b/docs/Model/BudgetAnalysis.md @@ -0,0 +1,18 @@ +# # BudgetAnalysis + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start_date** | **string** | The start date of the budget analysis. | [optional] +**end_date** | **string** | The end date of the budget analysis. | [optional] +**currency_code** | **string** | The currency of the budget analysis. | [optional] +**total_actual_amount** | **float** | The total actual (transactions) amount across all periods. | [optional] +**average_actual_amount** | **float** | The average actual (transactions) amount across all periods. | [optional] +**total_forecast_amount** | **float** | The total budgeted amount across all periods. | [optional] +**average_forecast_amount** | **float** | The average budgeted amount across all periods. | [optional] +**total_over_by** | **float** | The total amount the budget was exceeded across all periods. | [optional] +**total_under_by** | **float** | The total amount the budget was under by across all periods. | [optional] +**periods** | [**\OpenAPI\Client\Model\Period[]**](Period.md) | The period analyses that this budget analysis comprises. | [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/BudgetAnalysisPackage.md b/docs/Model/BudgetAnalysisPackage.md new file mode 100644 index 0000000..0c1fce4 --- /dev/null +++ b/docs/Model/BudgetAnalysisPackage.md @@ -0,0 +1,12 @@ +# # BudgetAnalysisPackage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | [**\OpenAPI\Client\Model\Category**](Category.md) | | [optional] +**is_transfer** | **bool** | Whether the expense budget analysis looks like a transfer to the income budget analysis, based on a number of heuristics. | [optional] +**expense** | [**\OpenAPI\Client\Model\BudgetAnalysis**](BudgetAnalysis.md) | | [optional] +**income** | [**\OpenAPI\Client\Model\BudgetAnalysis**](BudgetAnalysis.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/CategoriesIdCategoryRulesPostRequest.md b/docs/Model/CategoriesIdCategoryRulesPostRequest.md new file mode 100644 index 0000000..ab75003 --- /dev/null +++ b/docs/Model/CategoriesIdCategoryRulesPostRequest.md @@ -0,0 +1,11 @@ +# # CategoriesIdCategoryRulesPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payee_matches** | **string** | The keyword/s to match the transaction payees. | +**apply_to_uncategorised** | **bool** | Apply the created category rule to all uncategorised transactions. | [optional] +**apply_to_all** | **bool** | Apply the created category rule to all transactions. | [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/CategoriesIdPutRequest.md b/docs/Model/CategoriesIdPutRequest.md new file mode 100644 index 0000000..db7ffbc --- /dev/null +++ b/docs/Model/CategoriesIdPutRequest.md @@ -0,0 +1,15 @@ +# # CategoriesIdPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | A new title for the category. | [optional] +**colour** | **string** | A new CSS-style hex colour for the category. | [optional] +**parent_id** | **int** | The unique identifier of a parent category for the category, making this category a child of that category. | [optional] +**is_transfer** | **bool** | Set the category as a transfer category. | [optional] +**is_bill** | **bool** | Set the category as a bill category. | [optional] +**roll_up** | **bool** | Set the category to be rolled up into its parent category. | [optional] +**refund_behaviour** | **string** | Set the refund behaviour of the category. | [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/Category.md b/docs/Model/Category.md new file mode 100644 index 0000000..5156db1 --- /dev/null +++ b/docs/Model/Category.md @@ -0,0 +1,19 @@ +# # Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The unique identifier of the category. | [optional] +**title** | **string** | The title of the category. | [optional] +**colour** | **string** | The colour for the category. | [optional] +**children** | [**\OpenAPI\Client\Model\Category[]**](Category.md) | The category's child categories. | [optional] +**parent_id** | **int** | The unique identifier of the parent category of this category, or null if this category has no parent (i.e. is a top-level category) | [optional] +**is_transfer** | **bool** | Whether this category has been marked as a transfer category. | [optional] +**is_bill** | **bool** | Whether the category is a bill category. A bill category is when budgeted amounts are normally spent at once, instead of spread across a budgeting period. This category will be included in the bill reminder email when set to true. | [optional] +**roll_up** | **bool** | Whether the category's budget is rolled up into its parent category, if a parent category is present. | [optional] +**refund_behaviour** | **string** | How the category's refunds or deductions should be reported on. | [optional] +**created_at** | **string** | When the category was created. | [optional] +**updated_at** | **string** | When the category was last updated. | [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/CategoryRule.md b/docs/Model/CategoryRule.md new file mode 100644 index 0000000..5a218c4 --- /dev/null +++ b/docs/Model/CategoryRule.md @@ -0,0 +1,13 @@ +# # CategoryRule + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | [**\OpenAPI\Client\Model\Category**](Category.md) | | [optional] +**id** | **int** | The unique identifier of the category rule. | [optional] +**payee_matches** | **string** | The keyword/s to match the transactions payees. | [optional] +**created_at** | **string** | When the category rule was created. | [optional] +**updated_at** | **string** | When the category rule was last updated. | [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/Currency.md b/docs/Model/Currency.md new file mode 100644 index 0000000..b1499de --- /dev/null +++ b/docs/Model/Currency.md @@ -0,0 +1,13 @@ +# # Currency + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The ISO 4217 or unofficial currency code. | [optional] +**name** | **string** | The name of the currency. | [optional] +**minor_unit** | **int** | The number of digits after the minor unit separator. | [optional] +**separators** | [**\OpenAPI\Client\Model\CurrencySeparators**](CurrencySeparators.md) | | [optional] +**symbol** | **string** | The symbol of the currency. | [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/CurrencySeparators.md b/docs/Model/CurrencySeparators.md new file mode 100644 index 0000000..b1ccd13 --- /dev/null +++ b/docs/Model/CurrencySeparators.md @@ -0,0 +1,10 @@ +# # CurrencySeparators + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**major** | **string** | The separator used in the major unit. | [optional] +**minor** | **string** | The seperator used for the minor unit. | [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/Error.md b/docs/Model/Error.md new file mode 100644 index 0000000..5467bc6 --- /dev/null +++ b/docs/Model/Error.md @@ -0,0 +1,9 @@ +# # Error + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | **string** | A message describing the error that occurred. | [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/Event.md b/docs/Model/Event.md new file mode 100644 index 0000000..eebc974 --- /dev/null +++ b/docs/Model/Event.md @@ -0,0 +1,22 @@ +# # Event + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The unique identifier of the event. | [optional] +**category** | [**\OpenAPI\Client\Model\Category**](Category.md) | | [optional] +**scenario** | [**\OpenAPI\Client\Model\Scenario**](Scenario.md) | | [optional] +**amount** | **float** | The amount of the event. | [optional] +**amount_in_base_currency** | **float** | The amount of the event in the user's base currency. | [optional] +**currency_code** | **string** | The currency code of the event. | [optional] +**date** | **string** | The date of the event. | [optional] +**colour** | **string** | The CSS hex-style colour of the event. | [optional] +**note** | **string** | The note of the event. | [optional] +**repeat_type** | **string** | The repeat type of the event. | [optional] +**repeat_interval** | **int** | The repeat interval of how often the event takes place. | [optional] +**series_id** | **int** | The unique identifier of the series that the event belongs to. | [optional] +**series_start_id** | **string** | The unique identifier of the series followed by the series's start date. | [optional] +**infinite_series** | **bool** | Whether the event repeats and does not have an end date. | [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/EventsIdPutRequest.md b/docs/Model/EventsIdPutRequest.md new file mode 100644 index 0000000..7cbcbe8 --- /dev/null +++ b/docs/Model/EventsIdPutRequest.md @@ -0,0 +1,13 @@ +# # EventsIdPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**behaviour** | **string** | Whether the update applies only to this event, to all events within the series from this event or to all events within the series. | +**amount** | **float** | The amount of the event. A positive amount is a credit, and a negative amount is a debit. | [optional] +**repeat_type** | **string** | The repeat type of the event. | [optional] +**repeat_interval** | **int** | The repeat interval of the event. | [optional] +**note** | **string** | A note for the event. | [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/Institution.md b/docs/Model/Institution.md new file mode 100644 index 0000000..81367cd --- /dev/null +++ b/docs/Model/Institution.md @@ -0,0 +1,13 @@ +# # Institution + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**currency_code** | **string** | The currency code of the institution. | [optional] +**title** | **string** | The title of the institution. | [optional] +**updated_at** | **string** | When the institution was last updated. | [optional] +**created_at** | **string** | When the institution was created. | [optional] +**id** | **int** | The unique identifier of the institution. | [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/InstitutionsIdPutRequest.md b/docs/Model/InstitutionsIdPutRequest.md new file mode 100644 index 0000000..5c4d495 --- /dev/null +++ b/docs/Model/InstitutionsIdPutRequest.md @@ -0,0 +1,10 @@ +# # InstitutionsIdPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | A new title for the institution. | [optional] +**currency_code** | **string** | A new currency code for the institution. | [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/Period.md b/docs/Model/Period.md new file mode 100644 index 0000000..0c7b0dd --- /dev/null +++ b/docs/Model/Period.md @@ -0,0 +1,20 @@ +# # Period + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start_date** | **string** | The start date of the period. | [optional] +**end_date** | **string** | The end date of the period. | [optional] +**currency_code** | **string** | The currency of the period. | [optional] +**actual_amount** | **float** | The sum of all actuals (transactions) in the period. | [optional] +**forecast_amount** | **float** | The sum of all forecast sources (budget events) in the period, for comparison against the actual amount. | [optional] +**refund_amount** | **float** | This attribute tracks the amount that has been refunded or deducted to the actual amount. When a category is set to \"always expense\", any credit transactions are treated as refunds and when set to \"always income\", any debit transactions are treated as deductions. | [optional] +**current** | **bool** | Whether this period is current, such that the current date (in the user's time zone) falls within the date range. | [optional] +**over_budget** | **bool** | Whether the budget has been exceeded in the period. | [optional] +**under_budget** | **bool** | Whether the budget has not been exceeded in the period. | [optional] +**over_by** | **float** | How much the budget has been exceeded by in the period. | [optional] +**under_by** | **float** | How much there is left in the budget for the period. | [optional] +**percentage_used** | **float** | The percentage of the budget that has been used in the period. | [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/SavedSearch.md b/docs/Model/SavedSearch.md new file mode 100644 index 0000000..15f86ea --- /dev/null +++ b/docs/Model/SavedSearch.md @@ -0,0 +1,12 @@ +# # SavedSearch + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The unique identifier of the saved search. | [optional] +**title** | **string** | The title of the saved search. | [optional] +**created_at** | **string** | When the saved search was created. | [optional] +**updated_at** | **string** | When the saved search was last updated. | [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/Scenario.md b/docs/Model/Scenario.md new file mode 100644 index 0000000..10e6a54 --- /dev/null +++ b/docs/Model/Scenario.md @@ -0,0 +1,29 @@ +# # Scenario + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The unique identifier of the scenario. | [optional] +**title** | **string** | The title of the scenario. | [optional] +**description** | **string** | A short description of what the scenario is modelling. | [optional] +**interest_rate** | **float** | The amount of interest to apply to the balance. Will apply periodically depending on what `interest_rate_repeat_id` is set to. | [optional] +**interest_rate_repeat_id** | **int** | A number representing how often the interest should be applied. 0 is used for no interest, 2 is weekly, 3 is fortnightly, 4 is monthly, 5 is yearly and 7 for quarterly. | [optional] +**type** | **string** | The type of the scenario. | [optional] +**minimum_value** | **float** | | [optional] +**maximum_value** | **float** | | [optional] +**achieve_date** | **string** | For goals, the date that they should be achieved by. | [optional] +**starting_balance** | **float** | The starting balance of the scenario. | [optional] +**starting_balance_date** | **string** | The date of the starting balance. | [optional] +**closing_balance** | **float** | The closing balance of the scenario. | [optional] +**closing_balance_date** | **string** | The date of the closing balance. | [optional] +**current_balance** | **float** | The current balance of the scenario. | [optional] +**current_balance_date** | **string** | The date of the current balance. | [optional] +**current_balance_in_base_currency** | **float** | The current balance of the scenario in the user's base currency. | [optional] +**current_balance_exchange_rate** | **float** | The exchange rate between the scenario's currency and the user's base currency, when different. If the currencies are the same, null is returned. | [optional] +**safe_balance** | **float** | The current safe balance in the user's base currency, if safe balance is activated on the account associated with the scenario. If safe balance is not activated, then null is returned. | [optional] +**safe_balance_in_base_currency** | **float** | The current safe balance in the user's base currency, if safe balance is activated on the account associated with the scenario. If safe balance is not available, then null is returned. | [optional] +**created_at** | **string** | When the scenario was created. | [optional] +**updated_at** | **string** | When the scenario was last updated. | [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/ScenariosIdEventsPostRequest.md b/docs/Model/ScenariosIdEventsPostRequest.md new file mode 100644 index 0000000..4be8a9f --- /dev/null +++ b/docs/Model/ScenariosIdEventsPostRequest.md @@ -0,0 +1,14 @@ +# # ScenariosIdEventsPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category_id** | **int** | The unique identifier of the category for the event. | +**date** | **string** | The starting date of the event. | +**amount** | **float** | The amount of the event. A positive amount is a credit, and a negative amount is a debit. | +**repeat_type** | **string** | The repeat type of the event. | +**repeat_interval** | **int** | The repeat interval of the event. | [optional] [default to 1] +**note** | **string** | A note for the event. | [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/TimeZone.md b/docs/Model/TimeZone.md new file mode 100644 index 0000000..cd1b537 --- /dev/null +++ b/docs/Model/TimeZone.md @@ -0,0 +1,14 @@ +# # TimeZone + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | The name of the time zone. | [optional] +**utc_offset** | **int** | The time zone's UTC offset in seconds. | [optional] +**formatted_name** | **string** | The formatted name of the time zone. | [optional] +**formatted_offset** | **string** | The formatted offset of the time zone. | [optional] +**abbreviation** | **string** | The abbreviation of the time zone. | [optional] +**identifier** | **string** | The tz database name of the time zone. | [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/Transaction.md b/docs/Model/Transaction.md new file mode 100644 index 0000000..3047257 --- /dev/null +++ b/docs/Model/Transaction.md @@ -0,0 +1,28 @@ +# # Transaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cheque_number** | **string** | | [optional] +**type** | **string** | Whether the transaction is a debit or a credit | [optional] +**memo** | **string** | | [optional] +**payee** | **string** | The payee/merchant of the transaction. | [optional] +**amount** | **float** | | [optional] +**amount_in_base_currency** | **float** | The amount of the transaction in the user's base currency. | [optional] +**date** | **string** | The date the transaction took place. | [optional] +**is_transfer** | **bool** | Whether the transaction is a transfer. | [optional] +**category** | [**\OpenAPI\Client\Model\Category**](Category.md) | | [optional] +**note** | **string** | | [optional] +**labels** | **string[]** | | [optional] +**id** | **int** | The unique identifier of the transaction. | [optional] +**original_payee** | **string** | The payee the transaction was created with. | [optional] +**upload_source** | **string** | Where the transaction came from. | [optional] +**closing_balance** | **float** | The closing balance of the account at the transaction. | [optional] +**transaction_account** | [**\OpenAPI\Client\Model\TransactionAccount**](TransactionAccount.md) | | [optional] +**status** | **string** | The status of the transaction. Pending transactions are temporary and may be superseded later by their posted counterparts, which are permanent. | [optional] +**needs_review** | **bool** | Whether the transaction needs to be reviewed. | [optional] +**created_at** | **string** | When the transaction was created. | [optional] +**updated_at** | **string** | When the transaction was last updated. | [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/TransactionAccount.md b/docs/Model/TransactionAccount.md new file mode 100644 index 0000000..841fb98 --- /dev/null +++ b/docs/Model/TransactionAccount.md @@ -0,0 +1,24 @@ +# # TransactionAccount + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **string** | | [optional] +**number** | **string** | | [optional] +**current_balance** | **float** | | [optional] +**current_balance_date** | **string** | | [optional] +**current_balance_in_base_currency** | **float** | The current balance of the transaction account in the user's base currency. | [optional] +**current_balance_exchange_rate** | **float** | The exchange rate between the transaction account's currency and the user's base currency, when different. If the currencies are the same, null is returned. | [optional] +**safe_balance** | **float** | The current safe balance, if safe balance is activated and available for the transaction account. If safe balance is not available, then null is returned. | [optional] +**safe_balance_in_base_currency** | **float** | The current safe balance in the user's base currency, if safe balance is activated and available for the transaction account. If safe balance is not available, then null is returned. | [optional] +**starting_balance** | **float** | | [optional] +**starting_balance_date** | **string** | | [optional] +**created_at** | **string** | | [optional] +**updated_at** | **string** | | [optional] +**institution** | [**\OpenAPI\Client\Model\Institution**](Institution.md) | | [optional] +**currency_code** | **string** | The currency that the account is in. This is determined by the account that the transaction account belongs to. | [optional] +**type** | **string** | The type of the transaction account. | [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/TransactionAccountsIdPutRequest.md b/docs/Model/TransactionAccountsIdPutRequest.md new file mode 100644 index 0000000..5666072 --- /dev/null +++ b/docs/Model/TransactionAccountsIdPutRequest.md @@ -0,0 +1,11 @@ +# # TransactionAccountsIdPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**institution_id** | **int** | The unique identifier of a new institution for the transaction account. | [optional] +**starting_balance** | **float** | The starting balance amount of the transaction account. | [optional] +**starting_balance_date** | **string** | The starting balance date of the transaction account. | [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/TransactionAccountsIdTransactionsPostRequest.md b/docs/Model/TransactionAccountsIdTransactionsPostRequest.md new file mode 100644 index 0000000..412c6e7 --- /dev/null +++ b/docs/Model/TransactionAccountsIdTransactionsPostRequest.md @@ -0,0 +1,18 @@ +# # TransactionAccountsIdTransactionsPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payee** | **string** | The payee/merchant of the transaction. | +**amount** | **float** | The amount of the transaction. A positive amount is a credit, and a negative amount is a debit. | +**date** | **string** | The date when the transaction occurred. | +**is_transfer** | **bool** | Whether the transaction should be indicated as a transfer. | [optional] +**labels** | **string** | A set of comma-separated labels for the transaction. | [optional] +**category_id** | **int** | The unique identifier of a category for the transaction. | [optional] +**note** | **string** | A note for the transaction. | [optional] +**memo** | **string** | A memo for the transaction. | [optional] +**cheque_number** | **string** | A cheque number for the transaction. | [optional] +**needs_review** | **bool** | Whether the transaction needs to be reviewed or not. | [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/TransactionsIdAttachmentsPostRequest.md b/docs/Model/TransactionsIdAttachmentsPostRequest.md new file mode 100644 index 0000000..c46a7d8 --- /dev/null +++ b/docs/Model/TransactionsIdAttachmentsPostRequest.md @@ -0,0 +1,9 @@ +# # TransactionsIdAttachmentsPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**attachment_id** | **int** | The unique identifier of the attachment. | [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/TransactionsIdPutRequest.md b/docs/Model/TransactionsIdPutRequest.md new file mode 100644 index 0000000..e3d4e86 --- /dev/null +++ b/docs/Model/TransactionsIdPutRequest.md @@ -0,0 +1,18 @@ +# # TransactionsIdPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**memo** | **string** | A new memo for the transaction. | [optional] +**cheque_number** | **string** | A new cheque number for the transaction. | [optional] +**payee** | **string** | A new payee for the transaction. | [optional] +**amount** | **float** | A new amount for the transaction. | [optional] +**date** | **string** | A new date for the transaction. | [optional] +**is_transfer** | **bool** | Whether the transaction is a transfer or not. | [optional] +**category_id** | **int** | The unique identifier of a new category for the transaction. | [optional] +**note** | **string** | A new note for the transaction. | [optional] +**needs_review** | **bool** | Whether the transaction needs to be reviewed or not. | [optional] +**labels** | **string** | A new comma-separated set of labels for the transaction. | [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/User.md b/docs/Model/User.md new file mode 100644 index 0000000..a14d19d --- /dev/null +++ b/docs/Model/User.md @@ -0,0 +1,32 @@ +# # User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | The unique identifier of the user. | [optional] +**login** | **string** | The user's username. | [optional] +**name** | **string** | The full name of the user, although not all users will have a name set. | [optional] +**email** | **string** | The user's email address. | [optional] +**avatar_url** | **string** | The URL to the user's avatar. | [optional] +**beta_user** | **bool** | Whether the user has opted in to beta features. | [optional] +**time_zone** | **string** | The user's time zone. | [optional] +**week_start_day** | **int** | The day of the week the user wishes their calendars to start on. A number between 0 and 6, where 0 is Sunday and 6 is Saturday. | [optional] +**is_reviewing_transactions** | **bool** | Whether the user wants to review new transactions, transfer transactions or categorisation. | [optional] +**base_currency_code** | **string** | The user's base currency. | [optional] +**always_show_base_currency** | **bool** | Whether the user wants to see all accounts in their base currency instead of the native account currency. | [optional] +**using_multiple_currencies** | **bool** | Whether the user has multiple currencies in use across their account. | [optional] +**available_accounts** | **int** | The user's total number of available accounts. | [optional] +**available_budgets** | **int** | The user's total number of available budgets. | [optional] +**forecast_last_updated_at** | **string** | When the user's forecast was last updated. | [optional] +**forecast_last_accessed_at** | **string** | When the user's forecast was last accessed. | [optional] +**forecast_start_date** | **string** | The date that the user's forecast starts. | [optional] +**forecast_end_date** | **string** | The date that the user's forecast ends. | [optional] +**forecast_defer_recalculate** | **bool** | Whether the user's forecast recalculation should be deferred. | [optional] +**forecast_needs_recalculate** | **bool** | Whether the user's forecast needs to be recalculated. | [optional] +**last_logged_in_at** | **string** | When the user last logged into PocketSmith. | [optional] +**last_activity_at** | **string** | When the user last interacted with PocketSmith, via any application or the API. | [optional] +**created_at** | **string** | When the user signed up. | [optional] +**updated_at** | **string** | When the user was last updated. | [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/UsersIdAccountsPostRequest.md b/docs/Model/UsersIdAccountsPostRequest.md new file mode 100644 index 0000000..637881e --- /dev/null +++ b/docs/Model/UsersIdAccountsPostRequest.md @@ -0,0 +1,12 @@ +# # UsersIdAccountsPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**institution_id** | **int** | The ID of the institution to create this account in. | +**title** | **string** | A title for the account. | +**currency_code** | **string** | A currency code for the account. | +**type** | **string** | The type of the account. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UsersIdAccountsPutRequest.md b/docs/Model/UsersIdAccountsPutRequest.md new file mode 100644 index 0000000..dfde9c7 --- /dev/null +++ b/docs/Model/UsersIdAccountsPutRequest.md @@ -0,0 +1,9 @@ +# # UsersIdAccountsPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**accounts** | [**\OpenAPI\Client\Model\Account[]**](Account.md) | List the account objects in their new display order. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UsersIdAttachmentsPostRequest.md b/docs/Model/UsersIdAttachmentsPostRequest.md new file mode 100644 index 0000000..b8e6e61 --- /dev/null +++ b/docs/Model/UsersIdAttachmentsPostRequest.md @@ -0,0 +1,11 @@ +# # UsersIdAttachmentsPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | The title of the attachment. If the title is blank or not provided, the title will derived from the file name. | [optional] +**file_name** | **string** | The file name of the attachment. | [optional] +**file_data** | **string** | The base64-encoded contents of the source file. The supported file types are png, jpg, pdf, xls, xlsx, doc, docx. | [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/UsersIdCategoriesPostRequest.md b/docs/Model/UsersIdCategoriesPostRequest.md new file mode 100644 index 0000000..cd817db --- /dev/null +++ b/docs/Model/UsersIdCategoriesPostRequest.md @@ -0,0 +1,15 @@ +# # UsersIdCategoriesPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | A title for the category. | +**colour** | **string** | A CSS-style hex colour for the category. | [optional] +**parent_id** | **int** | The unique identifier of a category to be the parent of this category. | [optional] +**is_transfer** | **bool** | Set the category as a transfer category. | [optional] +**is_bill** | **bool** | Set the category as a bill category. | [optional] +**roll_up** | **bool** | Set the category to be rolled up into its parent category. | [optional] +**refund_behaviour** | **string** | Set the refund behaviour of the category. | [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/UsersIdInstitutionsPostRequest.md b/docs/Model/UsersIdInstitutionsPostRequest.md new file mode 100644 index 0000000..01ecba0 --- /dev/null +++ b/docs/Model/UsersIdInstitutionsPostRequest.md @@ -0,0 +1,10 @@ +# # UsersIdInstitutionsPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | A title for the institution. | +**currency_code** | **string** | A currency code for the institution. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/UsersIdPutRequest.md b/docs/Model/UsersIdPutRequest.md new file mode 100644 index 0000000..47ef414 --- /dev/null +++ b/docs/Model/UsersIdPutRequest.md @@ -0,0 +1,15 @@ +# # UsersIdPutRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | A new email address for the user. | [optional] +**name** | **string** | A new name for the user. | [optional] +**time_zone** | **string** | A new time zone for the user. | [optional] +**week_start_day** | **int** | The day of the week the user wishes their calendars to start on. A number between 0 and 6, where 0 is Sunday and 6 is Saturday. | [optional] +**beta_user** | **bool** | Whether the user is a beta user, and wishes to try out new features. | [optional] +**base_currency_code** | **string** | A new base currency code for the user. | [optional] +**always_show_base_currency** | **bool** | Whether the user wishes to have all monetary values converted to their base currency. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..f53a75d --- /dev/null +++ b/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/lib/Api/AccountsApi.php b/lib/Api/AccountsApi.php new file mode 100644 index 0000000..45f0fa5 --- /dev/null +++ b/lib/Api/AccountsApi.php @@ -0,0 +1,2532 @@ + [ + 'application/json', + ], + 'accountsIdGet' => [ + 'application/json', + ], + 'accountsIdPut' => [ + 'application/json', + ], + 'institutionsIdAccountsGet' => [ + 'application/json', + ], + 'usersIdAccountsGet' => [ + 'application/json', + ], + 'usersIdAccountsPost' => [ + 'application/json', + ], + 'usersIdAccountsPut' => [ + '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 accountsIdDelete + * + * Delete account + * + * @param int $id The unique identifier of the account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function accountsIdDelete($id, string $contentType = self::contentTypes['accountsIdDelete'][0]) + { + $this->accountsIdDeleteWithHttpInfo($id, $contentType); + } + + /** + * Operation accountsIdDeleteWithHttpInfo + * + * Delete account + * + * @param int $id The unique identifier of the account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function accountsIdDeleteWithHttpInfo($id, string $contentType = self::contentTypes['accountsIdDelete'][0]) + { + $request = $this->accountsIdDeleteRequest($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 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation accountsIdDeleteAsync + * + * Delete account + * + * @param int $id The unique identifier of the account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function accountsIdDeleteAsync($id, string $contentType = self::contentTypes['accountsIdDelete'][0]) + { + return $this->accountsIdDeleteAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation accountsIdDeleteAsyncWithHttpInfo + * + * Delete account + * + * @param int $id The unique identifier of the account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function accountsIdDeleteAsyncWithHttpInfo($id, string $contentType = self::contentTypes['accountsIdDelete'][0]) + { + $returnType = ''; + $request = $this->accountsIdDeleteRequest($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 'accountsIdDelete' + * + * @param int $id The unique identifier of the account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function accountsIdDeleteRequest($id, string $contentType = self::contentTypes['accountsIdDelete'][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 accountsIdDelete' + ); + } + + + $resourcePath = '/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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 accountsIdGet + * + * Get account + * + * @param int $id The unique identifier of the account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Account|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function accountsIdGet($id, string $contentType = self::contentTypes['accountsIdGet'][0]) + { + list($response) = $this->accountsIdGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation accountsIdGetWithHttpInfo + * + * Get account + * + * @param int $id The unique identifier of the account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Account|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function accountsIdGetWithHttpInfo($id, string $contentType = self::contentTypes['accountsIdGet'][0]) + { + $request = $this->accountsIdGetRequest($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 ('\OpenAPI\Client\Model\Account' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Account' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Account', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Account'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Account', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation accountsIdGetAsync + * + * Get account + * + * @param int $id The unique identifier of the account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function accountsIdGetAsync($id, string $contentType = self::contentTypes['accountsIdGet'][0]) + { + return $this->accountsIdGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation accountsIdGetAsyncWithHttpInfo + * + * Get account + * + * @param int $id The unique identifier of the account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function accountsIdGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['accountsIdGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Account'; + $request = $this->accountsIdGetRequest($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 'accountsIdGet' + * + * @param int $id The unique identifier of the account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function accountsIdGetRequest($id, string $contentType = self::contentTypes['accountsIdGet'][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 accountsIdGet' + ); + } + + + $resourcePath = '/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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 accountsIdPut + * + * Update account + * + * @param int $id The unique identifier of the account. (required) + * @param \OpenAPI\Client\Model\AccountsIdPutRequest $accounts_id_put_request accounts_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Account|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function accountsIdPut($id, $accounts_id_put_request = null, string $contentType = self::contentTypes['accountsIdPut'][0]) + { + list($response) = $this->accountsIdPutWithHttpInfo($id, $accounts_id_put_request, $contentType); + return $response; + } + + /** + * Operation accountsIdPutWithHttpInfo + * + * Update account + * + * @param int $id The unique identifier of the account. (required) + * @param \OpenAPI\Client\Model\AccountsIdPutRequest $accounts_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Account|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function accountsIdPutWithHttpInfo($id, $accounts_id_put_request = null, string $contentType = self::contentTypes['accountsIdPut'][0]) + { + $request = $this->accountsIdPutRequest($id, $accounts_id_put_request, $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 ('\OpenAPI\Client\Model\Account' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Account' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Account', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Account'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Account', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation accountsIdPutAsync + * + * Update account + * + * @param int $id The unique identifier of the account. (required) + * @param \OpenAPI\Client\Model\AccountsIdPutRequest $accounts_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function accountsIdPutAsync($id, $accounts_id_put_request = null, string $contentType = self::contentTypes['accountsIdPut'][0]) + { + return $this->accountsIdPutAsyncWithHttpInfo($id, $accounts_id_put_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation accountsIdPutAsyncWithHttpInfo + * + * Update account + * + * @param int $id The unique identifier of the account. (required) + * @param \OpenAPI\Client\Model\AccountsIdPutRequest $accounts_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function accountsIdPutAsyncWithHttpInfo($id, $accounts_id_put_request = null, string $contentType = self::contentTypes['accountsIdPut'][0]) + { + $returnType = '\OpenAPI\Client\Model\Account'; + $request = $this->accountsIdPutRequest($id, $accounts_id_put_request, $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 'accountsIdPut' + * + * @param int $id The unique identifier of the account. (required) + * @param \OpenAPI\Client\Model\AccountsIdPutRequest $accounts_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function accountsIdPutRequest($id, $accounts_id_put_request = null, string $contentType = self::contentTypes['accountsIdPut'][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 accountsIdPut' + ); + } + + + + $resourcePath = '/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($accounts_id_put_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($accounts_id_put_request)); + } else { + $httpBody = $accounts_id_put_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 institutionsIdAccountsGet + * + * List accounts in institution + * + * @param int $id The unique identifier of the institution. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdAccountsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Account[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function institutionsIdAccountsGet($id, string $contentType = self::contentTypes['institutionsIdAccountsGet'][0]) + { + list($response) = $this->institutionsIdAccountsGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation institutionsIdAccountsGetWithHttpInfo + * + * List accounts in institution + * + * @param int $id The unique identifier of the institution. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdAccountsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Account[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function institutionsIdAccountsGetWithHttpInfo($id, string $contentType = self::contentTypes['institutionsIdAccountsGet'][0]) + { + $request = $this->institutionsIdAccountsGetRequest($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 ('\OpenAPI\Client\Model\Account[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Account[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Account[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Account[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Account[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation institutionsIdAccountsGetAsync + * + * List accounts in institution + * + * @param int $id The unique identifier of the institution. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdAccountsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function institutionsIdAccountsGetAsync($id, string $contentType = self::contentTypes['institutionsIdAccountsGet'][0]) + { + return $this->institutionsIdAccountsGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation institutionsIdAccountsGetAsyncWithHttpInfo + * + * List accounts in institution + * + * @param int $id The unique identifier of the institution. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdAccountsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function institutionsIdAccountsGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['institutionsIdAccountsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Account[]'; + $request = $this->institutionsIdAccountsGetRequest($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 'institutionsIdAccountsGet' + * + * @param int $id The unique identifier of the institution. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdAccountsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function institutionsIdAccountsGetRequest($id, string $contentType = self::contentTypes['institutionsIdAccountsGet'][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 institutionsIdAccountsGet' + ); + } + + + $resourcePath = '/institutions/{id}/accounts'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdAccountsGet + * + * List accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Account[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdAccountsGet($id, string $contentType = self::contentTypes['usersIdAccountsGet'][0]) + { + list($response) = $this->usersIdAccountsGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation usersIdAccountsGetWithHttpInfo + * + * List accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Account[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdAccountsGetWithHttpInfo($id, string $contentType = self::contentTypes['usersIdAccountsGet'][0]) + { + $request = $this->usersIdAccountsGetRequest($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 ('\OpenAPI\Client\Model\Account[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Account[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Account[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Account[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Account[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdAccountsGetAsync + * + * List accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdAccountsGetAsync($id, string $contentType = self::contentTypes['usersIdAccountsGet'][0]) + { + return $this->usersIdAccountsGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdAccountsGetAsyncWithHttpInfo + * + * List accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdAccountsGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['usersIdAccountsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Account[]'; + $request = $this->usersIdAccountsGetRequest($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 'usersIdAccountsGet' + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdAccountsGetRequest($id, string $contentType = self::contentTypes['usersIdAccountsGet'][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 usersIdAccountsGet' + ); + } + + + $resourcePath = '/users/{id}/accounts'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdAccountsPost + * + * Create an account in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAccountsPostRequest $users_id_accounts_post_request users_id_accounts_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Account|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdAccountsPost($id, $users_id_accounts_post_request = null, string $contentType = self::contentTypes['usersIdAccountsPost'][0]) + { + list($response) = $this->usersIdAccountsPostWithHttpInfo($id, $users_id_accounts_post_request, $contentType); + return $response; + } + + /** + * Operation usersIdAccountsPostWithHttpInfo + * + * Create an account in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAccountsPostRequest $users_id_accounts_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Account|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdAccountsPostWithHttpInfo($id, $users_id_accounts_post_request = null, string $contentType = self::contentTypes['usersIdAccountsPost'][0]) + { + $request = $this->usersIdAccountsPostRequest($id, $users_id_accounts_post_request, $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 ('\OpenAPI\Client\Model\Account' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Account' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Account', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Account'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Account', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdAccountsPostAsync + * + * Create an account in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAccountsPostRequest $users_id_accounts_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdAccountsPostAsync($id, $users_id_accounts_post_request = null, string $contentType = self::contentTypes['usersIdAccountsPost'][0]) + { + return $this->usersIdAccountsPostAsyncWithHttpInfo($id, $users_id_accounts_post_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdAccountsPostAsyncWithHttpInfo + * + * Create an account in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAccountsPostRequest $users_id_accounts_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdAccountsPostAsyncWithHttpInfo($id, $users_id_accounts_post_request = null, string $contentType = self::contentTypes['usersIdAccountsPost'][0]) + { + $returnType = '\OpenAPI\Client\Model\Account'; + $request = $this->usersIdAccountsPostRequest($id, $users_id_accounts_post_request, $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 'usersIdAccountsPost' + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAccountsPostRequest $users_id_accounts_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdAccountsPostRequest($id, $users_id_accounts_post_request = null, string $contentType = self::contentTypes['usersIdAccountsPost'][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 usersIdAccountsPost' + ); + } + + + + $resourcePath = '/users/{id}/accounts'; + $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($users_id_accounts_post_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($users_id_accounts_post_request)); + } else { + $httpBody = $users_id_accounts_post_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdAccountsPut + * + * Update the display order of accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAccountsPutRequest $users_id_accounts_put_request users_id_accounts_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Account[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdAccountsPut($id, $users_id_accounts_put_request = null, string $contentType = self::contentTypes['usersIdAccountsPut'][0]) + { + list($response) = $this->usersIdAccountsPutWithHttpInfo($id, $users_id_accounts_put_request, $contentType); + return $response; + } + + /** + * Operation usersIdAccountsPutWithHttpInfo + * + * Update the display order of accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAccountsPutRequest $users_id_accounts_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Account[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdAccountsPutWithHttpInfo($id, $users_id_accounts_put_request = null, string $contentType = self::contentTypes['usersIdAccountsPut'][0]) + { + $request = $this->usersIdAccountsPutRequest($id, $users_id_accounts_put_request, $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 ('\OpenAPI\Client\Model\Account[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Account[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Account[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Account[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Account[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdAccountsPutAsync + * + * Update the display order of accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAccountsPutRequest $users_id_accounts_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdAccountsPutAsync($id, $users_id_accounts_put_request = null, string $contentType = self::contentTypes['usersIdAccountsPut'][0]) + { + return $this->usersIdAccountsPutAsyncWithHttpInfo($id, $users_id_accounts_put_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdAccountsPutAsyncWithHttpInfo + * + * Update the display order of accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAccountsPutRequest $users_id_accounts_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdAccountsPutAsyncWithHttpInfo($id, $users_id_accounts_put_request = null, string $contentType = self::contentTypes['usersIdAccountsPut'][0]) + { + $returnType = '\OpenAPI\Client\Model\Account[]'; + $request = $this->usersIdAccountsPutRequest($id, $users_id_accounts_put_request, $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 'usersIdAccountsPut' + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAccountsPutRequest $users_id_accounts_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAccountsPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdAccountsPutRequest($id, $users_id_accounts_put_request = null, string $contentType = self::contentTypes['usersIdAccountsPut'][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 usersIdAccountsPut' + ); + } + + + + $resourcePath = '/users/{id}/accounts'; + $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($users_id_accounts_put_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($users_id_accounts_put_request)); + } else { + $httpBody = $users_id_accounts_put_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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/lib/Api/AttachmentsApi.php b/lib/Api/AttachmentsApi.php new file mode 100644 index 0000000..e7be222 --- /dev/null +++ b/lib/Api/AttachmentsApi.php @@ -0,0 +1,2789 @@ + [ + 'application/json', + ], + 'attachmentsIdGet' => [ + 'application/json', + ], + 'attachmentsIdPut' => [ + 'application/json', + ], + 'transactionsIdAttachmentsGet' => [ + 'application/json', + ], + 'transactionsIdAttachmentsPost' => [ + 'application/json', + ], + 'transactionsTransactionIdAttachmentsAttachmentIdDelete' => [ + 'application/json', + ], + 'usersIdAttachmentsGet' => [ + 'application/json', + ], + 'usersIdAttachmentsPost' => [ + '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 attachmentsIdDelete + * + * Delete attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function attachmentsIdDelete($id, string $contentType = self::contentTypes['attachmentsIdDelete'][0]) + { + $this->attachmentsIdDeleteWithHttpInfo($id, $contentType); + } + + /** + * Operation attachmentsIdDeleteWithHttpInfo + * + * Delete attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function attachmentsIdDeleteWithHttpInfo($id, string $contentType = self::contentTypes['attachmentsIdDelete'][0]) + { + $request = $this->attachmentsIdDeleteRequest($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 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation attachmentsIdDeleteAsync + * + * Delete attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function attachmentsIdDeleteAsync($id, string $contentType = self::contentTypes['attachmentsIdDelete'][0]) + { + return $this->attachmentsIdDeleteAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation attachmentsIdDeleteAsyncWithHttpInfo + * + * Delete attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function attachmentsIdDeleteAsyncWithHttpInfo($id, string $contentType = self::contentTypes['attachmentsIdDelete'][0]) + { + $returnType = ''; + $request = $this->attachmentsIdDeleteRequest($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 'attachmentsIdDelete' + * + * @param int $id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function attachmentsIdDeleteRequest($id, string $contentType = self::contentTypes['attachmentsIdDelete'][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 attachmentsIdDelete' + ); + } + + + $resourcePath = '/attachments/{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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 attachmentsIdGet + * + * Get attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Attachment|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function attachmentsIdGet($id, string $contentType = self::contentTypes['attachmentsIdGet'][0]) + { + list($response) = $this->attachmentsIdGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation attachmentsIdGetWithHttpInfo + * + * Get attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Attachment|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function attachmentsIdGetWithHttpInfo($id, string $contentType = self::contentTypes['attachmentsIdGet'][0]) + { + $request = $this->attachmentsIdGetRequest($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 ('\OpenAPI\Client\Model\Attachment' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Attachment' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Attachment', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Attachment'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Attachment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation attachmentsIdGetAsync + * + * Get attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function attachmentsIdGetAsync($id, string $contentType = self::contentTypes['attachmentsIdGet'][0]) + { + return $this->attachmentsIdGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation attachmentsIdGetAsyncWithHttpInfo + * + * Get attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function attachmentsIdGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['attachmentsIdGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Attachment'; + $request = $this->attachmentsIdGetRequest($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 'attachmentsIdGet' + * + * @param int $id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function attachmentsIdGetRequest($id, string $contentType = self::contentTypes['attachmentsIdGet'][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 attachmentsIdGet' + ); + } + + + $resourcePath = '/attachments/{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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 attachmentsIdPut + * + * Update attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param \OpenAPI\Client\Model\AttachmentsIdPutRequest $attachments_id_put_request attachments_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Attachment|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function attachmentsIdPut($id, $attachments_id_put_request = null, string $contentType = self::contentTypes['attachmentsIdPut'][0]) + { + list($response) = $this->attachmentsIdPutWithHttpInfo($id, $attachments_id_put_request, $contentType); + return $response; + } + + /** + * Operation attachmentsIdPutWithHttpInfo + * + * Update attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param \OpenAPI\Client\Model\AttachmentsIdPutRequest $attachments_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Attachment|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function attachmentsIdPutWithHttpInfo($id, $attachments_id_put_request = null, string $contentType = self::contentTypes['attachmentsIdPut'][0]) + { + $request = $this->attachmentsIdPutRequest($id, $attachments_id_put_request, $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 ('\OpenAPI\Client\Model\Attachment' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Attachment' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Attachment', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Attachment'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Attachment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation attachmentsIdPutAsync + * + * Update attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param \OpenAPI\Client\Model\AttachmentsIdPutRequest $attachments_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function attachmentsIdPutAsync($id, $attachments_id_put_request = null, string $contentType = self::contentTypes['attachmentsIdPut'][0]) + { + return $this->attachmentsIdPutAsyncWithHttpInfo($id, $attachments_id_put_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation attachmentsIdPutAsyncWithHttpInfo + * + * Update attachment + * + * @param int $id The unique identifier of the attachment. (required) + * @param \OpenAPI\Client\Model\AttachmentsIdPutRequest $attachments_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function attachmentsIdPutAsyncWithHttpInfo($id, $attachments_id_put_request = null, string $contentType = self::contentTypes['attachmentsIdPut'][0]) + { + $returnType = '\OpenAPI\Client\Model\Attachment'; + $request = $this->attachmentsIdPutRequest($id, $attachments_id_put_request, $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 'attachmentsIdPut' + * + * @param int $id The unique identifier of the attachment. (required) + * @param \OpenAPI\Client\Model\AttachmentsIdPutRequest $attachments_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['attachmentsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function attachmentsIdPutRequest($id, $attachments_id_put_request = null, string $contentType = self::contentTypes['attachmentsIdPut'][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 attachmentsIdPut' + ); + } + + + + $resourcePath = '/attachments/{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($attachments_id_put_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($attachments_id_put_request)); + } else { + $httpBody = $attachments_id_put_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 transactionsIdAttachmentsGet + * + * List attachments in transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdAttachmentsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Attachment[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function transactionsIdAttachmentsGet($id, string $contentType = self::contentTypes['transactionsIdAttachmentsGet'][0]) + { + list($response) = $this->transactionsIdAttachmentsGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation transactionsIdAttachmentsGetWithHttpInfo + * + * List attachments in transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdAttachmentsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Attachment[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function transactionsIdAttachmentsGetWithHttpInfo($id, string $contentType = self::contentTypes['transactionsIdAttachmentsGet'][0]) + { + $request = $this->transactionsIdAttachmentsGetRequest($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 ('\OpenAPI\Client\Model\Attachment[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Attachment[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Attachment[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Attachment[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Attachment[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transactionsIdAttachmentsGetAsync + * + * List attachments in transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdAttachmentsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsIdAttachmentsGetAsync($id, string $contentType = self::contentTypes['transactionsIdAttachmentsGet'][0]) + { + return $this->transactionsIdAttachmentsGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transactionsIdAttachmentsGetAsyncWithHttpInfo + * + * List attachments in transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdAttachmentsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsIdAttachmentsGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['transactionsIdAttachmentsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Attachment[]'; + $request = $this->transactionsIdAttachmentsGetRequest($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 'transactionsIdAttachmentsGet' + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdAttachmentsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transactionsIdAttachmentsGetRequest($id, string $contentType = self::contentTypes['transactionsIdAttachmentsGet'][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 transactionsIdAttachmentsGet' + ); + } + + + $resourcePath = '/transactions/{id}/attachments'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 transactionsIdAttachmentsPost + * + * Assigns attachment to transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param \OpenAPI\Client\Model\TransactionsIdAttachmentsPostRequest $transactions_id_attachments_post_request transactions_id_attachments_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdAttachmentsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Attachment|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function transactionsIdAttachmentsPost($id, $transactions_id_attachments_post_request = null, string $contentType = self::contentTypes['transactionsIdAttachmentsPost'][0]) + { + list($response) = $this->transactionsIdAttachmentsPostWithHttpInfo($id, $transactions_id_attachments_post_request, $contentType); + return $response; + } + + /** + * Operation transactionsIdAttachmentsPostWithHttpInfo + * + * Assigns attachment to transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param \OpenAPI\Client\Model\TransactionsIdAttachmentsPostRequest $transactions_id_attachments_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdAttachmentsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Attachment|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function transactionsIdAttachmentsPostWithHttpInfo($id, $transactions_id_attachments_post_request = null, string $contentType = self::contentTypes['transactionsIdAttachmentsPost'][0]) + { + $request = $this->transactionsIdAttachmentsPostRequest($id, $transactions_id_attachments_post_request, $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 ('\OpenAPI\Client\Model\Attachment' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Attachment' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Attachment', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Attachment'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Attachment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transactionsIdAttachmentsPostAsync + * + * Assigns attachment to transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param \OpenAPI\Client\Model\TransactionsIdAttachmentsPostRequest $transactions_id_attachments_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdAttachmentsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsIdAttachmentsPostAsync($id, $transactions_id_attachments_post_request = null, string $contentType = self::contentTypes['transactionsIdAttachmentsPost'][0]) + { + return $this->transactionsIdAttachmentsPostAsyncWithHttpInfo($id, $transactions_id_attachments_post_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transactionsIdAttachmentsPostAsyncWithHttpInfo + * + * Assigns attachment to transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param \OpenAPI\Client\Model\TransactionsIdAttachmentsPostRequest $transactions_id_attachments_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdAttachmentsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsIdAttachmentsPostAsyncWithHttpInfo($id, $transactions_id_attachments_post_request = null, string $contentType = self::contentTypes['transactionsIdAttachmentsPost'][0]) + { + $returnType = '\OpenAPI\Client\Model\Attachment'; + $request = $this->transactionsIdAttachmentsPostRequest($id, $transactions_id_attachments_post_request, $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 'transactionsIdAttachmentsPost' + * + * @param int $id The unique identifier of the transaction. (required) + * @param \OpenAPI\Client\Model\TransactionsIdAttachmentsPostRequest $transactions_id_attachments_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdAttachmentsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transactionsIdAttachmentsPostRequest($id, $transactions_id_attachments_post_request = null, string $contentType = self::contentTypes['transactionsIdAttachmentsPost'][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 transactionsIdAttachmentsPost' + ); + } + + + + $resourcePath = '/transactions/{id}/attachments'; + $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($transactions_id_attachments_post_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($transactions_id_attachments_post_request)); + } else { + $httpBody = $transactions_id_attachments_post_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 transactionsTransactionIdAttachmentsAttachmentIdDelete + * + * Unassigns attachment in transaction + * + * @param int $transaction_id The unique identifier of the transaction. (required) + * @param int $attachment_id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsTransactionIdAttachmentsAttachmentIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function transactionsTransactionIdAttachmentsAttachmentIdDelete($transaction_id, $attachment_id, string $contentType = self::contentTypes['transactionsTransactionIdAttachmentsAttachmentIdDelete'][0]) + { + $this->transactionsTransactionIdAttachmentsAttachmentIdDeleteWithHttpInfo($transaction_id, $attachment_id, $contentType); + } + + /** + * Operation transactionsTransactionIdAttachmentsAttachmentIdDeleteWithHttpInfo + * + * Unassigns attachment in transaction + * + * @param int $transaction_id The unique identifier of the transaction. (required) + * @param int $attachment_id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsTransactionIdAttachmentsAttachmentIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function transactionsTransactionIdAttachmentsAttachmentIdDeleteWithHttpInfo($transaction_id, $attachment_id, string $contentType = self::contentTypes['transactionsTransactionIdAttachmentsAttachmentIdDelete'][0]) + { + $request = $this->transactionsTransactionIdAttachmentsAttachmentIdDeleteRequest($transaction_id, $attachment_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 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transactionsTransactionIdAttachmentsAttachmentIdDeleteAsync + * + * Unassigns attachment in transaction + * + * @param int $transaction_id The unique identifier of the transaction. (required) + * @param int $attachment_id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsTransactionIdAttachmentsAttachmentIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsTransactionIdAttachmentsAttachmentIdDeleteAsync($transaction_id, $attachment_id, string $contentType = self::contentTypes['transactionsTransactionIdAttachmentsAttachmentIdDelete'][0]) + { + return $this->transactionsTransactionIdAttachmentsAttachmentIdDeleteAsyncWithHttpInfo($transaction_id, $attachment_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transactionsTransactionIdAttachmentsAttachmentIdDeleteAsyncWithHttpInfo + * + * Unassigns attachment in transaction + * + * @param int $transaction_id The unique identifier of the transaction. (required) + * @param int $attachment_id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsTransactionIdAttachmentsAttachmentIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsTransactionIdAttachmentsAttachmentIdDeleteAsyncWithHttpInfo($transaction_id, $attachment_id, string $contentType = self::contentTypes['transactionsTransactionIdAttachmentsAttachmentIdDelete'][0]) + { + $returnType = ''; + $request = $this->transactionsTransactionIdAttachmentsAttachmentIdDeleteRequest($transaction_id, $attachment_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 'transactionsTransactionIdAttachmentsAttachmentIdDelete' + * + * @param int $transaction_id The unique identifier of the transaction. (required) + * @param int $attachment_id The unique identifier of the attachment. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsTransactionIdAttachmentsAttachmentIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transactionsTransactionIdAttachmentsAttachmentIdDeleteRequest($transaction_id, $attachment_id, string $contentType = self::contentTypes['transactionsTransactionIdAttachmentsAttachmentIdDelete'][0]) + { + + // verify the required parameter 'transaction_id' is set + if ($transaction_id === null || (is_array($transaction_id) && count($transaction_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $transaction_id when calling transactionsTransactionIdAttachmentsAttachmentIdDelete' + ); + } + + // verify the required parameter 'attachment_id' is set + if ($attachment_id === null || (is_array($attachment_id) && count($attachment_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $attachment_id when calling transactionsTransactionIdAttachmentsAttachmentIdDelete' + ); + } + + + $resourcePath = '/transactions/{transaction_id}/attachments/{attachment_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($transaction_id !== null) { + $resourcePath = str_replace( + '{' . 'transaction_id' . '}', + ObjectSerializer::toPathValue($transaction_id), + $resourcePath + ); + } + // path params + if ($attachment_id !== null) { + $resourcePath = str_replace( + '{' . 'attachment_id' . '}', + ObjectSerializer::toPathValue($attachment_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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdAttachmentsGet + * + * Lists attachments in user + * + * @param int $id The unique identifier of the user. (required) + * @param int $unassigned If set, returns unassigned attachments, that are available for assigning to a transaction. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAttachmentsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Attachment[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdAttachmentsGet($id, $unassigned = null, string $contentType = self::contentTypes['usersIdAttachmentsGet'][0]) + { + list($response) = $this->usersIdAttachmentsGetWithHttpInfo($id, $unassigned, $contentType); + return $response; + } + + /** + * Operation usersIdAttachmentsGetWithHttpInfo + * + * Lists attachments in user + * + * @param int $id The unique identifier of the user. (required) + * @param int $unassigned If set, returns unassigned attachments, that are available for assigning to a transaction. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAttachmentsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Attachment[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdAttachmentsGetWithHttpInfo($id, $unassigned = null, string $contentType = self::contentTypes['usersIdAttachmentsGet'][0]) + { + $request = $this->usersIdAttachmentsGetRequest($id, $unassigned, $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 ('\OpenAPI\Client\Model\Attachment[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Attachment[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Attachment[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Attachment[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Attachment[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdAttachmentsGetAsync + * + * Lists attachments in user + * + * @param int $id The unique identifier of the user. (required) + * @param int $unassigned If set, returns unassigned attachments, that are available for assigning to a transaction. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAttachmentsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdAttachmentsGetAsync($id, $unassigned = null, string $contentType = self::contentTypes['usersIdAttachmentsGet'][0]) + { + return $this->usersIdAttachmentsGetAsyncWithHttpInfo($id, $unassigned, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdAttachmentsGetAsyncWithHttpInfo + * + * Lists attachments in user + * + * @param int $id The unique identifier of the user. (required) + * @param int $unassigned If set, returns unassigned attachments, that are available for assigning to a transaction. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAttachmentsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdAttachmentsGetAsyncWithHttpInfo($id, $unassigned = null, string $contentType = self::contentTypes['usersIdAttachmentsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Attachment[]'; + $request = $this->usersIdAttachmentsGetRequest($id, $unassigned, $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 'usersIdAttachmentsGet' + * + * @param int $id The unique identifier of the user. (required) + * @param int $unassigned If set, returns unassigned attachments, that are available for assigning to a transaction. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAttachmentsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdAttachmentsGetRequest($id, $unassigned = null, string $contentType = self::contentTypes['usersIdAttachmentsGet'][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 usersIdAttachmentsGet' + ); + } + + + + $resourcePath = '/users/{id}/attachments'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $unassigned, + 'unassigned', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdAttachmentsPost + * + * Create attachment in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAttachmentsPostRequest $users_id_attachments_post_request users_id_attachments_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAttachmentsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Attachment|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdAttachmentsPost($id, $users_id_attachments_post_request = null, string $contentType = self::contentTypes['usersIdAttachmentsPost'][0]) + { + list($response) = $this->usersIdAttachmentsPostWithHttpInfo($id, $users_id_attachments_post_request, $contentType); + return $response; + } + + /** + * Operation usersIdAttachmentsPostWithHttpInfo + * + * Create attachment in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAttachmentsPostRequest $users_id_attachments_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAttachmentsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Attachment|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdAttachmentsPostWithHttpInfo($id, $users_id_attachments_post_request = null, string $contentType = self::contentTypes['usersIdAttachmentsPost'][0]) + { + $request = $this->usersIdAttachmentsPostRequest($id, $users_id_attachments_post_request, $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 ('\OpenAPI\Client\Model\Attachment' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Attachment' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Attachment', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Attachment'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Attachment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdAttachmentsPostAsync + * + * Create attachment in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAttachmentsPostRequest $users_id_attachments_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAttachmentsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdAttachmentsPostAsync($id, $users_id_attachments_post_request = null, string $contentType = self::contentTypes['usersIdAttachmentsPost'][0]) + { + return $this->usersIdAttachmentsPostAsyncWithHttpInfo($id, $users_id_attachments_post_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdAttachmentsPostAsyncWithHttpInfo + * + * Create attachment in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAttachmentsPostRequest $users_id_attachments_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAttachmentsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdAttachmentsPostAsyncWithHttpInfo($id, $users_id_attachments_post_request = null, string $contentType = self::contentTypes['usersIdAttachmentsPost'][0]) + { + $returnType = '\OpenAPI\Client\Model\Attachment'; + $request = $this->usersIdAttachmentsPostRequest($id, $users_id_attachments_post_request, $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 'usersIdAttachmentsPost' + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdAttachmentsPostRequest $users_id_attachments_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdAttachmentsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdAttachmentsPostRequest($id, $users_id_attachments_post_request = null, string $contentType = self::contentTypes['usersIdAttachmentsPost'][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 usersIdAttachmentsPost' + ); + } + + + + $resourcePath = '/users/{id}/attachments'; + $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($users_id_attachments_post_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($users_id_attachments_post_request)); + } else { + $httpBody = $users_id_attachments_post_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/BudgetingApi.php b/lib/Api/BudgetingApi.php new file mode 100644 index 0000000..95513ca --- /dev/null +++ b/lib/Api/BudgetingApi.php @@ -0,0 +1,1653 @@ + [ + 'application/json', + ], + 'usersIdBudgetSummaryGet' => [ + 'application/json', + ], + 'usersIdForecastCacheDelete' => [ + 'application/json', + ], + 'usersIdTrendAnalysisGet' => [ + '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 usersIdBudgetGet + * + * List budget for user + * + * @param int $id The unique identifier of the account. (required) + * @param bool $roll_up Whether parent categories should have their children rolled up into them. When used, the children will still appear in the collection on their own, but their actual and forecast figures will be rolled up to the root parent. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdBudgetGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\BudgetAnalysisPackage[] + */ + public function usersIdBudgetGet($id, $roll_up = null, string $contentType = self::contentTypes['usersIdBudgetGet'][0]) + { + list($response) = $this->usersIdBudgetGetWithHttpInfo($id, $roll_up, $contentType); + return $response; + } + + /** + * Operation usersIdBudgetGetWithHttpInfo + * + * List budget for user + * + * @param int $id The unique identifier of the account. (required) + * @param bool $roll_up Whether parent categories should have their children rolled up into them. When used, the children will still appear in the collection on their own, but their actual and forecast figures will be rolled up to the root parent. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdBudgetGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\BudgetAnalysisPackage[], HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdBudgetGetWithHttpInfo($id, $roll_up = null, string $contentType = self::contentTypes['usersIdBudgetGet'][0]) + { + $request = $this->usersIdBudgetGetRequest($id, $roll_up, $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 ('\OpenAPI\Client\Model\BudgetAnalysisPackage[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BudgetAnalysisPackage[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BudgetAnalysisPackage[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BudgetAnalysisPackage[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\BudgetAnalysisPackage[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdBudgetGetAsync + * + * List budget for user + * + * @param int $id The unique identifier of the account. (required) + * @param bool $roll_up Whether parent categories should have their children rolled up into them. When used, the children will still appear in the collection on their own, but their actual and forecast figures will be rolled up to the root parent. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdBudgetGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdBudgetGetAsync($id, $roll_up = null, string $contentType = self::contentTypes['usersIdBudgetGet'][0]) + { + return $this->usersIdBudgetGetAsyncWithHttpInfo($id, $roll_up, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdBudgetGetAsyncWithHttpInfo + * + * List budget for user + * + * @param int $id The unique identifier of the account. (required) + * @param bool $roll_up Whether parent categories should have their children rolled up into them. When used, the children will still appear in the collection on their own, but their actual and forecast figures will be rolled up to the root parent. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdBudgetGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdBudgetGetAsyncWithHttpInfo($id, $roll_up = null, string $contentType = self::contentTypes['usersIdBudgetGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\BudgetAnalysisPackage[]'; + $request = $this->usersIdBudgetGetRequest($id, $roll_up, $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 'usersIdBudgetGet' + * + * @param int $id The unique identifier of the account. (required) + * @param bool $roll_up Whether parent categories should have their children rolled up into them. When used, the children will still appear in the collection on their own, but their actual and forecast figures will be rolled up to the root parent. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdBudgetGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdBudgetGetRequest($id, $roll_up = null, string $contentType = self::contentTypes['usersIdBudgetGet'][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 usersIdBudgetGet' + ); + } + + + + $resourcePath = '/users/{id}/budget'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $roll_up, + 'roll_up', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdBudgetSummaryGet + * + * Get budget summary for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $period The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. (required) + * @param int $interval The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. (required) + * @param string $start_date The date to start analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $end_date The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdBudgetSummaryGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\BudgetAnalysisPackage[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdBudgetSummaryGet($id, $period, $interval, $start_date, $end_date, string $contentType = self::contentTypes['usersIdBudgetSummaryGet'][0]) + { + list($response) = $this->usersIdBudgetSummaryGetWithHttpInfo($id, $period, $interval, $start_date, $end_date, $contentType); + return $response; + } + + /** + * Operation usersIdBudgetSummaryGetWithHttpInfo + * + * Get budget summary for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $period The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. (required) + * @param int $interval The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. (required) + * @param string $start_date The date to start analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $end_date The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdBudgetSummaryGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\BudgetAnalysisPackage[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdBudgetSummaryGetWithHttpInfo($id, $period, $interval, $start_date, $end_date, string $contentType = self::contentTypes['usersIdBudgetSummaryGet'][0]) + { + $request = $this->usersIdBudgetSummaryGetRequest($id, $period, $interval, $start_date, $end_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 ('\OpenAPI\Client\Model\BudgetAnalysisPackage[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BudgetAnalysisPackage[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BudgetAnalysisPackage[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BudgetAnalysisPackage[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\BudgetAnalysisPackage[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdBudgetSummaryGetAsync + * + * Get budget summary for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $period The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. (required) + * @param int $interval The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. (required) + * @param string $start_date The date to start analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $end_date The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdBudgetSummaryGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdBudgetSummaryGetAsync($id, $period, $interval, $start_date, $end_date, string $contentType = self::contentTypes['usersIdBudgetSummaryGet'][0]) + { + return $this->usersIdBudgetSummaryGetAsyncWithHttpInfo($id, $period, $interval, $start_date, $end_date, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdBudgetSummaryGetAsyncWithHttpInfo + * + * Get budget summary for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $period The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. (required) + * @param int $interval The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. (required) + * @param string $start_date The date to start analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $end_date The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdBudgetSummaryGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdBudgetSummaryGetAsyncWithHttpInfo($id, $period, $interval, $start_date, $end_date, string $contentType = self::contentTypes['usersIdBudgetSummaryGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\BudgetAnalysisPackage[]'; + $request = $this->usersIdBudgetSummaryGetRequest($id, $period, $interval, $start_date, $end_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 'usersIdBudgetSummaryGet' + * + * @param int $id The unique identifier of the user. (required) + * @param string $period The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. (required) + * @param int $interval The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. (required) + * @param string $start_date The date to start analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $end_date The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdBudgetSummaryGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdBudgetSummaryGetRequest($id, $period, $interval, $start_date, $end_date, string $contentType = self::contentTypes['usersIdBudgetSummaryGet'][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 usersIdBudgetSummaryGet' + ); + } + + // verify the required parameter 'period' is set + if ($period === null || (is_array($period) && count($period) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $period when calling usersIdBudgetSummaryGet' + ); + } + + // verify the required parameter 'interval' is set + if ($interval === null || (is_array($interval) && count($interval) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $interval when calling usersIdBudgetSummaryGet' + ); + } + + // verify the required parameter 'start_date' is set + if ($start_date === null || (is_array($start_date) && count($start_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $start_date when calling usersIdBudgetSummaryGet' + ); + } + + // verify the required parameter 'end_date' is set + if ($end_date === null || (is_array($end_date) && count($end_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $end_date when calling usersIdBudgetSummaryGet' + ); + } + + + $resourcePath = '/users/{id}/budget_summary'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $period, + 'period', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $interval, + 'interval', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'end_date', // param base name + 'string', // 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/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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdForecastCacheDelete + * + * Delete forecast cache for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdForecastCacheDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function usersIdForecastCacheDelete($id, string $contentType = self::contentTypes['usersIdForecastCacheDelete'][0]) + { + $this->usersIdForecastCacheDeleteWithHttpInfo($id, $contentType); + } + + /** + * Operation usersIdForecastCacheDeleteWithHttpInfo + * + * Delete forecast cache for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdForecastCacheDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdForecastCacheDeleteWithHttpInfo($id, string $contentType = self::contentTypes['usersIdForecastCacheDelete'][0]) + { + $request = $this->usersIdForecastCacheDeleteRequest($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 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdForecastCacheDeleteAsync + * + * Delete forecast cache for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdForecastCacheDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdForecastCacheDeleteAsync($id, string $contentType = self::contentTypes['usersIdForecastCacheDelete'][0]) + { + return $this->usersIdForecastCacheDeleteAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdForecastCacheDeleteAsyncWithHttpInfo + * + * Delete forecast cache for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdForecastCacheDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdForecastCacheDeleteAsyncWithHttpInfo($id, string $contentType = self::contentTypes['usersIdForecastCacheDelete'][0]) + { + $returnType = ''; + $request = $this->usersIdForecastCacheDeleteRequest($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 'usersIdForecastCacheDelete' + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdForecastCacheDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdForecastCacheDeleteRequest($id, string $contentType = self::contentTypes['usersIdForecastCacheDelete'][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 usersIdForecastCacheDelete' + ); + } + + + $resourcePath = '/users/{id}/forecast_cache'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdTrendAnalysisGet + * + * Get trend analysis for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $period The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. (required) + * @param int $interval The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. (required) + * @param string $start_date The date to start analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $end_date The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $categories A comma-separated list of category IDs to analyse. (required) + * @param string $scenarios A comma-separated list of scenario IDs to analyse. You're likely going to want to include all a user's scenarios here, unless you have reason to only analyse for a subset of scenarios. Regardless of what scenarios are analysed, all actuals (transactions) across all accounts will be included. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTrendAnalysisGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\BudgetAnalysisPackage[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdTrendAnalysisGet($id, $period, $interval, $start_date, $end_date, $categories, $scenarios, string $contentType = self::contentTypes['usersIdTrendAnalysisGet'][0]) + { + list($response) = $this->usersIdTrendAnalysisGetWithHttpInfo($id, $period, $interval, $start_date, $end_date, $categories, $scenarios, $contentType); + return $response; + } + + /** + * Operation usersIdTrendAnalysisGetWithHttpInfo + * + * Get trend analysis for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $period The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. (required) + * @param int $interval The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. (required) + * @param string $start_date The date to start analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $end_date The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $categories A comma-separated list of category IDs to analyse. (required) + * @param string $scenarios A comma-separated list of scenario IDs to analyse. You're likely going to want to include all a user's scenarios here, unless you have reason to only analyse for a subset of scenarios. Regardless of what scenarios are analysed, all actuals (transactions) across all accounts will be included. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTrendAnalysisGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\BudgetAnalysisPackage[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdTrendAnalysisGetWithHttpInfo($id, $period, $interval, $start_date, $end_date, $categories, $scenarios, string $contentType = self::contentTypes['usersIdTrendAnalysisGet'][0]) + { + $request = $this->usersIdTrendAnalysisGetRequest($id, $period, $interval, $start_date, $end_date, $categories, $scenarios, $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 ('\OpenAPI\Client\Model\BudgetAnalysisPackage[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\BudgetAnalysisPackage[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\BudgetAnalysisPackage[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\BudgetAnalysisPackage[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\BudgetAnalysisPackage[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdTrendAnalysisGetAsync + * + * Get trend analysis for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $period The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. (required) + * @param int $interval The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. (required) + * @param string $start_date The date to start analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $end_date The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $categories A comma-separated list of category IDs to analyse. (required) + * @param string $scenarios A comma-separated list of scenario IDs to analyse. You're likely going to want to include all a user's scenarios here, unless you have reason to only analyse for a subset of scenarios. Regardless of what scenarios are analysed, all actuals (transactions) across all accounts will be included. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTrendAnalysisGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdTrendAnalysisGetAsync($id, $period, $interval, $start_date, $end_date, $categories, $scenarios, string $contentType = self::contentTypes['usersIdTrendAnalysisGet'][0]) + { + return $this->usersIdTrendAnalysisGetAsyncWithHttpInfo($id, $period, $interval, $start_date, $end_date, $categories, $scenarios, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdTrendAnalysisGetAsyncWithHttpInfo + * + * Get trend analysis for user + * + * @param int $id The unique identifier of the user. (required) + * @param string $period The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. (required) + * @param int $interval The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. (required) + * @param string $start_date The date to start analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $end_date The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $categories A comma-separated list of category IDs to analyse. (required) + * @param string $scenarios A comma-separated list of scenario IDs to analyse. You're likely going to want to include all a user's scenarios here, unless you have reason to only analyse for a subset of scenarios. Regardless of what scenarios are analysed, all actuals (transactions) across all accounts will be included. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTrendAnalysisGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdTrendAnalysisGetAsyncWithHttpInfo($id, $period, $interval, $start_date, $end_date, $categories, $scenarios, string $contentType = self::contentTypes['usersIdTrendAnalysisGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\BudgetAnalysisPackage[]'; + $request = $this->usersIdTrendAnalysisGetRequest($id, $period, $interval, $start_date, $end_date, $categories, $scenarios, $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 'usersIdTrendAnalysisGet' + * + * @param int $id The unique identifier of the user. (required) + * @param string $period The period to analyse in, one of `weeks`, `months` or `years`. Also supported is `event`, although event period analysis is only possible when the budget events gathered align, so in this case where all categories are analysed together, it's highly unlikely that event period analysis will be possible. (required) + * @param int $interval The period interval, e.g. if the interval is 2 and the period is weeks, the budget will be analysed fortnightly. (required) + * @param string $start_date The date to start analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $end_date The date to stop analysing the budget from. This will be bumped out to make full periods as necessary. (required) + * @param string $categories A comma-separated list of category IDs to analyse. (required) + * @param string $scenarios A comma-separated list of scenario IDs to analyse. You're likely going to want to include all a user's scenarios here, unless you have reason to only analyse for a subset of scenarios. Regardless of what scenarios are analysed, all actuals (transactions) across all accounts will be included. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTrendAnalysisGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdTrendAnalysisGetRequest($id, $period, $interval, $start_date, $end_date, $categories, $scenarios, string $contentType = self::contentTypes['usersIdTrendAnalysisGet'][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 usersIdTrendAnalysisGet' + ); + } + + // verify the required parameter 'period' is set + if ($period === null || (is_array($period) && count($period) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $period when calling usersIdTrendAnalysisGet' + ); + } + + // verify the required parameter 'interval' is set + if ($interval === null || (is_array($interval) && count($interval) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $interval when calling usersIdTrendAnalysisGet' + ); + } + + // verify the required parameter 'start_date' is set + if ($start_date === null || (is_array($start_date) && count($start_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $start_date when calling usersIdTrendAnalysisGet' + ); + } + + // verify the required parameter 'end_date' is set + if ($end_date === null || (is_array($end_date) && count($end_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $end_date when calling usersIdTrendAnalysisGet' + ); + } + + // verify the required parameter 'categories' is set + if ($categories === null || (is_array($categories) && count($categories) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $categories when calling usersIdTrendAnalysisGet' + ); + } + + // verify the required parameter 'scenarios' is set + if ($scenarios === null || (is_array($scenarios) && count($scenarios) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $scenarios when calling usersIdTrendAnalysisGet' + ); + } + + + $resourcePath = '/users/{id}/trend_analysis'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $period, + 'period', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $interval, + 'interval', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $categories, + 'categories', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $scenarios, + 'scenarios', // param base name + 'string', // 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/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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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/lib/Api/CategoriesApi.php b/lib/Api/CategoriesApi.php new file mode 100644 index 0000000..33e16e7 --- /dev/null +++ b/lib/Api/CategoriesApi.php @@ -0,0 +1,1814 @@ + [ + 'application/json', + ], + 'categoriesIdGet' => [ + 'application/json', + ], + 'categoriesIdPut' => [ + 'application/json', + ], + 'usersIdCategoriesGet' => [ + 'application/json', + ], + 'usersIdCategoriesPost' => [ + '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 categoriesIdDelete + * + * Delete category + * + * @param int $id The unique identifier of the category. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function categoriesIdDelete($id, string $contentType = self::contentTypes['categoriesIdDelete'][0]) + { + $this->categoriesIdDeleteWithHttpInfo($id, $contentType); + } + + /** + * Operation categoriesIdDeleteWithHttpInfo + * + * Delete category + * + * @param int $id The unique identifier of the category. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function categoriesIdDeleteWithHttpInfo($id, string $contentType = self::contentTypes['categoriesIdDelete'][0]) + { + $request = $this->categoriesIdDeleteRequest($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 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation categoriesIdDeleteAsync + * + * Delete category + * + * @param int $id The unique identifier of the category. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function categoriesIdDeleteAsync($id, string $contentType = self::contentTypes['categoriesIdDelete'][0]) + { + return $this->categoriesIdDeleteAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation categoriesIdDeleteAsyncWithHttpInfo + * + * Delete category + * + * @param int $id The unique identifier of the category. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function categoriesIdDeleteAsyncWithHttpInfo($id, string $contentType = self::contentTypes['categoriesIdDelete'][0]) + { + $returnType = ''; + $request = $this->categoriesIdDeleteRequest($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 'categoriesIdDelete' + * + * @param int $id The unique identifier of the category. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function categoriesIdDeleteRequest($id, string $contentType = self::contentTypes['categoriesIdDelete'][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 categoriesIdDelete' + ); + } + + + $resourcePath = '/categories/{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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 categoriesIdGet + * + * Get category + * + * @param int $id The unique identifier of the category. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Category|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function categoriesIdGet($id, string $contentType = self::contentTypes['categoriesIdGet'][0]) + { + list($response) = $this->categoriesIdGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation categoriesIdGetWithHttpInfo + * + * Get category + * + * @param int $id The unique identifier of the category. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Category|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function categoriesIdGetWithHttpInfo($id, string $contentType = self::contentTypes['categoriesIdGet'][0]) + { + $request = $this->categoriesIdGetRequest($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 ('\OpenAPI\Client\Model\Category' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Category' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Category', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Category'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Category', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation categoriesIdGetAsync + * + * Get category + * + * @param int $id The unique identifier of the category. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function categoriesIdGetAsync($id, string $contentType = self::contentTypes['categoriesIdGet'][0]) + { + return $this->categoriesIdGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation categoriesIdGetAsyncWithHttpInfo + * + * Get category + * + * @param int $id The unique identifier of the category. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function categoriesIdGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['categoriesIdGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Category'; + $request = $this->categoriesIdGetRequest($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 'categoriesIdGet' + * + * @param int $id The unique identifier of the category. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function categoriesIdGetRequest($id, string $contentType = self::contentTypes['categoriesIdGet'][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 categoriesIdGet' + ); + } + + + $resourcePath = '/categories/{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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 categoriesIdPut + * + * Update category + * + * @param int $id The unique identifier of the category. (required) + * @param \OpenAPI\Client\Model\CategoriesIdPutRequest $categories_id_put_request categories_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Category|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function categoriesIdPut($id, $categories_id_put_request = null, string $contentType = self::contentTypes['categoriesIdPut'][0]) + { + list($response) = $this->categoriesIdPutWithHttpInfo($id, $categories_id_put_request, $contentType); + return $response; + } + + /** + * Operation categoriesIdPutWithHttpInfo + * + * Update category + * + * @param int $id The unique identifier of the category. (required) + * @param \OpenAPI\Client\Model\CategoriesIdPutRequest $categories_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Category|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function categoriesIdPutWithHttpInfo($id, $categories_id_put_request = null, string $contentType = self::contentTypes['categoriesIdPut'][0]) + { + $request = $this->categoriesIdPutRequest($id, $categories_id_put_request, $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 ('\OpenAPI\Client\Model\Category' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Category' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Category', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Category'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Category', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation categoriesIdPutAsync + * + * Update category + * + * @param int $id The unique identifier of the category. (required) + * @param \OpenAPI\Client\Model\CategoriesIdPutRequest $categories_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function categoriesIdPutAsync($id, $categories_id_put_request = null, string $contentType = self::contentTypes['categoriesIdPut'][0]) + { + return $this->categoriesIdPutAsyncWithHttpInfo($id, $categories_id_put_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation categoriesIdPutAsyncWithHttpInfo + * + * Update category + * + * @param int $id The unique identifier of the category. (required) + * @param \OpenAPI\Client\Model\CategoriesIdPutRequest $categories_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function categoriesIdPutAsyncWithHttpInfo($id, $categories_id_put_request = null, string $contentType = self::contentTypes['categoriesIdPut'][0]) + { + $returnType = '\OpenAPI\Client\Model\Category'; + $request = $this->categoriesIdPutRequest($id, $categories_id_put_request, $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 'categoriesIdPut' + * + * @param int $id The unique identifier of the category. (required) + * @param \OpenAPI\Client\Model\CategoriesIdPutRequest $categories_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function categoriesIdPutRequest($id, $categories_id_put_request = null, string $contentType = self::contentTypes['categoriesIdPut'][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 categoriesIdPut' + ); + } + + + + $resourcePath = '/categories/{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($categories_id_put_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($categories_id_put_request)); + } else { + $httpBody = $categories_id_put_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdCategoriesGet + * + * List categories in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoriesGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Category[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdCategoriesGet($id, string $contentType = self::contentTypes['usersIdCategoriesGet'][0]) + { + list($response) = $this->usersIdCategoriesGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation usersIdCategoriesGetWithHttpInfo + * + * List categories in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoriesGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Category[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdCategoriesGetWithHttpInfo($id, string $contentType = self::contentTypes['usersIdCategoriesGet'][0]) + { + $request = $this->usersIdCategoriesGetRequest($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 ('\OpenAPI\Client\Model\Category[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Category[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Category[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Category[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Category[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdCategoriesGetAsync + * + * List categories in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoriesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdCategoriesGetAsync($id, string $contentType = self::contentTypes['usersIdCategoriesGet'][0]) + { + return $this->usersIdCategoriesGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdCategoriesGetAsyncWithHttpInfo + * + * List categories in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoriesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdCategoriesGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['usersIdCategoriesGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Category[]'; + $request = $this->usersIdCategoriesGetRequest($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 'usersIdCategoriesGet' + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoriesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdCategoriesGetRequest($id, string $contentType = self::contentTypes['usersIdCategoriesGet'][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 usersIdCategoriesGet' + ); + } + + + $resourcePath = '/users/{id}/categories'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdCategoriesPost + * + * Create category in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdCategoriesPostRequest $users_id_categories_post_request users_id_categories_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoriesPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Category|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdCategoriesPost($id, $users_id_categories_post_request = null, string $contentType = self::contentTypes['usersIdCategoriesPost'][0]) + { + list($response) = $this->usersIdCategoriesPostWithHttpInfo($id, $users_id_categories_post_request, $contentType); + return $response; + } + + /** + * Operation usersIdCategoriesPostWithHttpInfo + * + * Create category in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdCategoriesPostRequest $users_id_categories_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoriesPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Category|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdCategoriesPostWithHttpInfo($id, $users_id_categories_post_request = null, string $contentType = self::contentTypes['usersIdCategoriesPost'][0]) + { + $request = $this->usersIdCategoriesPostRequest($id, $users_id_categories_post_request, $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 ('\OpenAPI\Client\Model\Category' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Category' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Category', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Category'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Category', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdCategoriesPostAsync + * + * Create category in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdCategoriesPostRequest $users_id_categories_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoriesPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdCategoriesPostAsync($id, $users_id_categories_post_request = null, string $contentType = self::contentTypes['usersIdCategoriesPost'][0]) + { + return $this->usersIdCategoriesPostAsyncWithHttpInfo($id, $users_id_categories_post_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdCategoriesPostAsyncWithHttpInfo + * + * Create category in user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdCategoriesPostRequest $users_id_categories_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoriesPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdCategoriesPostAsyncWithHttpInfo($id, $users_id_categories_post_request = null, string $contentType = self::contentTypes['usersIdCategoriesPost'][0]) + { + $returnType = '\OpenAPI\Client\Model\Category'; + $request = $this->usersIdCategoriesPostRequest($id, $users_id_categories_post_request, $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 'usersIdCategoriesPost' + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdCategoriesPostRequest $users_id_categories_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoriesPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdCategoriesPostRequest($id, $users_id_categories_post_request = null, string $contentType = self::contentTypes['usersIdCategoriesPost'][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 usersIdCategoriesPost' + ); + } + + + + $resourcePath = '/users/{id}/categories'; + $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($users_id_categories_post_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($users_id_categories_post_request)); + } else { + $httpBody = $users_id_categories_post_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/CategoryRulesApi.php b/lib/Api/CategoryRulesApi.php new file mode 100644 index 0000000..119a16b --- /dev/null +++ b/lib/Api/CategoryRulesApi.php @@ -0,0 +1,851 @@ + [ + 'application/json', + ], + 'usersIdCategoryRulesGet' => [ + '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 categoriesIdCategoryRulesPost + * + * Create category rule in category + * + * @param int $id The unique identifier of the category. (required) + * @param \OpenAPI\Client\Model\CategoriesIdCategoryRulesPostRequest $categories_id_category_rules_post_request categories_id_category_rules_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdCategoryRulesPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CategoryRule|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function categoriesIdCategoryRulesPost($id, $categories_id_category_rules_post_request = null, string $contentType = self::contentTypes['categoriesIdCategoryRulesPost'][0]) + { + list($response) = $this->categoriesIdCategoryRulesPostWithHttpInfo($id, $categories_id_category_rules_post_request, $contentType); + return $response; + } + + /** + * Operation categoriesIdCategoryRulesPostWithHttpInfo + * + * Create category rule in category + * + * @param int $id The unique identifier of the category. (required) + * @param \OpenAPI\Client\Model\CategoriesIdCategoryRulesPostRequest $categories_id_category_rules_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdCategoryRulesPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CategoryRule|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function categoriesIdCategoryRulesPostWithHttpInfo($id, $categories_id_category_rules_post_request = null, string $contentType = self::contentTypes['categoriesIdCategoryRulesPost'][0]) + { + $request = $this->categoriesIdCategoryRulesPostRequest($id, $categories_id_category_rules_post_request, $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 ('\OpenAPI\Client\Model\CategoryRule' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CategoryRule' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CategoryRule', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CategoryRule'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\CategoryRule', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation categoriesIdCategoryRulesPostAsync + * + * Create category rule in category + * + * @param int $id The unique identifier of the category. (required) + * @param \OpenAPI\Client\Model\CategoriesIdCategoryRulesPostRequest $categories_id_category_rules_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdCategoryRulesPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function categoriesIdCategoryRulesPostAsync($id, $categories_id_category_rules_post_request = null, string $contentType = self::contentTypes['categoriesIdCategoryRulesPost'][0]) + { + return $this->categoriesIdCategoryRulesPostAsyncWithHttpInfo($id, $categories_id_category_rules_post_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation categoriesIdCategoryRulesPostAsyncWithHttpInfo + * + * Create category rule in category + * + * @param int $id The unique identifier of the category. (required) + * @param \OpenAPI\Client\Model\CategoriesIdCategoryRulesPostRequest $categories_id_category_rules_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdCategoryRulesPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function categoriesIdCategoryRulesPostAsyncWithHttpInfo($id, $categories_id_category_rules_post_request = null, string $contentType = self::contentTypes['categoriesIdCategoryRulesPost'][0]) + { + $returnType = '\OpenAPI\Client\Model\CategoryRule'; + $request = $this->categoriesIdCategoryRulesPostRequest($id, $categories_id_category_rules_post_request, $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 'categoriesIdCategoryRulesPost' + * + * @param int $id The unique identifier of the category. (required) + * @param \OpenAPI\Client\Model\CategoriesIdCategoryRulesPostRequest $categories_id_category_rules_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdCategoryRulesPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function categoriesIdCategoryRulesPostRequest($id, $categories_id_category_rules_post_request = null, string $contentType = self::contentTypes['categoriesIdCategoryRulesPost'][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 categoriesIdCategoryRulesPost' + ); + } + + + + $resourcePath = '/categories/{id}/category_rules'; + $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($categories_id_category_rules_post_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($categories_id_category_rules_post_request)); + } else { + $httpBody = $categories_id_category_rules_post_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdCategoryRulesGet + * + * List category rules in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoryRulesGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\CategoryRule[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdCategoryRulesGet($id, string $contentType = self::contentTypes['usersIdCategoryRulesGet'][0]) + { + list($response) = $this->usersIdCategoryRulesGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation usersIdCategoryRulesGetWithHttpInfo + * + * List category rules in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoryRulesGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\CategoryRule[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdCategoryRulesGetWithHttpInfo($id, string $contentType = self::contentTypes['usersIdCategoryRulesGet'][0]) + { + $request = $this->usersIdCategoryRulesGetRequest($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 ('\OpenAPI\Client\Model\CategoryRule[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\CategoryRule[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CategoryRule[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\CategoryRule[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\CategoryRule[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdCategoryRulesGetAsync + * + * List category rules in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoryRulesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdCategoryRulesGetAsync($id, string $contentType = self::contentTypes['usersIdCategoryRulesGet'][0]) + { + return $this->usersIdCategoryRulesGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdCategoryRulesGetAsyncWithHttpInfo + * + * List category rules in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoryRulesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdCategoryRulesGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['usersIdCategoryRulesGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\CategoryRule[]'; + $request = $this->usersIdCategoryRulesGetRequest($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 'usersIdCategoryRulesGet' + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdCategoryRulesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdCategoryRulesGetRequest($id, string $contentType = self::contentTypes['usersIdCategoryRulesGet'][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 usersIdCategoryRulesGet' + ); + } + + + $resourcePath = '/users/{id}/category_rules'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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/lib/Api/CurrenciesApi.php b/lib/Api/CurrenciesApi.php new file mode 100644 index 0000000..095b7c9 --- /dev/null +++ b/lib/Api/CurrenciesApi.php @@ -0,0 +1,726 @@ + [ + 'application/json', + ], + 'currenciesIdGet' => [ + '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 currenciesGet + * + * List currencies + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['currenciesGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Currency[] + */ + public function currenciesGet(string $contentType = self::contentTypes['currenciesGet'][0]) + { + list($response) = $this->currenciesGetWithHttpInfo($contentType); + return $response; + } + + /** + * Operation currenciesGetWithHttpInfo + * + * List currencies + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['currenciesGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Currency[], HTTP status code, HTTP response headers (array of strings) + */ + public function currenciesGetWithHttpInfo(string $contentType = self::contentTypes['currenciesGet'][0]) + { + $request = $this->currenciesGetRequest($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 ('\OpenAPI\Client\Model\Currency[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Currency[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Currency[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Currency[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Currency[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation currenciesGetAsync + * + * List currencies + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['currenciesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function currenciesGetAsync(string $contentType = self::contentTypes['currenciesGet'][0]) + { + return $this->currenciesGetAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation currenciesGetAsyncWithHttpInfo + * + * List currencies + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['currenciesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function currenciesGetAsyncWithHttpInfo(string $contentType = self::contentTypes['currenciesGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Currency[]'; + $request = $this->currenciesGetRequest($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 'currenciesGet' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['currenciesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function currenciesGetRequest(string $contentType = self::contentTypes['currenciesGet'][0]) + { + + + $resourcePath = '/currencies'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 currenciesIdGet + * + * Get currency + * + * @param string $id The unique identifier of the currency. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['currenciesIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Currency|\OpenAPI\Client\Model\Error + */ + public function currenciesIdGet($id, string $contentType = self::contentTypes['currenciesIdGet'][0]) + { + list($response) = $this->currenciesIdGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation currenciesIdGetWithHttpInfo + * + * Get currency + * + * @param string $id The unique identifier of the currency. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['currenciesIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Currency|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function currenciesIdGetWithHttpInfo($id, string $contentType = self::contentTypes['currenciesIdGet'][0]) + { + $request = $this->currenciesIdGetRequest($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 ('\OpenAPI\Client\Model\Currency' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Currency' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Currency', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Currency'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Currency', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation currenciesIdGetAsync + * + * Get currency + * + * @param string $id The unique identifier of the currency. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['currenciesIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function currenciesIdGetAsync($id, string $contentType = self::contentTypes['currenciesIdGet'][0]) + { + return $this->currenciesIdGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation currenciesIdGetAsyncWithHttpInfo + * + * Get currency + * + * @param string $id The unique identifier of the currency. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['currenciesIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function currenciesIdGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['currenciesIdGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Currency'; + $request = $this->currenciesIdGetRequest($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 'currenciesIdGet' + * + * @param string $id The unique identifier of the currency. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['currenciesIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function currenciesIdGetRequest($id, string $contentType = self::contentTypes['currenciesIdGet'][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 currenciesIdGet' + ); + } + + + $resourcePath = '/currencies/{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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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/lib/Api/EventsApi.php b/lib/Api/EventsApi.php new file mode 100644 index 0000000..567090b --- /dev/null +++ b/lib/Api/EventsApi.php @@ -0,0 +1,2341 @@ + [ + 'application/json', + ], + 'eventsIdGet' => [ + 'application/json', + ], + 'eventsIdPut' => [ + 'application/json', + ], + 'scenariosIdEventsGet' => [ + 'application/json', + ], + 'scenariosIdEventsPost' => [ + 'application/json', + ], + 'usersIdEventsGet' => [ + '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 eventsIdDelete + * + * Delete event + * + * @param string $id The unique identifier of the event. (required) + * @param string $behaviour Whether the delete applies only to this event, to all events within the series from this event or to all events within the series. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function eventsIdDelete($id, $behaviour, string $contentType = self::contentTypes['eventsIdDelete'][0]) + { + $this->eventsIdDeleteWithHttpInfo($id, $behaviour, $contentType); + } + + /** + * Operation eventsIdDeleteWithHttpInfo + * + * Delete event + * + * @param string $id The unique identifier of the event. (required) + * @param string $behaviour Whether the delete applies only to this event, to all events within the series from this event or to all events within the series. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function eventsIdDeleteWithHttpInfo($id, $behaviour, string $contentType = self::contentTypes['eventsIdDelete'][0]) + { + $request = $this->eventsIdDeleteRequest($id, $behaviour, $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(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation eventsIdDeleteAsync + * + * Delete event + * + * @param string $id The unique identifier of the event. (required) + * @param string $behaviour Whether the delete applies only to this event, to all events within the series from this event or to all events within the series. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function eventsIdDeleteAsync($id, $behaviour, string $contentType = self::contentTypes['eventsIdDelete'][0]) + { + return $this->eventsIdDeleteAsyncWithHttpInfo($id, $behaviour, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation eventsIdDeleteAsyncWithHttpInfo + * + * Delete event + * + * @param string $id The unique identifier of the event. (required) + * @param string $behaviour Whether the delete applies only to this event, to all events within the series from this event or to all events within the series. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function eventsIdDeleteAsyncWithHttpInfo($id, $behaviour, string $contentType = self::contentTypes['eventsIdDelete'][0]) + { + $returnType = ''; + $request = $this->eventsIdDeleteRequest($id, $behaviour, $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 'eventsIdDelete' + * + * @param string $id The unique identifier of the event. (required) + * @param string $behaviour Whether the delete applies only to this event, to all events within the series from this event or to all events within the series. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function eventsIdDeleteRequest($id, $behaviour, string $contentType = self::contentTypes['eventsIdDelete'][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 eventsIdDelete' + ); + } + + // verify the required parameter 'behaviour' is set + if ($behaviour === null || (is_array($behaviour) && count($behaviour) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $behaviour when calling eventsIdDelete' + ); + } + + + $resourcePath = '/events/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $behaviour, + 'behaviour', // param base name + 'string', // 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/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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 eventsIdGet + * + * Get event + * + * @param string $id The unique identifier of the event. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Event|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function eventsIdGet($id, string $contentType = self::contentTypes['eventsIdGet'][0]) + { + list($response) = $this->eventsIdGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation eventsIdGetWithHttpInfo + * + * Get event + * + * @param string $id The unique identifier of the event. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Event|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function eventsIdGetWithHttpInfo($id, string $contentType = self::contentTypes['eventsIdGet'][0]) + { + $request = $this->eventsIdGetRequest($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 ('\OpenAPI\Client\Model\Event' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Event' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Event', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Event'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Event', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation eventsIdGetAsync + * + * Get event + * + * @param string $id The unique identifier of the event. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function eventsIdGetAsync($id, string $contentType = self::contentTypes['eventsIdGet'][0]) + { + return $this->eventsIdGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation eventsIdGetAsyncWithHttpInfo + * + * Get event + * + * @param string $id The unique identifier of the event. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function eventsIdGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['eventsIdGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Event'; + $request = $this->eventsIdGetRequest($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 'eventsIdGet' + * + * @param string $id The unique identifier of the event. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function eventsIdGetRequest($id, string $contentType = self::contentTypes['eventsIdGet'][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 eventsIdGet' + ); + } + + + $resourcePath = '/events/{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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 eventsIdPut + * + * Update event + * + * @param string $id The unique identifier of the event. (required) + * @param \OpenAPI\Client\Model\EventsIdPutRequest $events_id_put_request events_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Event|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function eventsIdPut($id, $events_id_put_request = null, string $contentType = self::contentTypes['eventsIdPut'][0]) + { + list($response) = $this->eventsIdPutWithHttpInfo($id, $events_id_put_request, $contentType); + return $response; + } + + /** + * Operation eventsIdPutWithHttpInfo + * + * Update event + * + * @param string $id The unique identifier of the event. (required) + * @param \OpenAPI\Client\Model\EventsIdPutRequest $events_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Event|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function eventsIdPutWithHttpInfo($id, $events_id_put_request = null, string $contentType = self::contentTypes['eventsIdPut'][0]) + { + $request = $this->eventsIdPutRequest($id, $events_id_put_request, $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 ('\OpenAPI\Client\Model\Event' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Event' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Event', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Event'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Event', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation eventsIdPutAsync + * + * Update event + * + * @param string $id The unique identifier of the event. (required) + * @param \OpenAPI\Client\Model\EventsIdPutRequest $events_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function eventsIdPutAsync($id, $events_id_put_request = null, string $contentType = self::contentTypes['eventsIdPut'][0]) + { + return $this->eventsIdPutAsyncWithHttpInfo($id, $events_id_put_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation eventsIdPutAsyncWithHttpInfo + * + * Update event + * + * @param string $id The unique identifier of the event. (required) + * @param \OpenAPI\Client\Model\EventsIdPutRequest $events_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function eventsIdPutAsyncWithHttpInfo($id, $events_id_put_request = null, string $contentType = self::contentTypes['eventsIdPut'][0]) + { + $returnType = '\OpenAPI\Client\Model\Event'; + $request = $this->eventsIdPutRequest($id, $events_id_put_request, $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 'eventsIdPut' + * + * @param string $id The unique identifier of the event. (required) + * @param \OpenAPI\Client\Model\EventsIdPutRequest $events_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['eventsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function eventsIdPutRequest($id, $events_id_put_request = null, string $contentType = self::contentTypes['eventsIdPut'][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 eventsIdPut' + ); + } + + + + $resourcePath = '/events/{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($events_id_put_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($events_id_put_request)); + } else { + $httpBody = $events_id_put_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 scenariosIdEventsGet + * + * List events in scenario. + * + * @param int $id The unique identifier of the scenario. (required) + * @param string $start_date Return the events from and including this date. (required) + * @param string $end_date Return the events until and including this date. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scenariosIdEventsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Event[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function scenariosIdEventsGet($id, $start_date, $end_date, string $contentType = self::contentTypes['scenariosIdEventsGet'][0]) + { + list($response) = $this->scenariosIdEventsGetWithHttpInfo($id, $start_date, $end_date, $contentType); + return $response; + } + + /** + * Operation scenariosIdEventsGetWithHttpInfo + * + * List events in scenario. + * + * @param int $id The unique identifier of the scenario. (required) + * @param string $start_date Return the events from and including this date. (required) + * @param string $end_date Return the events until and including this date. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scenariosIdEventsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Event[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function scenariosIdEventsGetWithHttpInfo($id, $start_date, $end_date, string $contentType = self::contentTypes['scenariosIdEventsGet'][0]) + { + $request = $this->scenariosIdEventsGetRequest($id, $start_date, $end_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 ('\OpenAPI\Client\Model\Event[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Event[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Event[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Event[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Event[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation scenariosIdEventsGetAsync + * + * List events in scenario. + * + * @param int $id The unique identifier of the scenario. (required) + * @param string $start_date Return the events from and including this date. (required) + * @param string $end_date Return the events until and including this date. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scenariosIdEventsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function scenariosIdEventsGetAsync($id, $start_date, $end_date, string $contentType = self::contentTypes['scenariosIdEventsGet'][0]) + { + return $this->scenariosIdEventsGetAsyncWithHttpInfo($id, $start_date, $end_date, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation scenariosIdEventsGetAsyncWithHttpInfo + * + * List events in scenario. + * + * @param int $id The unique identifier of the scenario. (required) + * @param string $start_date Return the events from and including this date. (required) + * @param string $end_date Return the events until and including this date. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scenariosIdEventsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function scenariosIdEventsGetAsyncWithHttpInfo($id, $start_date, $end_date, string $contentType = self::contentTypes['scenariosIdEventsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Event[]'; + $request = $this->scenariosIdEventsGetRequest($id, $start_date, $end_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 'scenariosIdEventsGet' + * + * @param int $id The unique identifier of the scenario. (required) + * @param string $start_date Return the events from and including this date. (required) + * @param string $end_date Return the events until and including this date. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scenariosIdEventsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function scenariosIdEventsGetRequest($id, $start_date, $end_date, string $contentType = self::contentTypes['scenariosIdEventsGet'][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 scenariosIdEventsGet' + ); + } + + // verify the required parameter 'start_date' is set + if ($start_date === null || (is_array($start_date) && count($start_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $start_date when calling scenariosIdEventsGet' + ); + } + + // verify the required parameter 'end_date' is set + if ($end_date === null || (is_array($end_date) && count($end_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $end_date when calling scenariosIdEventsGet' + ); + } + + + $resourcePath = '/scenarios/{id}/events'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'end_date', // param base name + 'string', // 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/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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 scenariosIdEventsPost + * + * Create event in scenario + * + * @param int $id The unique identifier of the scenario. (required) + * @param \OpenAPI\Client\Model\ScenariosIdEventsPostRequest $scenarios_id_events_post_request scenarios_id_events_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scenariosIdEventsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Event|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function scenariosIdEventsPost($id, $scenarios_id_events_post_request = null, string $contentType = self::contentTypes['scenariosIdEventsPost'][0]) + { + list($response) = $this->scenariosIdEventsPostWithHttpInfo($id, $scenarios_id_events_post_request, $contentType); + return $response; + } + + /** + * Operation scenariosIdEventsPostWithHttpInfo + * + * Create event in scenario + * + * @param int $id The unique identifier of the scenario. (required) + * @param \OpenAPI\Client\Model\ScenariosIdEventsPostRequest $scenarios_id_events_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scenariosIdEventsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Event|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function scenariosIdEventsPostWithHttpInfo($id, $scenarios_id_events_post_request = null, string $contentType = self::contentTypes['scenariosIdEventsPost'][0]) + { + $request = $this->scenariosIdEventsPostRequest($id, $scenarios_id_events_post_request, $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 ('\OpenAPI\Client\Model\Event' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Event' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Event', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Event'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Event', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation scenariosIdEventsPostAsync + * + * Create event in scenario + * + * @param int $id The unique identifier of the scenario. (required) + * @param \OpenAPI\Client\Model\ScenariosIdEventsPostRequest $scenarios_id_events_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scenariosIdEventsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function scenariosIdEventsPostAsync($id, $scenarios_id_events_post_request = null, string $contentType = self::contentTypes['scenariosIdEventsPost'][0]) + { + return $this->scenariosIdEventsPostAsyncWithHttpInfo($id, $scenarios_id_events_post_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation scenariosIdEventsPostAsyncWithHttpInfo + * + * Create event in scenario + * + * @param int $id The unique identifier of the scenario. (required) + * @param \OpenAPI\Client\Model\ScenariosIdEventsPostRequest $scenarios_id_events_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scenariosIdEventsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function scenariosIdEventsPostAsyncWithHttpInfo($id, $scenarios_id_events_post_request = null, string $contentType = self::contentTypes['scenariosIdEventsPost'][0]) + { + $returnType = '\OpenAPI\Client\Model\Event'; + $request = $this->scenariosIdEventsPostRequest($id, $scenarios_id_events_post_request, $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 'scenariosIdEventsPost' + * + * @param int $id The unique identifier of the scenario. (required) + * @param \OpenAPI\Client\Model\ScenariosIdEventsPostRequest $scenarios_id_events_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['scenariosIdEventsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function scenariosIdEventsPostRequest($id, $scenarios_id_events_post_request = null, string $contentType = self::contentTypes['scenariosIdEventsPost'][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 scenariosIdEventsPost' + ); + } + + + + $resourcePath = '/scenarios/{id}/events'; + $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($scenarios_id_events_post_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($scenarios_id_events_post_request)); + } else { + $httpBody = $scenarios_id_events_post_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdEventsGet + * + * List events in user. + * + * @param int $id The unique identifier of the user. (required) + * @param string $start_date Return the events from and including this date. (required) + * @param string $end_date Return the events until and including this date. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdEventsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Event[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdEventsGet($id, $start_date, $end_date, string $contentType = self::contentTypes['usersIdEventsGet'][0]) + { + list($response) = $this->usersIdEventsGetWithHttpInfo($id, $start_date, $end_date, $contentType); + return $response; + } + + /** + * Operation usersIdEventsGetWithHttpInfo + * + * List events in user. + * + * @param int $id The unique identifier of the user. (required) + * @param string $start_date Return the events from and including this date. (required) + * @param string $end_date Return the events until and including this date. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdEventsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Event[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdEventsGetWithHttpInfo($id, $start_date, $end_date, string $contentType = self::contentTypes['usersIdEventsGet'][0]) + { + $request = $this->usersIdEventsGetRequest($id, $start_date, $end_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 ('\OpenAPI\Client\Model\Event[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Event[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Event[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Event[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Event[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdEventsGetAsync + * + * List events in user. + * + * @param int $id The unique identifier of the user. (required) + * @param string $start_date Return the events from and including this date. (required) + * @param string $end_date Return the events until and including this date. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdEventsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdEventsGetAsync($id, $start_date, $end_date, string $contentType = self::contentTypes['usersIdEventsGet'][0]) + { + return $this->usersIdEventsGetAsyncWithHttpInfo($id, $start_date, $end_date, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdEventsGetAsyncWithHttpInfo + * + * List events in user. + * + * @param int $id The unique identifier of the user. (required) + * @param string $start_date Return the events from and including this date. (required) + * @param string $end_date Return the events until and including this date. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdEventsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdEventsGetAsyncWithHttpInfo($id, $start_date, $end_date, string $contentType = self::contentTypes['usersIdEventsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Event[]'; + $request = $this->usersIdEventsGetRequest($id, $start_date, $end_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 'usersIdEventsGet' + * + * @param int $id The unique identifier of the user. (required) + * @param string $start_date Return the events from and including this date. (required) + * @param string $end_date Return the events until and including this date. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdEventsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdEventsGetRequest($id, $start_date, $end_date, string $contentType = self::contentTypes['usersIdEventsGet'][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 usersIdEventsGet' + ); + } + + // verify the required parameter 'start_date' is set + if ($start_date === null || (is_array($start_date) && count($start_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $start_date when calling usersIdEventsGet' + ); + } + + // verify the required parameter 'end_date' is set + if ($end_date === null || (is_array($end_date) && count($end_date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $end_date when calling usersIdEventsGet' + ); + } + + + $resourcePath = '/users/{id}/events'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'end_date', // param base name + 'string', // 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/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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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/lib/Api/InstitutionsApi.php b/lib/Api/InstitutionsApi.php new file mode 100644 index 0000000..1d3e251 --- /dev/null +++ b/lib/Api/InstitutionsApi.php @@ -0,0 +1,1837 @@ + [ + 'application/json', + ], + 'institutionsIdGet' => [ + 'application/json', + ], + 'institutionsIdPut' => [ + 'application/json', + ], + 'usersIdInstitutionsGet' => [ + 'application/json', + ], + 'usersIdInstitutionsPost' => [ + '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 institutionsIdDelete + * + * Delete institution + * + * @param int $id The unique identifier of the institution. (required) + * @param int $merge_into_institution_id The unique identifier of the institution to merge into. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function institutionsIdDelete($id, $merge_into_institution_id = null, string $contentType = self::contentTypes['institutionsIdDelete'][0]) + { + $this->institutionsIdDeleteWithHttpInfo($id, $merge_into_institution_id, $contentType); + } + + /** + * Operation institutionsIdDeleteWithHttpInfo + * + * Delete institution + * + * @param int $id The unique identifier of the institution. (required) + * @param int $merge_into_institution_id The unique identifier of the institution to merge into. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function institutionsIdDeleteWithHttpInfo($id, $merge_into_institution_id = null, string $contentType = self::contentTypes['institutionsIdDelete'][0]) + { + $request = $this->institutionsIdDeleteRequest($id, $merge_into_institution_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 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation institutionsIdDeleteAsync + * + * Delete institution + * + * @param int $id The unique identifier of the institution. (required) + * @param int $merge_into_institution_id The unique identifier of the institution to merge into. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function institutionsIdDeleteAsync($id, $merge_into_institution_id = null, string $contentType = self::contentTypes['institutionsIdDelete'][0]) + { + return $this->institutionsIdDeleteAsyncWithHttpInfo($id, $merge_into_institution_id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation institutionsIdDeleteAsyncWithHttpInfo + * + * Delete institution + * + * @param int $id The unique identifier of the institution. (required) + * @param int $merge_into_institution_id The unique identifier of the institution to merge into. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function institutionsIdDeleteAsyncWithHttpInfo($id, $merge_into_institution_id = null, string $contentType = self::contentTypes['institutionsIdDelete'][0]) + { + $returnType = ''; + $request = $this->institutionsIdDeleteRequest($id, $merge_into_institution_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 'institutionsIdDelete' + * + * @param int $id The unique identifier of the institution. (required) + * @param int $merge_into_institution_id The unique identifier of the institution to merge into. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function institutionsIdDeleteRequest($id, $merge_into_institution_id = null, string $contentType = self::contentTypes['institutionsIdDelete'][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 institutionsIdDelete' + ); + } + + + + $resourcePath = '/institutions/{id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $merge_into_institution_id, + 'merge_into_institution_id', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 institutionsIdGet + * + * Get institution + * + * @param int $id The unique identifier of the institution. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Institution|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function institutionsIdGet($id, string $contentType = self::contentTypes['institutionsIdGet'][0]) + { + list($response) = $this->institutionsIdGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation institutionsIdGetWithHttpInfo + * + * Get institution + * + * @param int $id The unique identifier of the institution. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Institution|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function institutionsIdGetWithHttpInfo($id, string $contentType = self::contentTypes['institutionsIdGet'][0]) + { + $request = $this->institutionsIdGetRequest($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 ('\OpenAPI\Client\Model\Institution' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Institution' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Institution', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Institution'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Institution', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation institutionsIdGetAsync + * + * Get institution + * + * @param int $id The unique identifier of the institution. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function institutionsIdGetAsync($id, string $contentType = self::contentTypes['institutionsIdGet'][0]) + { + return $this->institutionsIdGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation institutionsIdGetAsyncWithHttpInfo + * + * Get institution + * + * @param int $id The unique identifier of the institution. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function institutionsIdGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['institutionsIdGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Institution'; + $request = $this->institutionsIdGetRequest($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 'institutionsIdGet' + * + * @param int $id The unique identifier of the institution. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function institutionsIdGetRequest($id, string $contentType = self::contentTypes['institutionsIdGet'][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 institutionsIdGet' + ); + } + + + $resourcePath = '/institutions/{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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 institutionsIdPut + * + * Update institution + * + * @param int $id The unique identifier of the institution. (required) + * @param \OpenAPI\Client\Model\InstitutionsIdPutRequest $institutions_id_put_request institutions_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Institution|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function institutionsIdPut($id, $institutions_id_put_request = null, string $contentType = self::contentTypes['institutionsIdPut'][0]) + { + list($response) = $this->institutionsIdPutWithHttpInfo($id, $institutions_id_put_request, $contentType); + return $response; + } + + /** + * Operation institutionsIdPutWithHttpInfo + * + * Update institution + * + * @param int $id The unique identifier of the institution. (required) + * @param \OpenAPI\Client\Model\InstitutionsIdPutRequest $institutions_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Institution|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function institutionsIdPutWithHttpInfo($id, $institutions_id_put_request = null, string $contentType = self::contentTypes['institutionsIdPut'][0]) + { + $request = $this->institutionsIdPutRequest($id, $institutions_id_put_request, $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 ('\OpenAPI\Client\Model\Institution' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Institution' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Institution', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Institution'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Institution', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation institutionsIdPutAsync + * + * Update institution + * + * @param int $id The unique identifier of the institution. (required) + * @param \OpenAPI\Client\Model\InstitutionsIdPutRequest $institutions_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function institutionsIdPutAsync($id, $institutions_id_put_request = null, string $contentType = self::contentTypes['institutionsIdPut'][0]) + { + return $this->institutionsIdPutAsyncWithHttpInfo($id, $institutions_id_put_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation institutionsIdPutAsyncWithHttpInfo + * + * Update institution + * + * @param int $id The unique identifier of the institution. (required) + * @param \OpenAPI\Client\Model\InstitutionsIdPutRequest $institutions_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function institutionsIdPutAsyncWithHttpInfo($id, $institutions_id_put_request = null, string $contentType = self::contentTypes['institutionsIdPut'][0]) + { + $returnType = '\OpenAPI\Client\Model\Institution'; + $request = $this->institutionsIdPutRequest($id, $institutions_id_put_request, $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 'institutionsIdPut' + * + * @param int $id The unique identifier of the institution. (required) + * @param \OpenAPI\Client\Model\InstitutionsIdPutRequest $institutions_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['institutionsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function institutionsIdPutRequest($id, $institutions_id_put_request = null, string $contentType = self::contentTypes['institutionsIdPut'][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 institutionsIdPut' + ); + } + + + + $resourcePath = '/institutions/{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($institutions_id_put_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($institutions_id_put_request)); + } else { + $httpBody = $institutions_id_put_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdInstitutionsGet + * + * List institutions in user + * + * @param int $id The unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdInstitutionsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Institution[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdInstitutionsGet($id, string $contentType = self::contentTypes['usersIdInstitutionsGet'][0]) + { + list($response) = $this->usersIdInstitutionsGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation usersIdInstitutionsGetWithHttpInfo + * + * List institutions in user + * + * @param int $id The unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdInstitutionsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Institution[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdInstitutionsGetWithHttpInfo($id, string $contentType = self::contentTypes['usersIdInstitutionsGet'][0]) + { + $request = $this->usersIdInstitutionsGetRequest($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 ('\OpenAPI\Client\Model\Institution[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Institution[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Institution[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Institution[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Institution[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdInstitutionsGetAsync + * + * List institutions in user + * + * @param int $id The unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdInstitutionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdInstitutionsGetAsync($id, string $contentType = self::contentTypes['usersIdInstitutionsGet'][0]) + { + return $this->usersIdInstitutionsGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdInstitutionsGetAsyncWithHttpInfo + * + * List institutions in user + * + * @param int $id The unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdInstitutionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdInstitutionsGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['usersIdInstitutionsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Institution[]'; + $request = $this->usersIdInstitutionsGetRequest($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 'usersIdInstitutionsGet' + * + * @param int $id The unique identifier of the user (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdInstitutionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdInstitutionsGetRequest($id, string $contentType = self::contentTypes['usersIdInstitutionsGet'][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 usersIdInstitutionsGet' + ); + } + + + $resourcePath = '/users/{id}/institutions'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdInstitutionsPost + * + * Create institution in user + * + * @param int $id The unique identifier of the user (required) + * @param \OpenAPI\Client\Model\UsersIdInstitutionsPostRequest $users_id_institutions_post_request users_id_institutions_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdInstitutionsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Institution|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdInstitutionsPost($id, $users_id_institutions_post_request = null, string $contentType = self::contentTypes['usersIdInstitutionsPost'][0]) + { + list($response) = $this->usersIdInstitutionsPostWithHttpInfo($id, $users_id_institutions_post_request, $contentType); + return $response; + } + + /** + * Operation usersIdInstitutionsPostWithHttpInfo + * + * Create institution in user + * + * @param int $id The unique identifier of the user (required) + * @param \OpenAPI\Client\Model\UsersIdInstitutionsPostRequest $users_id_institutions_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdInstitutionsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Institution|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdInstitutionsPostWithHttpInfo($id, $users_id_institutions_post_request = null, string $contentType = self::contentTypes['usersIdInstitutionsPost'][0]) + { + $request = $this->usersIdInstitutionsPostRequest($id, $users_id_institutions_post_request, $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 ('\OpenAPI\Client\Model\Institution' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Institution' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Institution', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Institution'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Institution', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdInstitutionsPostAsync + * + * Create institution in user + * + * @param int $id The unique identifier of the user (required) + * @param \OpenAPI\Client\Model\UsersIdInstitutionsPostRequest $users_id_institutions_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdInstitutionsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdInstitutionsPostAsync($id, $users_id_institutions_post_request = null, string $contentType = self::contentTypes['usersIdInstitutionsPost'][0]) + { + return $this->usersIdInstitutionsPostAsyncWithHttpInfo($id, $users_id_institutions_post_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdInstitutionsPostAsyncWithHttpInfo + * + * Create institution in user + * + * @param int $id The unique identifier of the user (required) + * @param \OpenAPI\Client\Model\UsersIdInstitutionsPostRequest $users_id_institutions_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdInstitutionsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdInstitutionsPostAsyncWithHttpInfo($id, $users_id_institutions_post_request = null, string $contentType = self::contentTypes['usersIdInstitutionsPost'][0]) + { + $returnType = '\OpenAPI\Client\Model\Institution'; + $request = $this->usersIdInstitutionsPostRequest($id, $users_id_institutions_post_request, $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 'usersIdInstitutionsPost' + * + * @param int $id The unique identifier of the user (required) + * @param \OpenAPI\Client\Model\UsersIdInstitutionsPostRequest $users_id_institutions_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdInstitutionsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdInstitutionsPostRequest($id, $users_id_institutions_post_request = null, string $contentType = self::contentTypes['usersIdInstitutionsPost'][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 usersIdInstitutionsPost' + ); + } + + + + $resourcePath = '/users/{id}/institutions'; + $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($users_id_institutions_post_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($users_id_institutions_post_request)); + } else { + $httpBody = $users_id_institutions_post_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/LabelsApi.php b/lib/Api/LabelsApi.php new file mode 100644 index 0000000..eab3748 --- /dev/null +++ b/lib/Api/LabelsApi.php @@ -0,0 +1,478 @@ + [ + '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 usersIdLabelsGet + * + * List labels in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdLabelsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdLabelsGet($id, string $contentType = self::contentTypes['usersIdLabelsGet'][0]) + { + list($response) = $this->usersIdLabelsGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation usersIdLabelsGetWithHttpInfo + * + * List labels in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdLabelsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdLabelsGetWithHttpInfo($id, string $contentType = self::contentTypes['usersIdLabelsGet'][0]) + { + $request = $this->usersIdLabelsGetRequest($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 ('string[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdLabelsGetAsync + * + * List labels in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdLabelsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdLabelsGetAsync($id, string $contentType = self::contentTypes['usersIdLabelsGet'][0]) + { + return $this->usersIdLabelsGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdLabelsGetAsyncWithHttpInfo + * + * List labels in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdLabelsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdLabelsGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['usersIdLabelsGet'][0]) + { + $returnType = 'string[]'; + $request = $this->usersIdLabelsGetRequest($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 'usersIdLabelsGet' + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdLabelsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdLabelsGetRequest($id, string $contentType = self::contentTypes['usersIdLabelsGet'][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 usersIdLabelsGet' + ); + } + + + $resourcePath = '/users/{id}/labels'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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/lib/Api/SavedSearchesApi.php b/lib/Api/SavedSearchesApi.php new file mode 100644 index 0000000..6f10535 --- /dev/null +++ b/lib/Api/SavedSearchesApi.php @@ -0,0 +1,478 @@ + [ + '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 usersIdSavedSearchesGet + * + * List saved searches in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdSavedSearchesGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\SavedSearch[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdSavedSearchesGet($id, string $contentType = self::contentTypes['usersIdSavedSearchesGet'][0]) + { + list($response) = $this->usersIdSavedSearchesGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation usersIdSavedSearchesGetWithHttpInfo + * + * List saved searches in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdSavedSearchesGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\SavedSearch[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdSavedSearchesGetWithHttpInfo($id, string $contentType = self::contentTypes['usersIdSavedSearchesGet'][0]) + { + $request = $this->usersIdSavedSearchesGetRequest($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 ('\OpenAPI\Client\Model\SavedSearch[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\SavedSearch[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\SavedSearch[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\SavedSearch[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\SavedSearch[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdSavedSearchesGetAsync + * + * List saved searches in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdSavedSearchesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdSavedSearchesGetAsync($id, string $contentType = self::contentTypes['usersIdSavedSearchesGet'][0]) + { + return $this->usersIdSavedSearchesGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdSavedSearchesGetAsyncWithHttpInfo + * + * List saved searches in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdSavedSearchesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdSavedSearchesGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['usersIdSavedSearchesGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\SavedSearch[]'; + $request = $this->usersIdSavedSearchesGetRequest($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 'usersIdSavedSearchesGet' + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdSavedSearchesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdSavedSearchesGetRequest($id, string $contentType = self::contentTypes['usersIdSavedSearchesGet'][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 usersIdSavedSearchesGet' + ); + } + + + $resourcePath = '/users/{id}/saved_searches'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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/lib/Api/TimeZonesApi.php b/lib/Api/TimeZonesApi.php new file mode 100644 index 0000000..7a63e58 --- /dev/null +++ b/lib/Api/TimeZonesApi.php @@ -0,0 +1,412 @@ + [ + '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 timeZonesGet + * + * List time zones + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['timeZonesGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\TimeZone[] + */ + public function timeZonesGet(string $contentType = self::contentTypes['timeZonesGet'][0]) + { + list($response) = $this->timeZonesGetWithHttpInfo($contentType); + return $response; + } + + /** + * Operation timeZonesGetWithHttpInfo + * + * List time zones + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['timeZonesGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\TimeZone[], HTTP status code, HTTP response headers (array of strings) + */ + public function timeZonesGetWithHttpInfo(string $contentType = self::contentTypes['timeZonesGet'][0]) + { + $request = $this->timeZonesGetRequest($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 ('\OpenAPI\Client\Model\TimeZone[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TimeZone[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TimeZone[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TimeZone[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\TimeZone[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation timeZonesGetAsync + * + * List time zones + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['timeZonesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function timeZonesGetAsync(string $contentType = self::contentTypes['timeZonesGet'][0]) + { + return $this->timeZonesGetAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation timeZonesGetAsyncWithHttpInfo + * + * List time zones + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['timeZonesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function timeZonesGetAsyncWithHttpInfo(string $contentType = self::contentTypes['timeZonesGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\TimeZone[]'; + $request = $this->timeZonesGetRequest($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 'timeZonesGet' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['timeZonesGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function timeZonesGetRequest(string $contentType = self::contentTypes['timeZonesGet'][0]) + { + + + $resourcePath = '/time_zones'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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/lib/Api/TransactionAccountsApi.php b/lib/Api/TransactionAccountsApi.php new file mode 100644 index 0000000..878d738 --- /dev/null +++ b/lib/Api/TransactionAccountsApi.php @@ -0,0 +1,1188 @@ + [ + 'application/json', + ], + 'transactionAccountsIdPut' => [ + 'application/json', + ], + 'usersIdTransactionAccountsGet' => [ + '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 transactionAccountsIdGet + * + * Get transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\TransactionAccount|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function transactionAccountsIdGet($id, string $contentType = self::contentTypes['transactionAccountsIdGet'][0]) + { + list($response) = $this->transactionAccountsIdGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation transactionAccountsIdGetWithHttpInfo + * + * Get transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\TransactionAccount|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function transactionAccountsIdGetWithHttpInfo($id, string $contentType = self::contentTypes['transactionAccountsIdGet'][0]) + { + $request = $this->transactionAccountsIdGetRequest($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 ('\OpenAPI\Client\Model\TransactionAccount' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TransactionAccount' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TransactionAccount', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TransactionAccount'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\TransactionAccount', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transactionAccountsIdGetAsync + * + * Get transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionAccountsIdGetAsync($id, string $contentType = self::contentTypes['transactionAccountsIdGet'][0]) + { + return $this->transactionAccountsIdGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transactionAccountsIdGetAsyncWithHttpInfo + * + * Get transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionAccountsIdGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['transactionAccountsIdGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\TransactionAccount'; + $request = $this->transactionAccountsIdGetRequest($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 'transactionAccountsIdGet' + * + * @param int $id The unique identifier of the transaction account. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transactionAccountsIdGetRequest($id, string $contentType = self::contentTypes['transactionAccountsIdGet'][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 transactionAccountsIdGet' + ); + } + + + $resourcePath = '/transaction_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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 transactionAccountsIdPut + * + * Update transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param \OpenAPI\Client\Model\TransactionAccountsIdPutRequest $transaction_accounts_id_put_request transaction_accounts_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\TransactionAccount|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function transactionAccountsIdPut($id, $transaction_accounts_id_put_request = null, string $contentType = self::contentTypes['transactionAccountsIdPut'][0]) + { + list($response) = $this->transactionAccountsIdPutWithHttpInfo($id, $transaction_accounts_id_put_request, $contentType); + return $response; + } + + /** + * Operation transactionAccountsIdPutWithHttpInfo + * + * Update transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param \OpenAPI\Client\Model\TransactionAccountsIdPutRequest $transaction_accounts_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\TransactionAccount|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function transactionAccountsIdPutWithHttpInfo($id, $transaction_accounts_id_put_request = null, string $contentType = self::contentTypes['transactionAccountsIdPut'][0]) + { + $request = $this->transactionAccountsIdPutRequest($id, $transaction_accounts_id_put_request, $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 ('\OpenAPI\Client\Model\TransactionAccount' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TransactionAccount' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TransactionAccount', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TransactionAccount'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\TransactionAccount', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transactionAccountsIdPutAsync + * + * Update transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param \OpenAPI\Client\Model\TransactionAccountsIdPutRequest $transaction_accounts_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionAccountsIdPutAsync($id, $transaction_accounts_id_put_request = null, string $contentType = self::contentTypes['transactionAccountsIdPut'][0]) + { + return $this->transactionAccountsIdPutAsyncWithHttpInfo($id, $transaction_accounts_id_put_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transactionAccountsIdPutAsyncWithHttpInfo + * + * Update transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param \OpenAPI\Client\Model\TransactionAccountsIdPutRequest $transaction_accounts_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionAccountsIdPutAsyncWithHttpInfo($id, $transaction_accounts_id_put_request = null, string $contentType = self::contentTypes['transactionAccountsIdPut'][0]) + { + $returnType = '\OpenAPI\Client\Model\TransactionAccount'; + $request = $this->transactionAccountsIdPutRequest($id, $transaction_accounts_id_put_request, $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 'transactionAccountsIdPut' + * + * @param int $id The unique identifier of the transaction account. (required) + * @param \OpenAPI\Client\Model\TransactionAccountsIdPutRequest $transaction_accounts_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transactionAccountsIdPutRequest($id, $transaction_accounts_id_put_request = null, string $contentType = self::contentTypes['transactionAccountsIdPut'][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 transactionAccountsIdPut' + ); + } + + + + $resourcePath = '/transaction_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($transaction_accounts_id_put_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($transaction_accounts_id_put_request)); + } else { + $httpBody = $transaction_accounts_id_put_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdTransactionAccountsGet + * + * List transaction accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTransactionAccountsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\TransactionAccount[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdTransactionAccountsGet($id, string $contentType = self::contentTypes['usersIdTransactionAccountsGet'][0]) + { + list($response) = $this->usersIdTransactionAccountsGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation usersIdTransactionAccountsGetWithHttpInfo + * + * List transaction accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTransactionAccountsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\TransactionAccount[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdTransactionAccountsGetWithHttpInfo($id, string $contentType = self::contentTypes['usersIdTransactionAccountsGet'][0]) + { + $request = $this->usersIdTransactionAccountsGetRequest($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 ('\OpenAPI\Client\Model\TransactionAccount[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\TransactionAccount[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\TransactionAccount[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\TransactionAccount[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\TransactionAccount[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdTransactionAccountsGetAsync + * + * List transaction accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTransactionAccountsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdTransactionAccountsGetAsync($id, string $contentType = self::contentTypes['usersIdTransactionAccountsGet'][0]) + { + return $this->usersIdTransactionAccountsGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdTransactionAccountsGetAsyncWithHttpInfo + * + * List transaction accounts in user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTransactionAccountsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdTransactionAccountsGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['usersIdTransactionAccountsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\TransactionAccount[]'; + $request = $this->usersIdTransactionAccountsGetRequest($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 'usersIdTransactionAccountsGet' + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTransactionAccountsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdTransactionAccountsGetRequest($id, string $contentType = self::contentTypes['usersIdTransactionAccountsGet'][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 usersIdTransactionAccountsGet' + ); + } + + + $resourcePath = '/users/{id}/transaction_accounts'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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/lib/Api/TransactionsApi.php b/lib/Api/TransactionsApi.php new file mode 100644 index 0000000..acd7938 --- /dev/null +++ b/lib/Api/TransactionsApi.php @@ -0,0 +1,3397 @@ + [ + 'application/json', + ], + 'categoriesIdTransactionsGet' => [ + 'application/json', + ], + 'transactionAccountsIdTransactionsGet' => [ + 'application/json', + ], + 'transactionAccountsIdTransactionsPost' => [ + 'application/json', + ], + 'transactionsIdDelete' => [ + 'application/json', + ], + 'transactionsIdGet' => [ + 'application/json', + ], + 'transactionsIdPut' => [ + 'application/json', + ], + 'usersIdTransactionsGet' => [ + '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 accountsIdTransactionsGet + * + * List transactions in account + * + * @param int $id The unique identifier of the account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdTransactionsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Transaction[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function accountsIdTransactionsGet($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['accountsIdTransactionsGet'][0]) + { + list($response) = $this->accountsIdTransactionsGetWithHttpInfo($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $contentType); + return $response; + } + + /** + * Operation accountsIdTransactionsGetWithHttpInfo + * + * List transactions in account + * + * @param int $id The unique identifier of the account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdTransactionsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Transaction[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function accountsIdTransactionsGetWithHttpInfo($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['accountsIdTransactionsGet'][0]) + { + $request = $this->accountsIdTransactionsGetRequest($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $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 ('\OpenAPI\Client\Model\Transaction[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Transaction[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Transaction[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Transaction[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Transaction[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation accountsIdTransactionsGetAsync + * + * List transactions in account + * + * @param int $id The unique identifier of the account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function accountsIdTransactionsGetAsync($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['accountsIdTransactionsGet'][0]) + { + return $this->accountsIdTransactionsGetAsyncWithHttpInfo($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation accountsIdTransactionsGetAsyncWithHttpInfo + * + * List transactions in account + * + * @param int $id The unique identifier of the account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function accountsIdTransactionsGetAsyncWithHttpInfo($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['accountsIdTransactionsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Transaction[]'; + $request = $this->accountsIdTransactionsGetRequest($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $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 'accountsIdTransactionsGet' + * + * @param int $id The unique identifier of the account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountsIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function accountsIdTransactionsGetRequest($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['accountsIdTransactionsGet'][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 accountsIdTransactionsGet' + ); + } + + + + + + + + + + + $resourcePath = '/accounts/{id}/transactions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_since, + 'updated_since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $uncategorised, + 'uncategorised', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $needs_review, + 'needs_review', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search, + 'search', // 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 + ) ?? []); + + + // 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 categoriesIdTransactionsGet + * + * List transactions in categories + * + * @param string $id A comma-separated list of category IDs. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdTransactionsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Transaction[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function categoriesIdTransactionsGet($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['categoriesIdTransactionsGet'][0]) + { + list($response) = $this->categoriesIdTransactionsGetWithHttpInfo($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $contentType); + return $response; + } + + /** + * Operation categoriesIdTransactionsGetWithHttpInfo + * + * List transactions in categories + * + * @param string $id A comma-separated list of category IDs. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdTransactionsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Transaction[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function categoriesIdTransactionsGetWithHttpInfo($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['categoriesIdTransactionsGet'][0]) + { + $request = $this->categoriesIdTransactionsGetRequest($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $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 ('\OpenAPI\Client\Model\Transaction[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Transaction[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Transaction[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Transaction[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Transaction[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation categoriesIdTransactionsGetAsync + * + * List transactions in categories + * + * @param string $id A comma-separated list of category IDs. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function categoriesIdTransactionsGetAsync($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['categoriesIdTransactionsGet'][0]) + { + return $this->categoriesIdTransactionsGetAsyncWithHttpInfo($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation categoriesIdTransactionsGetAsyncWithHttpInfo + * + * List transactions in categories + * + * @param string $id A comma-separated list of category IDs. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function categoriesIdTransactionsGetAsyncWithHttpInfo($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['categoriesIdTransactionsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Transaction[]'; + $request = $this->categoriesIdTransactionsGetRequest($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $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 'categoriesIdTransactionsGet' + * + * @param string $id A comma-separated list of category IDs. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['categoriesIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function categoriesIdTransactionsGetRequest($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['categoriesIdTransactionsGet'][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 categoriesIdTransactionsGet' + ); + } + + + + + + + + + + + $resourcePath = '/categories/{id}/transactions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_since, + 'updated_since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $uncategorised, + 'uncategorised', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $needs_review, + 'needs_review', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search, + 'search', // 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 + ) ?? []); + + + // 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 transactionAccountsIdTransactionsGet + * + * List transactions in transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdTransactionsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Transaction[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function transactionAccountsIdTransactionsGet($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['transactionAccountsIdTransactionsGet'][0]) + { + list($response) = $this->transactionAccountsIdTransactionsGetWithHttpInfo($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $contentType); + return $response; + } + + /** + * Operation transactionAccountsIdTransactionsGetWithHttpInfo + * + * List transactions in transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdTransactionsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Transaction[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function transactionAccountsIdTransactionsGetWithHttpInfo($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['transactionAccountsIdTransactionsGet'][0]) + { + $request = $this->transactionAccountsIdTransactionsGetRequest($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $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 ('\OpenAPI\Client\Model\Transaction[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Transaction[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Transaction[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Transaction[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Transaction[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transactionAccountsIdTransactionsGetAsync + * + * List transactions in transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionAccountsIdTransactionsGetAsync($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['transactionAccountsIdTransactionsGet'][0]) + { + return $this->transactionAccountsIdTransactionsGetAsyncWithHttpInfo($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transactionAccountsIdTransactionsGetAsyncWithHttpInfo + * + * List transactions in transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionAccountsIdTransactionsGetAsyncWithHttpInfo($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['transactionAccountsIdTransactionsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Transaction[]'; + $request = $this->transactionAccountsIdTransactionsGetRequest($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $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 'transactionAccountsIdTransactionsGet' + * + * @param int $id The unique identifier of the transaction account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transactionAccountsIdTransactionsGetRequest($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['transactionAccountsIdTransactionsGet'][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 transactionAccountsIdTransactionsGet' + ); + } + + + + + + + + + + + $resourcePath = '/transaction_accounts/{id}/transactions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_since, + 'updated_since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $uncategorised, + 'uncategorised', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $needs_review, + 'needs_review', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search, + 'search', // 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 + ) ?? []); + + + // 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 transactionAccountsIdTransactionsPost + * + * Create a transaction in transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param \OpenAPI\Client\Model\TransactionAccountsIdTransactionsPostRequest $transaction_accounts_id_transactions_post_request transaction_accounts_id_transactions_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdTransactionsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Transaction|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function transactionAccountsIdTransactionsPost($id, $transaction_accounts_id_transactions_post_request = null, string $contentType = self::contentTypes['transactionAccountsIdTransactionsPost'][0]) + { + list($response) = $this->transactionAccountsIdTransactionsPostWithHttpInfo($id, $transaction_accounts_id_transactions_post_request, $contentType); + return $response; + } + + /** + * Operation transactionAccountsIdTransactionsPostWithHttpInfo + * + * Create a transaction in transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param \OpenAPI\Client\Model\TransactionAccountsIdTransactionsPostRequest $transaction_accounts_id_transactions_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdTransactionsPost'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Transaction|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function transactionAccountsIdTransactionsPostWithHttpInfo($id, $transaction_accounts_id_transactions_post_request = null, string $contentType = self::contentTypes['transactionAccountsIdTransactionsPost'][0]) + { + $request = $this->transactionAccountsIdTransactionsPostRequest($id, $transaction_accounts_id_transactions_post_request, $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 ('\OpenAPI\Client\Model\Transaction' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Transaction' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Transaction', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Transaction'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Transaction', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transactionAccountsIdTransactionsPostAsync + * + * Create a transaction in transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param \OpenAPI\Client\Model\TransactionAccountsIdTransactionsPostRequest $transaction_accounts_id_transactions_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdTransactionsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionAccountsIdTransactionsPostAsync($id, $transaction_accounts_id_transactions_post_request = null, string $contentType = self::contentTypes['transactionAccountsIdTransactionsPost'][0]) + { + return $this->transactionAccountsIdTransactionsPostAsyncWithHttpInfo($id, $transaction_accounts_id_transactions_post_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transactionAccountsIdTransactionsPostAsyncWithHttpInfo + * + * Create a transaction in transaction account + * + * @param int $id The unique identifier of the transaction account. (required) + * @param \OpenAPI\Client\Model\TransactionAccountsIdTransactionsPostRequest $transaction_accounts_id_transactions_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdTransactionsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionAccountsIdTransactionsPostAsyncWithHttpInfo($id, $transaction_accounts_id_transactions_post_request = null, string $contentType = self::contentTypes['transactionAccountsIdTransactionsPost'][0]) + { + $returnType = '\OpenAPI\Client\Model\Transaction'; + $request = $this->transactionAccountsIdTransactionsPostRequest($id, $transaction_accounts_id_transactions_post_request, $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 'transactionAccountsIdTransactionsPost' + * + * @param int $id The unique identifier of the transaction account. (required) + * @param \OpenAPI\Client\Model\TransactionAccountsIdTransactionsPostRequest $transaction_accounts_id_transactions_post_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionAccountsIdTransactionsPost'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transactionAccountsIdTransactionsPostRequest($id, $transaction_accounts_id_transactions_post_request = null, string $contentType = self::contentTypes['transactionAccountsIdTransactionsPost'][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 transactionAccountsIdTransactionsPost' + ); + } + + + + $resourcePath = '/transaction_accounts/{id}/transactions'; + $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($transaction_accounts_id_transactions_post_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($transaction_accounts_id_transactions_post_request)); + } else { + $httpBody = $transaction_accounts_id_transactions_post_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 transactionsIdDelete + * + * Delete transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function transactionsIdDelete($id, string $contentType = self::contentTypes['transactionsIdDelete'][0]) + { + $this->transactionsIdDeleteWithHttpInfo($id, $contentType); + } + + /** + * Operation transactionsIdDeleteWithHttpInfo + * + * Delete transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdDelete'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function transactionsIdDeleteWithHttpInfo($id, string $contentType = self::contentTypes['transactionsIdDelete'][0]) + { + $request = $this->transactionsIdDeleteRequest($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 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transactionsIdDeleteAsync + * + * Delete transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsIdDeleteAsync($id, string $contentType = self::contentTypes['transactionsIdDelete'][0]) + { + return $this->transactionsIdDeleteAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transactionsIdDeleteAsyncWithHttpInfo + * + * Delete transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsIdDeleteAsyncWithHttpInfo($id, string $contentType = self::contentTypes['transactionsIdDelete'][0]) + { + $returnType = ''; + $request = $this->transactionsIdDeleteRequest($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 'transactionsIdDelete' + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transactionsIdDeleteRequest($id, string $contentType = self::contentTypes['transactionsIdDelete'][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 transactionsIdDelete' + ); + } + + + $resourcePath = '/transactions/{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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 transactionsIdGet + * + * Get a transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Transaction|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function transactionsIdGet($id, string $contentType = self::contentTypes['transactionsIdGet'][0]) + { + list($response) = $this->transactionsIdGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation transactionsIdGetWithHttpInfo + * + * Get a transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Transaction|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function transactionsIdGetWithHttpInfo($id, string $contentType = self::contentTypes['transactionsIdGet'][0]) + { + $request = $this->transactionsIdGetRequest($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 ('\OpenAPI\Client\Model\Transaction' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Transaction' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Transaction', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Transaction'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Transaction', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transactionsIdGetAsync + * + * Get a transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsIdGetAsync($id, string $contentType = self::contentTypes['transactionsIdGet'][0]) + { + return $this->transactionsIdGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transactionsIdGetAsyncWithHttpInfo + * + * Get a transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsIdGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['transactionsIdGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Transaction'; + $request = $this->transactionsIdGetRequest($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 'transactionsIdGet' + * + * @param int $id The unique identifier of the transaction. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transactionsIdGetRequest($id, string $contentType = self::contentTypes['transactionsIdGet'][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 transactionsIdGet' + ); + } + + + $resourcePath = '/transactions/{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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 transactionsIdPut + * + * Update a transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param \OpenAPI\Client\Model\TransactionsIdPutRequest $transactions_id_put_request transactions_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Transaction|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function transactionsIdPut($id, $transactions_id_put_request = null, string $contentType = self::contentTypes['transactionsIdPut'][0]) + { + list($response) = $this->transactionsIdPutWithHttpInfo($id, $transactions_id_put_request, $contentType); + return $response; + } + + /** + * Operation transactionsIdPutWithHttpInfo + * + * Update a transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param \OpenAPI\Client\Model\TransactionsIdPutRequest $transactions_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Transaction|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function transactionsIdPutWithHttpInfo($id, $transactions_id_put_request = null, string $contentType = self::contentTypes['transactionsIdPut'][0]) + { + $request = $this->transactionsIdPutRequest($id, $transactions_id_put_request, $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 ('\OpenAPI\Client\Model\Transaction' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Transaction' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Transaction', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Transaction'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Transaction', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transactionsIdPutAsync + * + * Update a transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param \OpenAPI\Client\Model\TransactionsIdPutRequest $transactions_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsIdPutAsync($id, $transactions_id_put_request = null, string $contentType = self::contentTypes['transactionsIdPut'][0]) + { + return $this->transactionsIdPutAsyncWithHttpInfo($id, $transactions_id_put_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transactionsIdPutAsyncWithHttpInfo + * + * Update a transaction + * + * @param int $id The unique identifier of the transaction. (required) + * @param \OpenAPI\Client\Model\TransactionsIdPutRequest $transactions_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transactionsIdPutAsyncWithHttpInfo($id, $transactions_id_put_request = null, string $contentType = self::contentTypes['transactionsIdPut'][0]) + { + $returnType = '\OpenAPI\Client\Model\Transaction'; + $request = $this->transactionsIdPutRequest($id, $transactions_id_put_request, $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 'transactionsIdPut' + * + * @param int $id The unique identifier of the transaction. (required) + * @param \OpenAPI\Client\Model\TransactionsIdPutRequest $transactions_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['transactionsIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transactionsIdPutRequest($id, $transactions_id_put_request = null, string $contentType = self::contentTypes['transactionsIdPut'][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 transactionsIdPut' + ); + } + + + + $resourcePath = '/transactions/{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($transactions_id_put_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($transactions_id_put_request)); + } else { + $httpBody = $transactions_id_put_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdTransactionsGet + * + * List transactions in user + * + * @param int $id The unique identifier of the account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTransactionsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\Transaction[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdTransactionsGet($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['usersIdTransactionsGet'][0]) + { + list($response) = $this->usersIdTransactionsGetWithHttpInfo($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $contentType); + return $response; + } + + /** + * Operation usersIdTransactionsGetWithHttpInfo + * + * List transactions in user + * + * @param int $id The unique identifier of the account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTransactionsGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\Transaction[]|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdTransactionsGetWithHttpInfo($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['usersIdTransactionsGet'][0]) + { + $request = $this->usersIdTransactionsGetRequest($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $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 ('\OpenAPI\Client\Model\Transaction[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Transaction[]' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Transaction[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\Transaction[]'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Transaction[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdTransactionsGetAsync + * + * List transactions in user + * + * @param int $id The unique identifier of the account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdTransactionsGetAsync($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['usersIdTransactionsGet'][0]) + { + return $this->usersIdTransactionsGetAsyncWithHttpInfo($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdTransactionsGetAsyncWithHttpInfo + * + * List transactions in user + * + * @param int $id The unique identifier of the account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdTransactionsGetAsyncWithHttpInfo($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['usersIdTransactionsGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\Transaction[]'; + $request = $this->usersIdTransactionsGetRequest($id, $start_date, $end_date, $updated_since, $uncategorised, $type, $needs_review, $search, $page, $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 'usersIdTransactionsGet' + * + * @param int $id The unique identifier of the account. (required) + * @param string $start_date Limit to transactions on or after this date. Required if end_date is provided. If not provided, defaults to the furtherest date allowed by the user's subscription. (optional) + * @param string $end_date Limit to transactions on or before this date. Required if start_date is provided. If not provided, defaults to today's date. (optional) + * @param string $updated_since Limit to transactions updated since an ISO 8601 timestamp. (optional) + * @param int $uncategorised Limit to uncategorised transactions. (optional) + * @param string $type Limit to transactions of this type. (optional) + * @param int $needs_review Limit to transactions that need to be reviewed. (optional) + * @param string $search Limit to transactions matching a keyword search string. The provided string is matched against the transaction amount, account name, payee, category title, note, labels, and the date in ISO 8601 format. (optional) + * @param int $page Choose a particular page of the results. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdTransactionsGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdTransactionsGetRequest($id, $start_date = null, $end_date = null, $updated_since = null, $uncategorised = null, $type = null, $needs_review = null, $search = null, $page = null, string $contentType = self::contentTypes['usersIdTransactionsGet'][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 usersIdTransactionsGet' + ); + } + + + + + + + + + + + $resourcePath = '/users/{id}/transactions'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_date, + 'start_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_date, + 'end_date', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $updated_since, + 'updated_since', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $uncategorised, + 'uncategorised', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $type, + 'type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $needs_review, + 'needs_review', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $search, + 'search', // 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 + ) ?? []); + + + // 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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/lib/Api/UsersApi.php b/lib/Api/UsersApi.php new file mode 100644 index 0000000..6ee6f05 --- /dev/null +++ b/lib/Api/UsersApi.php @@ -0,0 +1,1145 @@ + [ + 'application/json', + ], + 'usersIdGet' => [ + 'application/json', + ], + 'usersIdPut' => [ + '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 meGet + * + * Get the authorised user + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['meGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\User|\OpenAPI\Client\Model\Error + */ + public function meGet(string $contentType = self::contentTypes['meGet'][0]) + { + list($response) = $this->meGetWithHttpInfo($contentType); + return $response; + } + + /** + * Operation meGetWithHttpInfo + * + * Get the authorised user + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['meGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\User|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function meGetWithHttpInfo(string $contentType = self::contentTypes['meGet'][0]) + { + $request = $this->meGetRequest($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 ('\OpenAPI\Client\Model\User' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\User' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\User', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\User'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\User', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation meGetAsync + * + * Get the authorised user + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['meGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function meGetAsync(string $contentType = self::contentTypes['meGet'][0]) + { + return $this->meGetAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation meGetAsyncWithHttpInfo + * + * Get the authorised user + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['meGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function meGetAsyncWithHttpInfo(string $contentType = self::contentTypes['meGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\User'; + $request = $this->meGetRequest($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 'meGet' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['meGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function meGetRequest(string $contentType = self::contentTypes['meGet'][0]) + { + + + $resourcePath = '/me'; + $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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdGet + * + * Get user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\User|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdGet($id, string $contentType = self::contentTypes['usersIdGet'][0]) + { + list($response) = $this->usersIdGetWithHttpInfo($id, $contentType); + return $response; + } + + /** + * Operation usersIdGetWithHttpInfo + * + * Get user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdGet'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\User|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdGetWithHttpInfo($id, string $contentType = self::contentTypes['usersIdGet'][0]) + { + $request = $this->usersIdGetRequest($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 ('\OpenAPI\Client\Model\User' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\User' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\User', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\User'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\User', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdGetAsync + * + * Get user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdGetAsync($id, string $contentType = self::contentTypes['usersIdGet'][0]) + { + return $this->usersIdGetAsyncWithHttpInfo($id, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdGetAsyncWithHttpInfo + * + * Get user + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdGetAsyncWithHttpInfo($id, string $contentType = self::contentTypes['usersIdGet'][0]) + { + $returnType = '\OpenAPI\Client\Model\User'; + $request = $this->usersIdGetRequest($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 'usersIdGet' + * + * @param int $id The unique identifier of the user. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdGet'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdGetRequest($id, string $contentType = self::contentTypes['usersIdGet'][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 usersIdGet' + ); + } + + + $resourcePath = '/users/{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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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 usersIdPut + * + * Update user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdPutRequest $users_id_put_request users_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\User|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error + */ + public function usersIdPut($id, $users_id_put_request = null, string $contentType = self::contentTypes['usersIdPut'][0]) + { + list($response) = $this->usersIdPutWithHttpInfo($id, $users_id_put_request, $contentType); + return $response; + } + + /** + * Operation usersIdPutWithHttpInfo + * + * Update user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdPutRequest $users_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdPut'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\User|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error|\OpenAPI\Client\Model\Error, HTTP status code, HTTP response headers (array of strings) + */ + public function usersIdPutWithHttpInfo($id, $users_id_put_request = null, string $contentType = self::contentTypes['usersIdPut'][0]) + { + $request = $this->usersIdPutRequest($id, $users_id_put_request, $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 ('\OpenAPI\Client\Model\User' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\User' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\User', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\OpenAPI\Client\Model\Error' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\Error' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\Error', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\User'; + 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() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\User', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\Error', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation usersIdPutAsync + * + * Update user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdPutRequest $users_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdPutAsync($id, $users_id_put_request = null, string $contentType = self::contentTypes['usersIdPut'][0]) + { + return $this->usersIdPutAsyncWithHttpInfo($id, $users_id_put_request, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation usersIdPutAsyncWithHttpInfo + * + * Update user + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdPutRequest $users_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function usersIdPutAsyncWithHttpInfo($id, $users_id_put_request = null, string $contentType = self::contentTypes['usersIdPut'][0]) + { + $returnType = '\OpenAPI\Client\Model\User'; + $request = $this->usersIdPutRequest($id, $users_id_put_request, $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 'usersIdPut' + * + * @param int $id The unique identifier of the user. (required) + * @param \OpenAPI\Client\Model\UsersIdPutRequest $users_id_put_request (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['usersIdPut'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function usersIdPutRequest($id, $users_id_put_request = null, string $contentType = self::contentTypes['usersIdPut'][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 usersIdPut' + ); + } + + + + $resourcePath = '/users/{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($users_id_put_request)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($users_id_put_request)); + } else { + $httpBody = $users_id_put_request; + } + } 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-Developer-Key'); + if ($apiKey !== null) { + $headers['X-Developer-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/lib/ApiException.php b/lib/ApiException.php new file mode 100644 index 0000000..9e677e8 --- /dev/null +++ b/lib/ApiException.php @@ -0,0 +1,120 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/lib/Configuration.php b/lib/Configuration.php new file mode 100644 index 0000000..7521800 --- /dev/null +++ b/lib/Configuration.php @@ -0,0 +1,532 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $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 (OpenAPI\Client) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 2.0' . 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.pocketsmith.com/v2", + "description" => "Production", + ] + ]; + } + + /** + * 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/lib/HeaderSelector.php b/lib/HeaderSelector.php new file mode 100644 index 0000000..0fb9ae1 --- /dev/null +++ b/lib/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/lib/Model/Account.php b/lib/Model/Account.php new file mode 100644 index 0000000..8b6577e --- /dev/null +++ b/lib/Model/Account.php @@ -0,0 +1,1006 @@ + + */ +class Account implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Account'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'title' => 'string', + 'currency_code' => 'string', + 'type' => 'string', + 'is_net_worth' => 'bool', + 'primary_transaction_account' => '\OpenAPI\Client\Model\TransactionAccount', + 'primary_scenario' => '\OpenAPI\Client\Model\Scenario', + 'transaction_accounts' => '\OpenAPI\Client\Model\TransactionAccount[]', + 'scenarios' => '\OpenAPI\Client\Model\Scenario[]', + 'created_at' => 'string', + 'updated_at' => 'string', + 'current_balance' => 'float', + 'current_balance_date' => 'string', + 'current_balance_in_base_currency' => 'float', + 'current_balance_exchange_rate' => 'float', + 'safe_balance' => 'float', + 'safe_balance_in_base_currency' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'currency_code' => null, + 'type' => null, + 'is_net_worth' => null, + 'primary_transaction_account' => null, + 'primary_scenario' => null, + 'transaction_accounts' => null, + 'scenarios' => null, + 'created_at' => null, + 'updated_at' => null, + 'current_balance' => null, + 'current_balance_date' => null, + 'current_balance_in_base_currency' => null, + 'current_balance_exchange_rate' => null, + 'safe_balance' => null, + 'safe_balance_in_base_currency' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'title' => false, + 'currency_code' => false, + 'type' => false, + 'is_net_worth' => false, + 'primary_transaction_account' => false, + 'primary_scenario' => false, + 'transaction_accounts' => false, + 'scenarios' => false, + 'created_at' => false, + 'updated_at' => false, + 'current_balance' => false, + 'current_balance_date' => false, + 'current_balance_in_base_currency' => false, + 'current_balance_exchange_rate' => false, + 'safe_balance' => false, + 'safe_balance_in_base_currency' => 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', + 'title' => 'title', + 'currency_code' => 'currency_code', + 'type' => 'type', + 'is_net_worth' => 'is_net_worth', + 'primary_transaction_account' => 'primary_transaction_account', + 'primary_scenario' => 'primary_scenario', + 'transaction_accounts' => 'transaction_accounts', + 'scenarios' => 'scenarios', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at', + 'current_balance' => 'current_balance', + 'current_balance_date' => 'current_balance_date', + 'current_balance_in_base_currency' => 'current_balance_in_base_currency', + 'current_balance_exchange_rate' => 'current_balance_exchange_rate', + 'safe_balance' => 'safe_balance', + 'safe_balance_in_base_currency' => 'safe_balance_in_base_currency' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'currency_code' => 'setCurrencyCode', + 'type' => 'setType', + 'is_net_worth' => 'setIsNetWorth', + 'primary_transaction_account' => 'setPrimaryTransactionAccount', + 'primary_scenario' => 'setPrimaryScenario', + 'transaction_accounts' => 'setTransactionAccounts', + 'scenarios' => 'setScenarios', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'current_balance' => 'setCurrentBalance', + 'current_balance_date' => 'setCurrentBalanceDate', + 'current_balance_in_base_currency' => 'setCurrentBalanceInBaseCurrency', + 'current_balance_exchange_rate' => 'setCurrentBalanceExchangeRate', + 'safe_balance' => 'setSafeBalance', + 'safe_balance_in_base_currency' => 'setSafeBalanceInBaseCurrency' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'currency_code' => 'getCurrencyCode', + 'type' => 'getType', + 'is_net_worth' => 'getIsNetWorth', + 'primary_transaction_account' => 'getPrimaryTransactionAccount', + 'primary_scenario' => 'getPrimaryScenario', + 'transaction_accounts' => 'getTransactionAccounts', + 'scenarios' => 'getScenarios', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'current_balance' => 'getCurrentBalance', + 'current_balance_date' => 'getCurrentBalanceDate', + 'current_balance_in_base_currency' => 'getCurrentBalanceInBaseCurrency', + 'current_balance_exchange_rate' => 'getCurrentBalanceExchangeRate', + 'safe_balance' => 'getSafeBalance', + 'safe_balance_in_base_currency' => 'getSafeBalanceInBaseCurrency' + ]; + + /** + * 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; + } + + public const TYPE_BANK = 'bank'; + public const TYPE_CREDITS = 'credits'; + public const TYPE_CASH = 'cash'; + public const TYPE_STOCKS = 'stocks'; + public const TYPE_MORTGAGE = 'mortgage'; + public const TYPE_LOANS = 'loans'; + public const TYPE_VEHICLE = 'vehicle'; + public const TYPE_PROPERTY = 'property'; + public const TYPE_INSURANCE = 'insurance'; + public const TYPE_OTHER_ASSET = 'other_asset'; + public const TYPE_OTHER_LIABILITY = 'other_liability'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_BANK, + self::TYPE_CREDITS, + self::TYPE_CASH, + self::TYPE_STOCKS, + self::TYPE_MORTGAGE, + self::TYPE_LOANS, + self::TYPE_VEHICLE, + self::TYPE_PROPERTY, + self::TYPE_INSURANCE, + self::TYPE_OTHER_ASSET, + self::TYPE_OTHER_LIABILITY, + ]; + } + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('currency_code', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('is_net_worth', $data ?? [], null); + $this->setIfExists('primary_transaction_account', $data ?? [], null); + $this->setIfExists('primary_scenario', $data ?? [], null); + $this->setIfExists('transaction_accounts', $data ?? [], null); + $this->setIfExists('scenarios', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('current_balance', $data ?? [], null); + $this->setIfExists('current_balance_date', $data ?? [], null); + $this->setIfExists('current_balance_in_base_currency', $data ?? [], null); + $this->setIfExists('current_balance_exchange_rate', $data ?? [], null); + $this->setIfExists('safe_balance', $data ?? [], null); + $this->setIfExists('safe_balance_in_base_currency', $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 = []; + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + 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 unique identifier of the account. + * + * @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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the account. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets currency_code + * + * @return string|null + */ + public function getCurrencyCode() + { + return $this->container['currency_code']; + } + + /** + * Sets currency_code + * + * @param string|null $currency_code The currency code for the account. + * + * @return self + */ + public function setCurrencyCode($currency_code) + { + if (is_null($currency_code)) { + throw new \InvalidArgumentException('non-nullable currency_code cannot be null'); + } + $this->container['currency_code'] = $currency_code; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of the account. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets is_net_worth + * + * @return bool|null + */ + public function getIsNetWorth() + { + return $this->container['is_net_worth']; + } + + /** + * Sets is_net_worth + * + * @param bool|null $is_net_worth Whether the account is a net worth asset. + * + * @return self + */ + public function setIsNetWorth($is_net_worth) + { + if (is_null($is_net_worth)) { + throw new \InvalidArgumentException('non-nullable is_net_worth cannot be null'); + } + $this->container['is_net_worth'] = $is_net_worth; + + return $this; + } + + /** + * Gets primary_transaction_account + * + * @return \OpenAPI\Client\Model\TransactionAccount|null + */ + public function getPrimaryTransactionAccount() + { + return $this->container['primary_transaction_account']; + } + + /** + * Sets primary_transaction_account + * + * @param \OpenAPI\Client\Model\TransactionAccount|null $primary_transaction_account primary_transaction_account + * + * @return self + */ + public function setPrimaryTransactionAccount($primary_transaction_account) + { + if (is_null($primary_transaction_account)) { + throw new \InvalidArgumentException('non-nullable primary_transaction_account cannot be null'); + } + $this->container['primary_transaction_account'] = $primary_transaction_account; + + return $this; + } + + /** + * Gets primary_scenario + * + * @return \OpenAPI\Client\Model\Scenario|null + */ + public function getPrimaryScenario() + { + return $this->container['primary_scenario']; + } + + /** + * Sets primary_scenario + * + * @param \OpenAPI\Client\Model\Scenario|null $primary_scenario primary_scenario + * + * @return self + */ + public function setPrimaryScenario($primary_scenario) + { + if (is_null($primary_scenario)) { + throw new \InvalidArgumentException('non-nullable primary_scenario cannot be null'); + } + $this->container['primary_scenario'] = $primary_scenario; + + return $this; + } + + /** + * Gets transaction_accounts + * + * @return \OpenAPI\Client\Model\TransactionAccount[]|null + */ + public function getTransactionAccounts() + { + return $this->container['transaction_accounts']; + } + + /** + * Sets transaction_accounts + * + * @param \OpenAPI\Client\Model\TransactionAccount[]|null $transaction_accounts All transaction accounts that compose the account, including the primary. + * + * @return self + */ + public function setTransactionAccounts($transaction_accounts) + { + if (is_null($transaction_accounts)) { + throw new \InvalidArgumentException('non-nullable transaction_accounts cannot be null'); + } + $this->container['transaction_accounts'] = $transaction_accounts; + + return $this; + } + + /** + * Gets scenarios + * + * @return \OpenAPI\Client\Model\Scenario[]|null + */ + public function getScenarios() + { + return $this->container['scenarios']; + } + + /** + * Sets scenarios + * + * @param \OpenAPI\Client\Model\Scenario[]|null $scenarios All scenarios that compose the account, including the primary. + * + * @return self + */ + public function setScenarios($scenarios) + { + if (is_null($scenarios)) { + throw new \InvalidArgumentException('non-nullable scenarios cannot be null'); + } + $this->container['scenarios'] = $scenarios; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at When the account was created. + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at When the account was last updated. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets current_balance + * + * @return float|null + */ + public function getCurrentBalance() + { + return $this->container['current_balance']; + } + + /** + * Sets current_balance + * + * @param float|null $current_balance The current balance of the account. + * + * @return self + */ + public function setCurrentBalance($current_balance) + { + if (is_null($current_balance)) { + throw new \InvalidArgumentException('non-nullable current_balance cannot be null'); + } + $this->container['current_balance'] = $current_balance; + + return $this; + } + + /** + * Gets current_balance_date + * + * @return string|null + */ + public function getCurrentBalanceDate() + { + return $this->container['current_balance_date']; + } + + /** + * Sets current_balance_date + * + * @param string|null $current_balance_date The date of the current balance. + * + * @return self + */ + public function setCurrentBalanceDate($current_balance_date) + { + if (is_null($current_balance_date)) { + throw new \InvalidArgumentException('non-nullable current_balance_date cannot be null'); + } + $this->container['current_balance_date'] = $current_balance_date; + + return $this; + } + + /** + * Gets current_balance_in_base_currency + * + * @return float|null + */ + public function getCurrentBalanceInBaseCurrency() + { + return $this->container['current_balance_in_base_currency']; + } + + /** + * Sets current_balance_in_base_currency + * + * @param float|null $current_balance_in_base_currency The current balance of the account in the user's base currency. + * + * @return self + */ + public function setCurrentBalanceInBaseCurrency($current_balance_in_base_currency) + { + if (is_null($current_balance_in_base_currency)) { + throw new \InvalidArgumentException('non-nullable current_balance_in_base_currency cannot be null'); + } + $this->container['current_balance_in_base_currency'] = $current_balance_in_base_currency; + + return $this; + } + + /** + * Gets current_balance_exchange_rate + * + * @return float|null + */ + public function getCurrentBalanceExchangeRate() + { + return $this->container['current_balance_exchange_rate']; + } + + /** + * Sets current_balance_exchange_rate + * + * @param float|null $current_balance_exchange_rate The exchange rate between the account's currency and the user's base currency, when different. If the currencies are the same, null is returned. + * + * @return self + */ + public function setCurrentBalanceExchangeRate($current_balance_exchange_rate) + { + if (is_null($current_balance_exchange_rate)) { + throw new \InvalidArgumentException('non-nullable current_balance_exchange_rate cannot be null'); + } + $this->container['current_balance_exchange_rate'] = $current_balance_exchange_rate; + + return $this; + } + + /** + * Gets safe_balance + * + * @return float|null + */ + public function getSafeBalance() + { + return $this->container['safe_balance']; + } + + /** + * Sets safe_balance + * + * @param float|null $safe_balance The current safe balance, if safe balance is activated on the account. If safe balance is not activated, then null is returned. + * + * @return self + */ + public function setSafeBalance($safe_balance) + { + if (is_null($safe_balance)) { + throw new \InvalidArgumentException('non-nullable safe_balance cannot be null'); + } + $this->container['safe_balance'] = $safe_balance; + + return $this; + } + + /** + * Gets safe_balance_in_base_currency + * + * @return float|null + */ + public function getSafeBalanceInBaseCurrency() + { + return $this->container['safe_balance_in_base_currency']; + } + + /** + * Sets safe_balance_in_base_currency + * + * @param float|null $safe_balance_in_base_currency The current safe balance in the user's base currency, if safe balance is activated on the account. If safe balance is not activated, then null is returned. + * + * @return self + */ + public function setSafeBalanceInBaseCurrency($safe_balance_in_base_currency) + { + if (is_null($safe_balance_in_base_currency)) { + throw new \InvalidArgumentException('non-nullable safe_balance_in_base_currency cannot be null'); + } + $this->container['safe_balance_in_base_currency'] = $safe_balance_in_base_currency; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/AccountsIdPutRequest.php b/lib/Model/AccountsIdPutRequest.php new file mode 100644 index 0000000..27e3bdf --- /dev/null +++ b/lib/Model/AccountsIdPutRequest.php @@ -0,0 +1,564 @@ + + */ +class AccountsIdPutRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_accounts__id__put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => 'string', + 'currency_code' => 'string', + 'type' => 'string', + 'is_net_worth' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'currency_code' => null, + 'type' => null, + 'is_net_worth' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'currency_code' => false, + 'type' => false, + 'is_net_worth' => 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 = [ + 'title' => 'title', + 'currency_code' => 'currency_code', + 'type' => 'type', + 'is_net_worth' => 'is_net_worth' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'currency_code' => 'setCurrencyCode', + 'type' => 'setType', + 'is_net_worth' => 'setIsNetWorth' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'currency_code' => 'getCurrencyCode', + 'type' => 'getType', + 'is_net_worth' => 'getIsNetWorth' + ]; + + /** + * 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; + } + + public const TYPE_BANK = 'bank'; + public const TYPE_CREDITS = 'credits'; + public const TYPE_CASH = 'cash'; + public const TYPE_LOANS = 'loans'; + public const TYPE_MORTGAGE = 'mortgage'; + public const TYPE_STOCKS = 'stocks'; + public const TYPE_VEHICLE = 'vehicle'; + public const TYPE_PROPERTY = 'property'; + public const TYPE_INSURANCE = 'insurance'; + public const TYPE_OTHER_ASSET = 'other_asset'; + public const TYPE_OTHER_LIABILITY = 'other_liability'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_BANK, + self::TYPE_CREDITS, + self::TYPE_CASH, + self::TYPE_LOANS, + self::TYPE_MORTGAGE, + self::TYPE_STOCKS, + self::TYPE_VEHICLE, + self::TYPE_PROPERTY, + self::TYPE_INSURANCE, + self::TYPE_OTHER_ASSET, + self::TYPE_OTHER_LIABILITY, + ]; + } + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('currency_code', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('is_net_worth', $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 = []; + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + 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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title A new title for the account. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets currency_code + * + * @return string|null + */ + public function getCurrencyCode() + { + return $this->container['currency_code']; + } + + /** + * Sets currency_code + * + * @param string|null $currency_code A new currency code for the account. + * + * @return self + */ + public function setCurrencyCode($currency_code) + { + if (is_null($currency_code)) { + throw new \InvalidArgumentException('non-nullable currency_code cannot be null'); + } + $this->container['currency_code'] = $currency_code; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of the account. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets is_net_worth + * + * @return bool|null + */ + public function getIsNetWorth() + { + return $this->container['is_net_worth']; + } + + /** + * Sets is_net_worth + * + * @param bool|null $is_net_worth Whether the account is a net worth account. + * + * @return self + */ + public function setIsNetWorth($is_net_worth) + { + if (is_null($is_net_worth)) { + throw new \InvalidArgumentException('non-nullable is_net_worth cannot be null'); + } + $this->container['is_net_worth'] = $is_net_worth; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Attachment.php b/lib/Model/Attachment.php new file mode 100644 index 0000000..78fa5e8 --- /dev/null +++ b/lib/Model/Attachment.php @@ -0,0 +1,716 @@ + + */ +class Attachment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Attachment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'title' => 'string', + 'file_name' => 'string', + 'type' => 'string', + 'content_type' => 'string', + 'content_type_meta' => '\OpenAPI\Client\Model\AttachmentContentTypeMeta', + 'original_url' => 'string', + 'variants' => '\OpenAPI\Client\Model\AttachmentVariants', + 'created_at' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'file_name' => null, + 'type' => null, + 'content_type' => null, + 'content_type_meta' => null, + 'original_url' => null, + 'variants' => null, + 'created_at' => 'ISO 8601 timestamp', + 'updated_at' => 'ISO 8601 timestamp' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'title' => false, + 'file_name' => false, + 'type' => false, + 'content_type' => false, + 'content_type_meta' => false, + 'original_url' => false, + 'variants' => false, + 'created_at' => false, + 'updated_at' => 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', + 'title' => 'title', + 'file_name' => 'file_name', + 'type' => 'type', + 'content_type' => 'content_type', + 'content_type_meta' => 'content_type_meta', + 'original_url' => 'original_url', + 'variants' => 'variants', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'file_name' => 'setFileName', + 'type' => 'setType', + 'content_type' => 'setContentType', + 'content_type_meta' => 'setContentTypeMeta', + 'original_url' => 'setOriginalUrl', + 'variants' => 'setVariants', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'file_name' => 'getFileName', + 'type' => 'getType', + 'content_type' => 'getContentType', + 'content_type_meta' => 'getContentTypeMeta', + 'original_url' => 'getOriginalUrl', + 'variants' => 'getVariants', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('file_name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('content_type', $data ?? [], null); + $this->setIfExists('content_type_meta', $data ?? [], null); + $this->setIfExists('original_url', $data ?? [], null); + $this->setIfExists('variants', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $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 unique identifier of the attachment + * + * @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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the attachment. If blank or not provided, the title will be derived from the file name. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets file_name + * + * @return string|null + */ + public function getFileName() + { + return $this->container['file_name']; + } + + /** + * Sets file_name + * + * @param string|null $file_name The file name of the attachment. + * + * @return self + */ + public function setFileName($file_name) + { + if (is_null($file_name)) { + throw new \InvalidArgumentException('non-nullable file_name cannot be null'); + } + $this->container['file_name'] = $file_name; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of attachment. + * + * @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 content_type + * + * @return string|null + */ + public function getContentType() + { + return $this->container['content_type']; + } + + /** + * Sets content_type + * + * @param string|null $content_type The content type of the attachment. + * + * @return self + */ + public function setContentType($content_type) + { + if (is_null($content_type)) { + throw new \InvalidArgumentException('non-nullable content_type cannot be null'); + } + $this->container['content_type'] = $content_type; + + return $this; + } + + /** + * Gets content_type_meta + * + * @return \OpenAPI\Client\Model\AttachmentContentTypeMeta|null + */ + public function getContentTypeMeta() + { + return $this->container['content_type_meta']; + } + + /** + * Sets content_type_meta + * + * @param \OpenAPI\Client\Model\AttachmentContentTypeMeta|null $content_type_meta content_type_meta + * + * @return self + */ + public function setContentTypeMeta($content_type_meta) + { + if (is_null($content_type_meta)) { + throw new \InvalidArgumentException('non-nullable content_type_meta cannot be null'); + } + $this->container['content_type_meta'] = $content_type_meta; + + return $this; + } + + /** + * Gets original_url + * + * @return string|null + */ + public function getOriginalUrl() + { + return $this->container['original_url']; + } + + /** + * Sets original_url + * + * @param string|null $original_url The url of the attachment. + * + * @return self + */ + public function setOriginalUrl($original_url) + { + if (is_null($original_url)) { + throw new \InvalidArgumentException('non-nullable original_url cannot be null'); + } + $this->container['original_url'] = $original_url; + + return $this; + } + + /** + * Gets variants + * + * @return \OpenAPI\Client\Model\AttachmentVariants|null + */ + public function getVariants() + { + return $this->container['variants']; + } + + /** + * Sets variants + * + * @param \OpenAPI\Client\Model\AttachmentVariants|null $variants variants + * + * @return self + */ + public function setVariants($variants) + { + if (is_null($variants)) { + throw new \InvalidArgumentException('non-nullable variants cannot be null'); + } + $this->container['variants'] = $variants; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at When the attachment was created. + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at When the attachment was last updated. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/AttachmentContentTypeMeta.php b/lib/Model/AttachmentContentTypeMeta.php new file mode 100644 index 0000000..43e4096 --- /dev/null +++ b/lib/Model/AttachmentContentTypeMeta.php @@ -0,0 +1,478 @@ + + */ +class AttachmentContentTypeMeta implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Attachment_content_type_meta'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => 'string', + 'description' => 'string', + 'extension' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'description' => null, + 'extension' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'description' => false, + 'extension' => 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 = [ + 'title' => 'title', + 'description' => 'description', + 'extension' => 'extension' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'description' => 'setDescription', + 'extension' => 'setExtension' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'description' => 'getDescription', + 'extension' => 'getExtension' + ]; + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('extension', $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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The content type title of the attachment. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description The content type description of the attachment. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets extension + * + * @return string|null + */ + public function getExtension() + { + return $this->container['extension']; + } + + /** + * Sets extension + * + * @param string|null $extension The extension type of the attachment. + * + * @return self + */ + public function setExtension($extension) + { + if (is_null($extension)) { + throw new \InvalidArgumentException('non-nullable extension cannot be null'); + } + $this->container['extension'] = $extension; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/AttachmentVariants.php b/lib/Model/AttachmentVariants.php new file mode 100644 index 0000000..c6a1b94 --- /dev/null +++ b/lib/Model/AttachmentVariants.php @@ -0,0 +1,444 @@ + + */ +class AttachmentVariants implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Attachment_variants'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'large_url' => 'string', + 'thumb_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'large_url' => null, + 'thumb_url' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'large_url' => false, + 'thumb_url' => 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 = [ + 'large_url' => 'large_url', + 'thumb_url' => 'thumb_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'large_url' => 'setLargeUrl', + 'thumb_url' => 'setThumbUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'large_url' => 'getLargeUrl', + 'thumb_url' => 'getThumbUrl' + ]; + + /** + * 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('large_url', $data ?? [], null); + $this->setIfExists('thumb_url', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets large_url + * + * @return string|null + */ + public function getLargeUrl() + { + return $this->container['large_url']; + } + + /** + * Sets large_url + * + * @param string|null $large_url The url of the large version of the attachment. + * + * @return self + */ + public function setLargeUrl($large_url) + { + if (is_null($large_url)) { + throw new \InvalidArgumentException('non-nullable large_url cannot be null'); + } + $this->container['large_url'] = $large_url; + + return $this; + } + + /** + * Gets thumb_url + * + * @return string|null + */ + public function getThumbUrl() + { + return $this->container['thumb_url']; + } + + /** + * Sets thumb_url + * + * @param string|null $thumb_url The url of the thumb version of the attachment. + * + * @return self + */ + public function setThumbUrl($thumb_url) + { + if (is_null($thumb_url)) { + throw new \InvalidArgumentException('non-nullable thumb_url cannot be null'); + } + $this->container['thumb_url'] = $thumb_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/AttachmentsIdPutRequest.php b/lib/Model/AttachmentsIdPutRequest.php new file mode 100644 index 0000000..f61812b --- /dev/null +++ b/lib/Model/AttachmentsIdPutRequest.php @@ -0,0 +1,410 @@ + + */ +class AttachmentsIdPutRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_attachments__id__put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => 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 = [ + 'title' => 'title' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle' + ]; + + /** + * 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('title', $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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The new title of the attachment. If the title is blank or not provided, the server will derive a title from the file name. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/BudgetAnalysis.php b/lib/Model/BudgetAnalysis.php new file mode 100644 index 0000000..093ef6e --- /dev/null +++ b/lib/Model/BudgetAnalysis.php @@ -0,0 +1,716 @@ + + */ +class BudgetAnalysis implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BudgetAnalysis'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'start_date' => 'string', + 'end_date' => 'string', + 'currency_code' => 'string', + 'total_actual_amount' => 'float', + 'average_actual_amount' => 'float', + 'total_forecast_amount' => 'float', + 'average_forecast_amount' => 'float', + 'total_over_by' => 'float', + 'total_under_by' => 'float', + 'periods' => '\OpenAPI\Client\Model\Period[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'start_date' => null, + 'end_date' => null, + 'currency_code' => null, + 'total_actual_amount' => null, + 'average_actual_amount' => null, + 'total_forecast_amount' => null, + 'average_forecast_amount' => null, + 'total_over_by' => null, + 'total_under_by' => null, + 'periods' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start_date' => false, + 'end_date' => false, + 'currency_code' => false, + 'total_actual_amount' => false, + 'average_actual_amount' => false, + 'total_forecast_amount' => false, + 'average_forecast_amount' => false, + 'total_over_by' => false, + 'total_under_by' => false, + 'periods' => 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 = [ + 'start_date' => 'start_date', + 'end_date' => 'end_date', + 'currency_code' => 'currency_code', + 'total_actual_amount' => 'total_actual_amount', + 'average_actual_amount' => 'average_actual_amount', + 'total_forecast_amount' => 'total_forecast_amount', + 'average_forecast_amount' => 'average_forecast_amount', + 'total_over_by' => 'total_over_by', + 'total_under_by' => 'total_under_by', + 'periods' => 'periods' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'start_date' => 'setStartDate', + 'end_date' => 'setEndDate', + 'currency_code' => 'setCurrencyCode', + 'total_actual_amount' => 'setTotalActualAmount', + 'average_actual_amount' => 'setAverageActualAmount', + 'total_forecast_amount' => 'setTotalForecastAmount', + 'average_forecast_amount' => 'setAverageForecastAmount', + 'total_over_by' => 'setTotalOverBy', + 'total_under_by' => 'setTotalUnderBy', + 'periods' => 'setPeriods' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'start_date' => 'getStartDate', + 'end_date' => 'getEndDate', + 'currency_code' => 'getCurrencyCode', + 'total_actual_amount' => 'getTotalActualAmount', + 'average_actual_amount' => 'getAverageActualAmount', + 'total_forecast_amount' => 'getTotalForecastAmount', + 'average_forecast_amount' => 'getAverageForecastAmount', + 'total_over_by' => 'getTotalOverBy', + 'total_under_by' => 'getTotalUnderBy', + 'periods' => 'getPeriods' + ]; + + /** + * 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('start_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('currency_code', $data ?? [], null); + $this->setIfExists('total_actual_amount', $data ?? [], null); + $this->setIfExists('average_actual_amount', $data ?? [], null); + $this->setIfExists('total_forecast_amount', $data ?? [], null); + $this->setIfExists('average_forecast_amount', $data ?? [], null); + $this->setIfExists('total_over_by', $data ?? [], null); + $this->setIfExists('total_under_by', $data ?? [], null); + $this->setIfExists('periods', $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 start_date + * + * @return string|null + */ + public function getStartDate() + { + return $this->container['start_date']; + } + + /** + * Sets start_date + * + * @param string|null $start_date The start date of the budget analysis. + * + * @return self + */ + public function setStartDate($start_date) + { + if (is_null($start_date)) { + throw new \InvalidArgumentException('non-nullable start_date cannot be null'); + } + $this->container['start_date'] = $start_date; + + return $this; + } + + /** + * Gets end_date + * + * @return string|null + */ + public function getEndDate() + { + return $this->container['end_date']; + } + + /** + * Sets end_date + * + * @param string|null $end_date The end date of the budget analysis. + * + * @return self + */ + public function setEndDate($end_date) + { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } + $this->container['end_date'] = $end_date; + + return $this; + } + + /** + * Gets currency_code + * + * @return string|null + */ + public function getCurrencyCode() + { + return $this->container['currency_code']; + } + + /** + * Sets currency_code + * + * @param string|null $currency_code The currency of the budget analysis. + * + * @return self + */ + public function setCurrencyCode($currency_code) + { + if (is_null($currency_code)) { + throw new \InvalidArgumentException('non-nullable currency_code cannot be null'); + } + $this->container['currency_code'] = $currency_code; + + return $this; + } + + /** + * Gets total_actual_amount + * + * @return float|null + */ + public function getTotalActualAmount() + { + return $this->container['total_actual_amount']; + } + + /** + * Sets total_actual_amount + * + * @param float|null $total_actual_amount The total actual (transactions) amount across all periods. + * + * @return self + */ + public function setTotalActualAmount($total_actual_amount) + { + if (is_null($total_actual_amount)) { + throw new \InvalidArgumentException('non-nullable total_actual_amount cannot be null'); + } + $this->container['total_actual_amount'] = $total_actual_amount; + + return $this; + } + + /** + * Gets average_actual_amount + * + * @return float|null + */ + public function getAverageActualAmount() + { + return $this->container['average_actual_amount']; + } + + /** + * Sets average_actual_amount + * + * @param float|null $average_actual_amount The average actual (transactions) amount across all periods. + * + * @return self + */ + public function setAverageActualAmount($average_actual_amount) + { + if (is_null($average_actual_amount)) { + throw new \InvalidArgumentException('non-nullable average_actual_amount cannot be null'); + } + $this->container['average_actual_amount'] = $average_actual_amount; + + return $this; + } + + /** + * Gets total_forecast_amount + * + * @return float|null + */ + public function getTotalForecastAmount() + { + return $this->container['total_forecast_amount']; + } + + /** + * Sets total_forecast_amount + * + * @param float|null $total_forecast_amount The total budgeted amount across all periods. + * + * @return self + */ + public function setTotalForecastAmount($total_forecast_amount) + { + if (is_null($total_forecast_amount)) { + throw new \InvalidArgumentException('non-nullable total_forecast_amount cannot be null'); + } + $this->container['total_forecast_amount'] = $total_forecast_amount; + + return $this; + } + + /** + * Gets average_forecast_amount + * + * @return float|null + */ + public function getAverageForecastAmount() + { + return $this->container['average_forecast_amount']; + } + + /** + * Sets average_forecast_amount + * + * @param float|null $average_forecast_amount The average budgeted amount across all periods. + * + * @return self + */ + public function setAverageForecastAmount($average_forecast_amount) + { + if (is_null($average_forecast_amount)) { + throw new \InvalidArgumentException('non-nullable average_forecast_amount cannot be null'); + } + $this->container['average_forecast_amount'] = $average_forecast_amount; + + return $this; + } + + /** + * Gets total_over_by + * + * @return float|null + */ + public function getTotalOverBy() + { + return $this->container['total_over_by']; + } + + /** + * Sets total_over_by + * + * @param float|null $total_over_by The total amount the budget was exceeded across all periods. + * + * @return self + */ + public function setTotalOverBy($total_over_by) + { + if (is_null($total_over_by)) { + throw new \InvalidArgumentException('non-nullable total_over_by cannot be null'); + } + $this->container['total_over_by'] = $total_over_by; + + return $this; + } + + /** + * Gets total_under_by + * + * @return float|null + */ + public function getTotalUnderBy() + { + return $this->container['total_under_by']; + } + + /** + * Sets total_under_by + * + * @param float|null $total_under_by The total amount the budget was under by across all periods. + * + * @return self + */ + public function setTotalUnderBy($total_under_by) + { + if (is_null($total_under_by)) { + throw new \InvalidArgumentException('non-nullable total_under_by cannot be null'); + } + $this->container['total_under_by'] = $total_under_by; + + return $this; + } + + /** + * Gets periods + * + * @return \OpenAPI\Client\Model\Period[]|null + */ + public function getPeriods() + { + return $this->container['periods']; + } + + /** + * Sets periods + * + * @param \OpenAPI\Client\Model\Period[]|null $periods The period analyses that this budget analysis comprises. + * + * @return self + */ + public function setPeriods($periods) + { + if (is_null($periods)) { + throw new \InvalidArgumentException('non-nullable periods cannot be null'); + } + $this->container['periods'] = $periods; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/BudgetAnalysisPackage.php b/lib/Model/BudgetAnalysisPackage.php new file mode 100644 index 0000000..66be30b --- /dev/null +++ b/lib/Model/BudgetAnalysisPackage.php @@ -0,0 +1,512 @@ + + */ +class BudgetAnalysisPackage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BudgetAnalysisPackage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => '\OpenAPI\Client\Model\Category', + 'is_transfer' => 'bool', + 'expense' => '\OpenAPI\Client\Model\BudgetAnalysis', + 'income' => '\OpenAPI\Client\Model\BudgetAnalysis' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'is_transfer' => null, + 'expense' => null, + 'income' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'category' => false, + 'is_transfer' => false, + 'expense' => false, + 'income' => 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 = [ + 'category' => 'category', + 'is_transfer' => 'is_transfer', + 'expense' => 'expense', + 'income' => 'income' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'is_transfer' => 'setIsTransfer', + 'expense' => 'setExpense', + 'income' => 'setIncome' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'is_transfer' => 'getIsTransfer', + 'expense' => 'getExpense', + 'income' => 'getIncome' + ]; + + /** + * 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('category', $data ?? [], null); + $this->setIfExists('is_transfer', $data ?? [], null); + $this->setIfExists('expense', $data ?? [], null); + $this->setIfExists('income', $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 category + * + * @return \OpenAPI\Client\Model\Category|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param \OpenAPI\Client\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 is_transfer + * + * @return bool|null + */ + public function getIsTransfer() + { + return $this->container['is_transfer']; + } + + /** + * Sets is_transfer + * + * @param bool|null $is_transfer Whether the expense budget analysis looks like a transfer to the income budget analysis, based on a number of heuristics. + * + * @return self + */ + public function setIsTransfer($is_transfer) + { + if (is_null($is_transfer)) { + throw new \InvalidArgumentException('non-nullable is_transfer cannot be null'); + } + $this->container['is_transfer'] = $is_transfer; + + return $this; + } + + /** + * Gets expense + * + * @return \OpenAPI\Client\Model\BudgetAnalysis|null + */ + public function getExpense() + { + return $this->container['expense']; + } + + /** + * Sets expense + * + * @param \OpenAPI\Client\Model\BudgetAnalysis|null $expense expense + * + * @return self + */ + public function setExpense($expense) + { + if (is_null($expense)) { + throw new \InvalidArgumentException('non-nullable expense cannot be null'); + } + $this->container['expense'] = $expense; + + return $this; + } + + /** + * Gets income + * + * @return \OpenAPI\Client\Model\BudgetAnalysis|null + */ + public function getIncome() + { + return $this->container['income']; + } + + /** + * Sets income + * + * @param \OpenAPI\Client\Model\BudgetAnalysis|null $income income + * + * @return self + */ + public function setIncome($income) + { + if (is_null($income)) { + throw new \InvalidArgumentException('non-nullable income cannot be null'); + } + $this->container['income'] = $income; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CategoriesIdCategoryRulesPostRequest.php b/lib/Model/CategoriesIdCategoryRulesPostRequest.php new file mode 100644 index 0000000..deaa0c6 --- /dev/null +++ b/lib/Model/CategoriesIdCategoryRulesPostRequest.php @@ -0,0 +1,481 @@ + + */ +class CategoriesIdCategoryRulesPostRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_categories__id__category_rules_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'payee_matches' => 'string', + 'apply_to_uncategorised' => 'bool', + 'apply_to_all' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'payee_matches' => null, + 'apply_to_uncategorised' => null, + 'apply_to_all' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payee_matches' => false, + 'apply_to_uncategorised' => false, + 'apply_to_all' => 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 = [ + 'payee_matches' => 'payee_matches', + 'apply_to_uncategorised' => 'apply_to_uncategorised', + 'apply_to_all' => 'apply_to_all' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'payee_matches' => 'setPayeeMatches', + 'apply_to_uncategorised' => 'setApplyToUncategorised', + 'apply_to_all' => 'setApplyToAll' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'payee_matches' => 'getPayeeMatches', + 'apply_to_uncategorised' => 'getApplyToUncategorised', + 'apply_to_all' => 'getApplyToAll' + ]; + + /** + * 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('payee_matches', $data ?? [], null); + $this->setIfExists('apply_to_uncategorised', $data ?? [], null); + $this->setIfExists('apply_to_all', $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['payee_matches'] === null) { + $invalidProperties[] = "'payee_matches' 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 payee_matches + * + * @return string + */ + public function getPayeeMatches() + { + return $this->container['payee_matches']; + } + + /** + * Sets payee_matches + * + * @param string $payee_matches The keyword/s to match the transaction payees. + * + * @return self + */ + public function setPayeeMatches($payee_matches) + { + if (is_null($payee_matches)) { + throw new \InvalidArgumentException('non-nullable payee_matches cannot be null'); + } + $this->container['payee_matches'] = $payee_matches; + + return $this; + } + + /** + * Gets apply_to_uncategorised + * + * @return bool|null + */ + public function getApplyToUncategorised() + { + return $this->container['apply_to_uncategorised']; + } + + /** + * Sets apply_to_uncategorised + * + * @param bool|null $apply_to_uncategorised Apply the created category rule to all uncategorised transactions. + * + * @return self + */ + public function setApplyToUncategorised($apply_to_uncategorised) + { + if (is_null($apply_to_uncategorised)) { + throw new \InvalidArgumentException('non-nullable apply_to_uncategorised cannot be null'); + } + $this->container['apply_to_uncategorised'] = $apply_to_uncategorised; + + return $this; + } + + /** + * Gets apply_to_all + * + * @return bool|null + */ + public function getApplyToAll() + { + return $this->container['apply_to_all']; + } + + /** + * Sets apply_to_all + * + * @param bool|null $apply_to_all Apply the created category rule to all transactions. + * + * @return self + */ + public function setApplyToAll($apply_to_all) + { + if (is_null($apply_to_all)) { + throw new \InvalidArgumentException('non-nullable apply_to_all cannot be null'); + } + $this->container['apply_to_all'] = $apply_to_all; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CategoriesIdPutRequest.php b/lib/Model/CategoriesIdPutRequest.php new file mode 100644 index 0000000..08a590d --- /dev/null +++ b/lib/Model/CategoriesIdPutRequest.php @@ -0,0 +1,657 @@ + + */ +class CategoriesIdPutRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_categories__id__put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => 'string', + 'colour' => 'string', + 'parent_id' => 'int', + 'is_transfer' => 'bool', + 'is_bill' => 'bool', + 'roll_up' => 'bool', + 'refund_behaviour' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'colour' => null, + 'parent_id' => null, + 'is_transfer' => null, + 'is_bill' => null, + 'roll_up' => null, + 'refund_behaviour' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'colour' => false, + 'parent_id' => false, + 'is_transfer' => false, + 'is_bill' => false, + 'roll_up' => false, + 'refund_behaviour' => 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 = [ + 'title' => 'title', + 'colour' => 'colour', + 'parent_id' => 'parent_id', + 'is_transfer' => 'is_transfer', + 'is_bill' => 'is_bill', + 'roll_up' => 'roll_up', + 'refund_behaviour' => 'refund_behaviour' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'colour' => 'setColour', + 'parent_id' => 'setParentId', + 'is_transfer' => 'setIsTransfer', + 'is_bill' => 'setIsBill', + 'roll_up' => 'setRollUp', + 'refund_behaviour' => 'setRefundBehaviour' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'colour' => 'getColour', + 'parent_id' => 'getParentId', + 'is_transfer' => 'getIsTransfer', + 'is_bill' => 'getIsBill', + 'roll_up' => 'getRollUp', + 'refund_behaviour' => 'getRefundBehaviour' + ]; + + /** + * 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; + } + + public const REFUND_BEHAVIOUR_DEBITS_ARE_DEDUCTIONS = 'debits_are_deductions'; + public const REFUND_BEHAVIOUR_CREDITS_ARE_REFUNDS = 'credits_are_refunds'; + public const REFUND_BEHAVIOUR_NULL = 'null'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRefundBehaviourAllowableValues() + { + return [ + self::REFUND_BEHAVIOUR_DEBITS_ARE_DEDUCTIONS, + self::REFUND_BEHAVIOUR_CREDITS_ARE_REFUNDS, + self::REFUND_BEHAVIOUR_NULL, + ]; + } + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('colour', $data ?? [], null); + $this->setIfExists('parent_id', $data ?? [], null); + $this->setIfExists('is_transfer', $data ?? [], null); + $this->setIfExists('is_bill', $data ?? [], null); + $this->setIfExists('roll_up', $data ?? [], null); + $this->setIfExists('refund_behaviour', $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 = []; + + $allowedValues = $this->getRefundBehaviourAllowableValues(); + if (!is_null($this->container['refund_behaviour']) && !in_array($this->container['refund_behaviour'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'refund_behaviour', must be one of '%s'", + $this->container['refund_behaviour'], + implode("', '", $allowedValues) + ); + } + + 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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title A new title for the category. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets colour + * + * @return string|null + */ + public function getColour() + { + return $this->container['colour']; + } + + /** + * Sets colour + * + * @param string|null $colour A new CSS-style hex colour for the category. + * + * @return self + */ + public function setColour($colour) + { + if (is_null($colour)) { + throw new \InvalidArgumentException('non-nullable colour cannot be null'); + } + $this->container['colour'] = $colour; + + return $this; + } + + /** + * Gets parent_id + * + * @return int|null + */ + public function getParentId() + { + return $this->container['parent_id']; + } + + /** + * Sets parent_id + * + * @param int|null $parent_id The unique identifier of a parent category for the category, making this category a child of that category. + * + * @return self + */ + public function setParentId($parent_id) + { + if (is_null($parent_id)) { + throw new \InvalidArgumentException('non-nullable parent_id cannot be null'); + } + $this->container['parent_id'] = $parent_id; + + return $this; + } + + /** + * Gets is_transfer + * + * @return bool|null + */ + public function getIsTransfer() + { + return $this->container['is_transfer']; + } + + /** + * Sets is_transfer + * + * @param bool|null $is_transfer Set the category as a transfer category. + * + * @return self + */ + public function setIsTransfer($is_transfer) + { + if (is_null($is_transfer)) { + throw new \InvalidArgumentException('non-nullable is_transfer cannot be null'); + } + $this->container['is_transfer'] = $is_transfer; + + return $this; + } + + /** + * Gets is_bill + * + * @return bool|null + */ + public function getIsBill() + { + return $this->container['is_bill']; + } + + /** + * Sets is_bill + * + * @param bool|null $is_bill Set the category as a bill category. + * + * @return self + */ + public function setIsBill($is_bill) + { + if (is_null($is_bill)) { + throw new \InvalidArgumentException('non-nullable is_bill cannot be null'); + } + $this->container['is_bill'] = $is_bill; + + return $this; + } + + /** + * Gets roll_up + * + * @return bool|null + */ + public function getRollUp() + { + return $this->container['roll_up']; + } + + /** + * Sets roll_up + * + * @param bool|null $roll_up Set the category to be rolled up into its parent category. + * + * @return self + */ + public function setRollUp($roll_up) + { + if (is_null($roll_up)) { + throw new \InvalidArgumentException('non-nullable roll_up cannot be null'); + } + $this->container['roll_up'] = $roll_up; + + return $this; + } + + /** + * Gets refund_behaviour + * + * @return string|null + */ + public function getRefundBehaviour() + { + return $this->container['refund_behaviour']; + } + + /** + * Sets refund_behaviour + * + * @param string|null $refund_behaviour Set the refund behaviour of the category. + * + * @return self + */ + public function setRefundBehaviour($refund_behaviour) + { + if (is_null($refund_behaviour)) { + array_push($this->openAPINullablesSetToNull, 'refund_behaviour'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('refund_behaviour', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRefundBehaviourAllowableValues(); + if (!is_null($refund_behaviour) && !in_array($refund_behaviour, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'refund_behaviour', must be one of '%s'", + $refund_behaviour, + implode("', '", $allowedValues) + ) + ); + } + $this->container['refund_behaviour'] = $refund_behaviour; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Category.php b/lib/Model/Category.php new file mode 100644 index 0000000..dc0fa7f --- /dev/null +++ b/lib/Model/Category.php @@ -0,0 +1,793 @@ + + */ +class Category implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Category'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'title' => 'string', + 'colour' => 'string', + 'children' => '\OpenAPI\Client\Model\Category[]', + 'parent_id' => 'int', + 'is_transfer' => 'bool', + 'is_bill' => 'bool', + 'roll_up' => 'bool', + 'refund_behaviour' => 'string', + 'created_at' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'colour' => 'CSS-style hex triplet', + 'children' => null, + 'parent_id' => null, + 'is_transfer' => null, + 'is_bill' => null, + 'roll_up' => null, + 'refund_behaviour' => null, + 'created_at' => 'ISO 8601 timestamp', + 'updated_at' => 'ISO 8601 timestamp' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'title' => false, + 'colour' => false, + 'children' => false, + 'parent_id' => false, + 'is_transfer' => false, + 'is_bill' => false, + 'roll_up' => false, + 'refund_behaviour' => true, + 'created_at' => false, + 'updated_at' => 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', + 'title' => 'title', + 'colour' => 'colour', + 'children' => 'children', + 'parent_id' => 'parent_id', + 'is_transfer' => 'is_transfer', + 'is_bill' => 'is_bill', + 'roll_up' => 'roll_up', + 'refund_behaviour' => 'refund_behaviour', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'colour' => 'setColour', + 'children' => 'setChildren', + 'parent_id' => 'setParentId', + 'is_transfer' => 'setIsTransfer', + 'is_bill' => 'setIsBill', + 'roll_up' => 'setRollUp', + 'refund_behaviour' => 'setRefundBehaviour', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'colour' => 'getColour', + 'children' => 'getChildren', + 'parent_id' => 'getParentId', + 'is_transfer' => 'getIsTransfer', + 'is_bill' => 'getIsBill', + 'roll_up' => 'getRollUp', + 'refund_behaviour' => 'getRefundBehaviour', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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; + } + + public const REFUND_BEHAVIOUR_DEBITS_ARE_DEDUCTIONS = 'debits_are_deductions'; + public const REFUND_BEHAVIOUR_CREDITS_ARE_REFUNDS = 'credits_are_refunds'; + public const REFUND_BEHAVIOUR_NULL = 'null'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRefundBehaviourAllowableValues() + { + return [ + self::REFUND_BEHAVIOUR_DEBITS_ARE_DEDUCTIONS, + self::REFUND_BEHAVIOUR_CREDITS_ARE_REFUNDS, + self::REFUND_BEHAVIOUR_NULL, + ]; + } + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('colour', $data ?? [], null); + $this->setIfExists('children', $data ?? [], null); + $this->setIfExists('parent_id', $data ?? [], null); + $this->setIfExists('is_transfer', $data ?? [], null); + $this->setIfExists('is_bill', $data ?? [], null); + $this->setIfExists('roll_up', $data ?? [], null); + $this->setIfExists('refund_behaviour', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $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 = []; + + $allowedValues = $this->getRefundBehaviourAllowableValues(); + if (!is_null($this->container['refund_behaviour']) && !in_array($this->container['refund_behaviour'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'refund_behaviour', must be one of '%s'", + $this->container['refund_behaviour'], + implode("', '", $allowedValues) + ); + } + + 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 unique identifier of the category. + * + * @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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the category. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets colour + * + * @return string|null + */ + public function getColour() + { + return $this->container['colour']; + } + + /** + * Sets colour + * + * @param string|null $colour The colour for the category. + * + * @return self + */ + public function setColour($colour) + { + if (is_null($colour)) { + throw new \InvalidArgumentException('non-nullable colour cannot be null'); + } + $this->container['colour'] = $colour; + + return $this; + } + + /** + * Gets children + * + * @return \OpenAPI\Client\Model\Category[]|null + */ + public function getChildren() + { + return $this->container['children']; + } + + /** + * Sets children + * + * @param \OpenAPI\Client\Model\Category[]|null $children The category's child categories. + * + * @return self + */ + public function setChildren($children) + { + if (is_null($children)) { + throw new \InvalidArgumentException('non-nullable children cannot be null'); + } + $this->container['children'] = $children; + + return $this; + } + + /** + * Gets parent_id + * + * @return int|null + */ + public function getParentId() + { + return $this->container['parent_id']; + } + + /** + * Sets parent_id + * + * @param int|null $parent_id The unique identifier of the parent category of this category, or null if this category has no parent (i.e. is a top-level category) + * + * @return self + */ + public function setParentId($parent_id) + { + if (is_null($parent_id)) { + throw new \InvalidArgumentException('non-nullable parent_id cannot be null'); + } + $this->container['parent_id'] = $parent_id; + + return $this; + } + + /** + * Gets is_transfer + * + * @return bool|null + */ + public function getIsTransfer() + { + return $this->container['is_transfer']; + } + + /** + * Sets is_transfer + * + * @param bool|null $is_transfer Whether this category has been marked as a transfer category. + * + * @return self + */ + public function setIsTransfer($is_transfer) + { + if (is_null($is_transfer)) { + throw new \InvalidArgumentException('non-nullable is_transfer cannot be null'); + } + $this->container['is_transfer'] = $is_transfer; + + return $this; + } + + /** + * Gets is_bill + * + * @return bool|null + */ + public function getIsBill() + { + return $this->container['is_bill']; + } + + /** + * Sets is_bill + * + * @param bool|null $is_bill Whether the category is a bill category. A bill category is when budgeted amounts are normally spent at once, instead of spread across a budgeting period. This category will be included in the bill reminder email when set to true. + * + * @return self + */ + public function setIsBill($is_bill) + { + if (is_null($is_bill)) { + throw new \InvalidArgumentException('non-nullable is_bill cannot be null'); + } + $this->container['is_bill'] = $is_bill; + + return $this; + } + + /** + * Gets roll_up + * + * @return bool|null + */ + public function getRollUp() + { + return $this->container['roll_up']; + } + + /** + * Sets roll_up + * + * @param bool|null $roll_up Whether the category's budget is rolled up into its parent category, if a parent category is present. + * + * @return self + */ + public function setRollUp($roll_up) + { + if (is_null($roll_up)) { + throw new \InvalidArgumentException('non-nullable roll_up cannot be null'); + } + $this->container['roll_up'] = $roll_up; + + return $this; + } + + /** + * Gets refund_behaviour + * + * @return string|null + */ + public function getRefundBehaviour() + { + return $this->container['refund_behaviour']; + } + + /** + * Sets refund_behaviour + * + * @param string|null $refund_behaviour How the category's refunds or deductions should be reported on. + * + * @return self + */ + public function setRefundBehaviour($refund_behaviour) + { + if (is_null($refund_behaviour)) { + array_push($this->openAPINullablesSetToNull, 'refund_behaviour'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('refund_behaviour', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRefundBehaviourAllowableValues(); + if (!is_null($refund_behaviour) && !in_array($refund_behaviour, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'refund_behaviour', must be one of '%s'", + $refund_behaviour, + implode("', '", $allowedValues) + ) + ); + } + $this->container['refund_behaviour'] = $refund_behaviour; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at When the category was created. + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at When the category was last updated. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CategoryRule.php b/lib/Model/CategoryRule.php new file mode 100644 index 0000000..2e9c54b --- /dev/null +++ b/lib/Model/CategoryRule.php @@ -0,0 +1,546 @@ + + */ +class CategoryRule implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CategoryRule'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category' => '\OpenAPI\Client\Model\Category', + 'id' => 'int', + 'payee_matches' => 'string', + 'created_at' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category' => null, + 'id' => null, + 'payee_matches' => null, + 'created_at' => 'ISO 8601 timestamp', + 'updated_at' => 'ISO 8601 timestamp' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'category' => false, + 'id' => false, + 'payee_matches' => false, + 'created_at' => false, + 'updated_at' => 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 = [ + 'category' => 'category', + 'id' => 'id', + 'payee_matches' => 'payee_matches', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'id' => 'setId', + 'payee_matches' => 'setPayeeMatches', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'id' => 'getId', + 'payee_matches' => 'getPayeeMatches', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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('category', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('payee_matches', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $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 category + * + * @return \OpenAPI\Client\Model\Category|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param \OpenAPI\Client\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 id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id The unique identifier of the category rule. + * + * @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 payee_matches + * + * @return string|null + */ + public function getPayeeMatches() + { + return $this->container['payee_matches']; + } + + /** + * Sets payee_matches + * + * @param string|null $payee_matches The keyword/s to match the transactions payees. + * + * @return self + */ + public function setPayeeMatches($payee_matches) + { + if (is_null($payee_matches)) { + throw new \InvalidArgumentException('non-nullable payee_matches cannot be null'); + } + $this->container['payee_matches'] = $payee_matches; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at When the category rule was created. + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at When the category rule was last updated. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Currency.php b/lib/Model/Currency.php new file mode 100644 index 0000000..4ea111f --- /dev/null +++ b/lib/Model/Currency.php @@ -0,0 +1,546 @@ + + */ +class Currency implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Currency'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'minor_unit' => 'int', + 'separators' => '\OpenAPI\Client\Model\CurrencySeparators', + 'symbol' => '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, + 'minor_unit' => null, + 'separators' => null, + 'symbol' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'minor_unit' => false, + 'separators' => false, + 'symbol' => 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', + 'minor_unit' => 'minor_unit', + 'separators' => 'separators', + 'symbol' => 'symbol' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'minor_unit' => 'setMinorUnit', + 'separators' => 'setSeparators', + 'symbol' => 'setSymbol' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'minor_unit' => 'getMinorUnit', + 'separators' => 'getSeparators', + 'symbol' => 'getSymbol' + ]; + + /** + * 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('minor_unit', $data ?? [], null); + $this->setIfExists('separators', $data ?? [], null); + $this->setIfExists('symbol', $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 The ISO 4217 or unofficial currency code. + * + * @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 The name of the currency. + * + * @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 minor_unit + * + * @return int|null + */ + public function getMinorUnit() + { + return $this->container['minor_unit']; + } + + /** + * Sets minor_unit + * + * @param int|null $minor_unit The number of digits after the minor unit separator. + * + * @return self + */ + public function setMinorUnit($minor_unit) + { + if (is_null($minor_unit)) { + throw new \InvalidArgumentException('non-nullable minor_unit cannot be null'); + } + $this->container['minor_unit'] = $minor_unit; + + return $this; + } + + /** + * Gets separators + * + * @return \OpenAPI\Client\Model\CurrencySeparators|null + */ + public function getSeparators() + { + return $this->container['separators']; + } + + /** + * Sets separators + * + * @param \OpenAPI\Client\Model\CurrencySeparators|null $separators separators + * + * @return self + */ + public function setSeparators($separators) + { + if (is_null($separators)) { + throw new \InvalidArgumentException('non-nullable separators cannot be null'); + } + $this->container['separators'] = $separators; + + return $this; + } + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol The symbol of the currency. + * + * @return self + */ + public function setSymbol($symbol) + { + if (is_null($symbol)) { + throw new \InvalidArgumentException('non-nullable symbol cannot be null'); + } + $this->container['symbol'] = $symbol; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CurrencySeparators.php b/lib/Model/CurrencySeparators.php new file mode 100644 index 0000000..8e3fccd --- /dev/null +++ b/lib/Model/CurrencySeparators.php @@ -0,0 +1,444 @@ + + */ +class CurrencySeparators implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CurrencySeparators'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'major' => 'string', + 'minor' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'major' => null, + 'minor' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'major' => false, + 'minor' => 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 = [ + 'major' => 'major', + 'minor' => 'minor' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'major' => 'setMajor', + 'minor' => 'setMinor' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'major' => 'getMajor', + 'minor' => 'getMinor' + ]; + + /** + * 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('major', $data ?? [], null); + $this->setIfExists('minor', $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 major + * + * @return string|null + */ + public function getMajor() + { + return $this->container['major']; + } + + /** + * Sets major + * + * @param string|null $major The separator used in the major unit. + * + * @return self + */ + public function setMajor($major) + { + if (is_null($major)) { + throw new \InvalidArgumentException('non-nullable major cannot be null'); + } + $this->container['major'] = $major; + + return $this; + } + + /** + * Gets minor + * + * @return string|null + */ + public function getMinor() + { + return $this->container['minor']; + } + + /** + * Sets minor + * + * @param string|null $minor The seperator used for the minor unit. + * + * @return self + */ + public function setMinor($minor) + { + if (is_null($minor)) { + throw new \InvalidArgumentException('non-nullable minor cannot be null'); + } + $this->container['minor'] = $minor; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Error.php b/lib/Model/Error.php new file mode 100644 index 0000000..7615c06 --- /dev/null +++ b/lib/Model/Error.php @@ -0,0 +1,410 @@ + + */ +class Error implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => 'string' + ]; + + /** + * 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 string|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error A message describing the error that occurred. + * + * @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/lib/Model/Event.php b/lib/Model/Event.php new file mode 100644 index 0000000..1d5c158 --- /dev/null +++ b/lib/Model/Event.php @@ -0,0 +1,896 @@ + + */ +class Event implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Event'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'category' => '\OpenAPI\Client\Model\Category', + 'scenario' => '\OpenAPI\Client\Model\Scenario', + 'amount' => 'float', + 'amount_in_base_currency' => 'float', + 'currency_code' => 'string', + 'date' => 'string', + 'colour' => 'string', + 'note' => 'string', + 'repeat_type' => 'string', + 'repeat_interval' => 'int', + 'series_id' => 'int', + 'series_start_id' => 'string', + 'infinite_series' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'category' => null, + 'scenario' => null, + 'amount' => null, + 'amount_in_base_currency' => null, + 'currency_code' => null, + 'date' => null, + 'colour' => null, + 'note' => null, + 'repeat_type' => null, + 'repeat_interval' => null, + 'series_id' => null, + 'series_start_id' => null, + 'infinite_series' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'category' => false, + 'scenario' => false, + 'amount' => false, + 'amount_in_base_currency' => false, + 'currency_code' => false, + 'date' => false, + 'colour' => false, + 'note' => false, + 'repeat_type' => false, + 'repeat_interval' => false, + 'series_id' => false, + 'series_start_id' => false, + 'infinite_series' => 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', + 'category' => 'category', + 'scenario' => 'scenario', + 'amount' => 'amount', + 'amount_in_base_currency' => 'amount_in_base_currency', + 'currency_code' => 'currency_code', + 'date' => 'date', + 'colour' => 'colour', + 'note' => 'note', + 'repeat_type' => 'repeat_type', + 'repeat_interval' => 'repeat_interval', + 'series_id' => 'series_id', + 'series_start_id' => 'series_start_id', + 'infinite_series' => 'infinite_series' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'category' => 'setCategory', + 'scenario' => 'setScenario', + 'amount' => 'setAmount', + 'amount_in_base_currency' => 'setAmountInBaseCurrency', + 'currency_code' => 'setCurrencyCode', + 'date' => 'setDate', + 'colour' => 'setColour', + 'note' => 'setNote', + 'repeat_type' => 'setRepeatType', + 'repeat_interval' => 'setRepeatInterval', + 'series_id' => 'setSeriesId', + 'series_start_id' => 'setSeriesStartId', + 'infinite_series' => 'setInfiniteSeries' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'category' => 'getCategory', + 'scenario' => 'getScenario', + 'amount' => 'getAmount', + 'amount_in_base_currency' => 'getAmountInBaseCurrency', + 'currency_code' => 'getCurrencyCode', + 'date' => 'getDate', + 'colour' => 'getColour', + 'note' => 'getNote', + 'repeat_type' => 'getRepeatType', + 'repeat_interval' => 'getRepeatInterval', + 'series_id' => 'getSeriesId', + 'series_start_id' => 'getSeriesStartId', + 'infinite_series' => 'getInfiniteSeries' + ]; + + /** + * 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; + } + + public const REPEAT_TYPE_ONCE = 'once'; + public const REPEAT_TYPE_DAILY = 'daily'; + public const REPEAT_TYPE_WEEKLY = 'weekly'; + public const REPEAT_TYPE_FORTNIGHTLY = 'fortnightly'; + public const REPEAT_TYPE_MONTHLY = 'monthly'; + public const REPEAT_TYPE_YEARLY = 'yearly'; + public const REPEAT_TYPE_EACH_WEEKDAY = 'each weekday'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRepeatTypeAllowableValues() + { + return [ + self::REPEAT_TYPE_ONCE, + self::REPEAT_TYPE_DAILY, + self::REPEAT_TYPE_WEEKLY, + self::REPEAT_TYPE_FORTNIGHTLY, + self::REPEAT_TYPE_MONTHLY, + self::REPEAT_TYPE_YEARLY, + self::REPEAT_TYPE_EACH_WEEKDAY, + ]; + } + + /** + * 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('category', $data ?? [], null); + $this->setIfExists('scenario', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('amount_in_base_currency', $data ?? [], null); + $this->setIfExists('currency_code', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('colour', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('repeat_type', $data ?? [], null); + $this->setIfExists('repeat_interval', $data ?? [], null); + $this->setIfExists('series_id', $data ?? [], null); + $this->setIfExists('series_start_id', $data ?? [], null); + $this->setIfExists('infinite_series', $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 = []; + + $allowedValues = $this->getRepeatTypeAllowableValues(); + if (!is_null($this->container['repeat_type']) && !in_array($this->container['repeat_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'repeat_type', must be one of '%s'", + $this->container['repeat_type'], + implode("', '", $allowedValues) + ); + } + + 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 The unique identifier of the event. + * + * @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 category + * + * @return \OpenAPI\Client\Model\Category|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param \OpenAPI\Client\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 scenario + * + * @return \OpenAPI\Client\Model\Scenario|null + */ + public function getScenario() + { + return $this->container['scenario']; + } + + /** + * Sets scenario + * + * @param \OpenAPI\Client\Model\Scenario|null $scenario scenario + * + * @return self + */ + public function setScenario($scenario) + { + if (is_null($scenario)) { + throw new \InvalidArgumentException('non-nullable scenario cannot be null'); + } + $this->container['scenario'] = $scenario; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount The amount of the event. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets amount_in_base_currency + * + * @return float|null + */ + public function getAmountInBaseCurrency() + { + return $this->container['amount_in_base_currency']; + } + + /** + * Sets amount_in_base_currency + * + * @param float|null $amount_in_base_currency The amount of the event in the user's base currency. + * + * @return self + */ + public function setAmountInBaseCurrency($amount_in_base_currency) + { + if (is_null($amount_in_base_currency)) { + throw new \InvalidArgumentException('non-nullable amount_in_base_currency cannot be null'); + } + $this->container['amount_in_base_currency'] = $amount_in_base_currency; + + return $this; + } + + /** + * Gets currency_code + * + * @return string|null + */ + public function getCurrencyCode() + { + return $this->container['currency_code']; + } + + /** + * Sets currency_code + * + * @param string|null $currency_code The currency code of the event. + * + * @return self + */ + public function setCurrencyCode($currency_code) + { + if (is_null($currency_code)) { + throw new \InvalidArgumentException('non-nullable currency_code cannot be null'); + } + $this->container['currency_code'] = $currency_code; + + return $this; + } + + /** + * Gets date + * + * @return string|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string|null $date The date of the event. + * + * @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 colour + * + * @return string|null + */ + public function getColour() + { + return $this->container['colour']; + } + + /** + * Sets colour + * + * @param string|null $colour The CSS hex-style colour of the event. + * + * @return self + */ + public function setColour($colour) + { + if (is_null($colour)) { + throw new \InvalidArgumentException('non-nullable colour cannot be null'); + } + $this->container['colour'] = $colour; + + return $this; + } + + /** + * Gets note + * + * @return string|null + */ + public function getNote() + { + return $this->container['note']; + } + + /** + * Sets note + * + * @param string|null $note The note of the event. + * + * @return self + */ + public function setNote($note) + { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } + $this->container['note'] = $note; + + return $this; + } + + /** + * Gets repeat_type + * + * @return string|null + */ + public function getRepeatType() + { + return $this->container['repeat_type']; + } + + /** + * Sets repeat_type + * + * @param string|null $repeat_type The repeat type of the event. + * + * @return self + */ + public function setRepeatType($repeat_type) + { + if (is_null($repeat_type)) { + throw new \InvalidArgumentException('non-nullable repeat_type cannot be null'); + } + $allowedValues = $this->getRepeatTypeAllowableValues(); + if (!in_array($repeat_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'repeat_type', must be one of '%s'", + $repeat_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['repeat_type'] = $repeat_type; + + return $this; + } + + /** + * Gets repeat_interval + * + * @return int|null + */ + public function getRepeatInterval() + { + return $this->container['repeat_interval']; + } + + /** + * Sets repeat_interval + * + * @param int|null $repeat_interval The repeat interval of how often the event takes place. + * + * @return self + */ + public function setRepeatInterval($repeat_interval) + { + if (is_null($repeat_interval)) { + throw new \InvalidArgumentException('non-nullable repeat_interval cannot be null'); + } + $this->container['repeat_interval'] = $repeat_interval; + + return $this; + } + + /** + * Gets series_id + * + * @return int|null + */ + public function getSeriesId() + { + return $this->container['series_id']; + } + + /** + * Sets series_id + * + * @param int|null $series_id The unique identifier of the series that the event belongs to. + * + * @return self + */ + public function setSeriesId($series_id) + { + if (is_null($series_id)) { + throw new \InvalidArgumentException('non-nullable series_id cannot be null'); + } + $this->container['series_id'] = $series_id; + + return $this; + } + + /** + * Gets series_start_id + * + * @return string|null + */ + public function getSeriesStartId() + { + return $this->container['series_start_id']; + } + + /** + * Sets series_start_id + * + * @param string|null $series_start_id The unique identifier of the series followed by the series's start date. + * + * @return self + */ + public function setSeriesStartId($series_start_id) + { + if (is_null($series_start_id)) { + throw new \InvalidArgumentException('non-nullable series_start_id cannot be null'); + } + $this->container['series_start_id'] = $series_start_id; + + return $this; + } + + /** + * Gets infinite_series + * + * @return bool|null + */ + public function getInfiniteSeries() + { + return $this->container['infinite_series']; + } + + /** + * Sets infinite_series + * + * @param bool|null $infinite_series Whether the event repeats and does not have an end date. + * + * @return self + */ + public function setInfiniteSeries($infinite_series) + { + if (is_null($infinite_series)) { + throw new \InvalidArgumentException('non-nullable infinite_series cannot be null'); + } + $this->container['infinite_series'] = $infinite_series; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EventsIdPutRequest.php b/lib/Model/EventsIdPutRequest.php new file mode 100644 index 0000000..c353fa3 --- /dev/null +++ b/lib/Model/EventsIdPutRequest.php @@ -0,0 +1,629 @@ + + */ +class EventsIdPutRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_events__id__put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'behaviour' => 'string', + 'amount' => 'float', + 'repeat_type' => 'string', + 'repeat_interval' => 'int', + 'note' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'behaviour' => null, + 'amount' => null, + 'repeat_type' => null, + 'repeat_interval' => null, + 'note' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'behaviour' => false, + 'amount' => false, + 'repeat_type' => false, + 'repeat_interval' => false, + 'note' => 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 = [ + 'behaviour' => 'behaviour', + 'amount' => 'amount', + 'repeat_type' => 'repeat_type', + 'repeat_interval' => 'repeat_interval', + 'note' => 'note' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'behaviour' => 'setBehaviour', + 'amount' => 'setAmount', + 'repeat_type' => 'setRepeatType', + 'repeat_interval' => 'setRepeatInterval', + 'note' => 'setNote' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'behaviour' => 'getBehaviour', + 'amount' => 'getAmount', + 'repeat_type' => 'getRepeatType', + 'repeat_interval' => 'getRepeatInterval', + 'note' => 'getNote' + ]; + + /** + * 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; + } + + public const BEHAVIOUR_ONE = 'one'; + public const BEHAVIOUR_FORWARD = 'forward'; + public const BEHAVIOUR_ALL = 'all'; + public const REPEAT_TYPE_ONCE = 'once'; + public const REPEAT_TYPE_DAILY = 'daily'; + public const REPEAT_TYPE_WEEKLY = 'weekly'; + public const REPEAT_TYPE_FORTNIGHTLY = 'fortnightly'; + public const REPEAT_TYPE_MONTHLY = 'monthly'; + public const REPEAT_TYPE_YEARLY = 'yearly'; + public const REPEAT_TYPE_EACH_WEEKDAY = 'each weekday'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getBehaviourAllowableValues() + { + return [ + self::BEHAVIOUR_ONE, + self::BEHAVIOUR_FORWARD, + self::BEHAVIOUR_ALL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRepeatTypeAllowableValues() + { + return [ + self::REPEAT_TYPE_ONCE, + self::REPEAT_TYPE_DAILY, + self::REPEAT_TYPE_WEEKLY, + self::REPEAT_TYPE_FORTNIGHTLY, + self::REPEAT_TYPE_MONTHLY, + self::REPEAT_TYPE_YEARLY, + self::REPEAT_TYPE_EACH_WEEKDAY, + ]; + } + + /** + * 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('behaviour', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('repeat_type', $data ?? [], null); + $this->setIfExists('repeat_interval', $data ?? [], null); + $this->setIfExists('note', $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['behaviour'] === null) { + $invalidProperties[] = "'behaviour' can't be null"; + } + $allowedValues = $this->getBehaviourAllowableValues(); + if (!is_null($this->container['behaviour']) && !in_array($this->container['behaviour'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'behaviour', must be one of '%s'", + $this->container['behaviour'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRepeatTypeAllowableValues(); + if (!is_null($this->container['repeat_type']) && !in_array($this->container['repeat_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'repeat_type', must be one of '%s'", + $this->container['repeat_type'], + implode("', '", $allowedValues) + ); + } + + 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 behaviour + * + * @return string + */ + public function getBehaviour() + { + return $this->container['behaviour']; + } + + /** + * Sets behaviour + * + * @param string $behaviour Whether the update applies only to this event, to all events within the series from this event or to all events within the series. + * + * @return self + */ + public function setBehaviour($behaviour) + { + if (is_null($behaviour)) { + throw new \InvalidArgumentException('non-nullable behaviour cannot be null'); + } + $allowedValues = $this->getBehaviourAllowableValues(); + if (!in_array($behaviour, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'behaviour', must be one of '%s'", + $behaviour, + implode("', '", $allowedValues) + ) + ); + } + $this->container['behaviour'] = $behaviour; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount The amount of the event. A positive amount is a credit, and a negative amount is a debit. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets repeat_type + * + * @return string|null + */ + public function getRepeatType() + { + return $this->container['repeat_type']; + } + + /** + * Sets repeat_type + * + * @param string|null $repeat_type The repeat type of the event. + * + * @return self + */ + public function setRepeatType($repeat_type) + { + if (is_null($repeat_type)) { + throw new \InvalidArgumentException('non-nullable repeat_type cannot be null'); + } + $allowedValues = $this->getRepeatTypeAllowableValues(); + if (!in_array($repeat_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'repeat_type', must be one of '%s'", + $repeat_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['repeat_type'] = $repeat_type; + + return $this; + } + + /** + * Gets repeat_interval + * + * @return int|null + */ + public function getRepeatInterval() + { + return $this->container['repeat_interval']; + } + + /** + * Sets repeat_interval + * + * @param int|null $repeat_interval The repeat interval of the event. + * + * @return self + */ + public function setRepeatInterval($repeat_interval) + { + if (is_null($repeat_interval)) { + throw new \InvalidArgumentException('non-nullable repeat_interval cannot be null'); + } + $this->container['repeat_interval'] = $repeat_interval; + + return $this; + } + + /** + * Gets note + * + * @return string|null + */ + public function getNote() + { + return $this->container['note']; + } + + /** + * Sets note + * + * @param string|null $note A note for the event. + * + * @return self + */ + public function setNote($note) + { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } + $this->container['note'] = $note; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Institution.php b/lib/Model/Institution.php new file mode 100644 index 0000000..b9f6a25 --- /dev/null +++ b/lib/Model/Institution.php @@ -0,0 +1,546 @@ + + */ +class Institution implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Institution'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'currency_code' => 'string', + 'title' => 'string', + 'updated_at' => 'string', + 'created_at' => 'string', + 'id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'currency_code' => null, + 'title' => null, + 'updated_at' => null, + 'created_at' => null, + 'id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'currency_code' => false, + 'title' => false, + 'updated_at' => false, + 'created_at' => false, + '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 = [ + 'currency_code' => 'currency_code', + 'title' => 'title', + 'updated_at' => 'updated_at', + 'created_at' => 'created_at', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'currency_code' => 'setCurrencyCode', + 'title' => 'setTitle', + 'updated_at' => 'setUpdatedAt', + 'created_at' => 'setCreatedAt', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'currency_code' => 'getCurrencyCode', + 'title' => 'getTitle', + 'updated_at' => 'getUpdatedAt', + 'created_at' => 'getCreatedAt', + '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('currency_code', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('created_at', $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 currency_code + * + * @return string|null + */ + public function getCurrencyCode() + { + return $this->container['currency_code']; + } + + /** + * Sets currency_code + * + * @param string|null $currency_code The currency code of the institution. + * + * @return self + */ + public function setCurrencyCode($currency_code) + { + if (is_null($currency_code)) { + throw new \InvalidArgumentException('non-nullable currency_code cannot be null'); + } + $this->container['currency_code'] = $currency_code; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the institution. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at When the institution was last updated. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at When the institution was created. + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id The unique identifier of the institution. + * + * @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/lib/Model/InstitutionsIdPutRequest.php b/lib/Model/InstitutionsIdPutRequest.php new file mode 100644 index 0000000..8d1e01c --- /dev/null +++ b/lib/Model/InstitutionsIdPutRequest.php @@ -0,0 +1,444 @@ + + */ +class InstitutionsIdPutRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_institutions__id__put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => 'string', + 'currency_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'currency_code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'currency_code' => 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 = [ + 'title' => 'title', + 'currency_code' => 'currency_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'currency_code' => 'setCurrencyCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'currency_code' => 'getCurrencyCode' + ]; + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('currency_code', $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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title A new title for the institution. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets currency_code + * + * @return string|null + */ + public function getCurrencyCode() + { + return $this->container['currency_code']; + } + + /** + * Sets currency_code + * + * @param string|null $currency_code A new currency code for the institution. + * + * @return self + */ + public function setCurrencyCode($currency_code) + { + if (is_null($currency_code)) { + throw new \InvalidArgumentException('non-nullable currency_code cannot be null'); + } + $this->container['currency_code'] = $currency_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php new file mode 100644 index 0000000..ad3db59 --- /dev/null +++ b/lib/Model/ModelInterface.php @@ -0,0 +1,112 @@ + + */ +class Period implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Period'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'start_date' => 'string', + 'end_date' => 'string', + 'currency_code' => 'string', + 'actual_amount' => 'float', + 'forecast_amount' => 'float', + 'refund_amount' => 'float', + 'current' => 'bool', + 'over_budget' => 'bool', + 'under_budget' => 'bool', + 'over_by' => 'float', + 'under_by' => 'float', + 'percentage_used' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'start_date' => null, + 'end_date' => null, + 'currency_code' => null, + 'actual_amount' => null, + 'forecast_amount' => null, + 'refund_amount' => null, + 'current' => null, + 'over_budget' => null, + 'under_budget' => null, + 'over_by' => null, + 'under_by' => null, + 'percentage_used' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'start_date' => false, + 'end_date' => false, + 'currency_code' => false, + 'actual_amount' => false, + 'forecast_amount' => false, + 'refund_amount' => false, + 'current' => false, + 'over_budget' => false, + 'under_budget' => false, + 'over_by' => false, + 'under_by' => false, + 'percentage_used' => 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 = [ + 'start_date' => 'start_date', + 'end_date' => 'end_date', + 'currency_code' => 'currency_code', + 'actual_amount' => 'actual_amount', + 'forecast_amount' => 'forecast_amount', + 'refund_amount' => 'refund_amount', + 'current' => 'current', + 'over_budget' => 'over_budget', + 'under_budget' => 'under_budget', + 'over_by' => 'over_by', + 'under_by' => 'under_by', + 'percentage_used' => 'percentage_used' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'start_date' => 'setStartDate', + 'end_date' => 'setEndDate', + 'currency_code' => 'setCurrencyCode', + 'actual_amount' => 'setActualAmount', + 'forecast_amount' => 'setForecastAmount', + 'refund_amount' => 'setRefundAmount', + 'current' => 'setCurrent', + 'over_budget' => 'setOverBudget', + 'under_budget' => 'setUnderBudget', + 'over_by' => 'setOverBy', + 'under_by' => 'setUnderBy', + 'percentage_used' => 'setPercentageUsed' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'start_date' => 'getStartDate', + 'end_date' => 'getEndDate', + 'currency_code' => 'getCurrencyCode', + 'actual_amount' => 'getActualAmount', + 'forecast_amount' => 'getForecastAmount', + 'refund_amount' => 'getRefundAmount', + 'current' => 'getCurrent', + 'over_budget' => 'getOverBudget', + 'under_budget' => 'getUnderBudget', + 'over_by' => 'getOverBy', + 'under_by' => 'getUnderBy', + 'percentage_used' => 'getPercentageUsed' + ]; + + /** + * 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('start_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('currency_code', $data ?? [], null); + $this->setIfExists('actual_amount', $data ?? [], null); + $this->setIfExists('forecast_amount', $data ?? [], null); + $this->setIfExists('refund_amount', $data ?? [], null); + $this->setIfExists('current', $data ?? [], null); + $this->setIfExists('over_budget', $data ?? [], null); + $this->setIfExists('under_budget', $data ?? [], null); + $this->setIfExists('over_by', $data ?? [], null); + $this->setIfExists('under_by', $data ?? [], null); + $this->setIfExists('percentage_used', $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 start_date + * + * @return string|null + */ + public function getStartDate() + { + return $this->container['start_date']; + } + + /** + * Sets start_date + * + * @param string|null $start_date The start date of the period. + * + * @return self + */ + public function setStartDate($start_date) + { + if (is_null($start_date)) { + throw new \InvalidArgumentException('non-nullable start_date cannot be null'); + } + $this->container['start_date'] = $start_date; + + return $this; + } + + /** + * Gets end_date + * + * @return string|null + */ + public function getEndDate() + { + return $this->container['end_date']; + } + + /** + * Sets end_date + * + * @param string|null $end_date The end date of the period. + * + * @return self + */ + public function setEndDate($end_date) + { + if (is_null($end_date)) { + throw new \InvalidArgumentException('non-nullable end_date cannot be null'); + } + $this->container['end_date'] = $end_date; + + return $this; + } + + /** + * Gets currency_code + * + * @return string|null + */ + public function getCurrencyCode() + { + return $this->container['currency_code']; + } + + /** + * Sets currency_code + * + * @param string|null $currency_code The currency of the period. + * + * @return self + */ + public function setCurrencyCode($currency_code) + { + if (is_null($currency_code)) { + throw new \InvalidArgumentException('non-nullable currency_code cannot be null'); + } + $this->container['currency_code'] = $currency_code; + + return $this; + } + + /** + * Gets actual_amount + * + * @return float|null + */ + public function getActualAmount() + { + return $this->container['actual_amount']; + } + + /** + * Sets actual_amount + * + * @param float|null $actual_amount The sum of all actuals (transactions) in the period. + * + * @return self + */ + public function setActualAmount($actual_amount) + { + if (is_null($actual_amount)) { + throw new \InvalidArgumentException('non-nullable actual_amount cannot be null'); + } + $this->container['actual_amount'] = $actual_amount; + + return $this; + } + + /** + * Gets forecast_amount + * + * @return float|null + */ + public function getForecastAmount() + { + return $this->container['forecast_amount']; + } + + /** + * Sets forecast_amount + * + * @param float|null $forecast_amount The sum of all forecast sources (budget events) in the period, for comparison against the actual amount. + * + * @return self + */ + public function setForecastAmount($forecast_amount) + { + if (is_null($forecast_amount)) { + throw new \InvalidArgumentException('non-nullable forecast_amount cannot be null'); + } + $this->container['forecast_amount'] = $forecast_amount; + + return $this; + } + + /** + * Gets refund_amount + * + * @return float|null + */ + public function getRefundAmount() + { + return $this->container['refund_amount']; + } + + /** + * Sets refund_amount + * + * @param float|null $refund_amount This attribute tracks the amount that has been refunded or deducted to the actual amount. When a category is set to \"always expense\", any credit transactions are treated as refunds and when set to \"always income\", any debit transactions are treated as deductions. + * + * @return self + */ + public function setRefundAmount($refund_amount) + { + if (is_null($refund_amount)) { + throw new \InvalidArgumentException('non-nullable refund_amount cannot be null'); + } + $this->container['refund_amount'] = $refund_amount; + + return $this; + } + + /** + * Gets current + * + * @return bool|null + */ + public function getCurrent() + { + return $this->container['current']; + } + + /** + * Sets current + * + * @param bool|null $current Whether this period is current, such that the current date (in the user's time zone) falls within the date range. + * + * @return self + */ + public function setCurrent($current) + { + if (is_null($current)) { + throw new \InvalidArgumentException('non-nullable current cannot be null'); + } + $this->container['current'] = $current; + + return $this; + } + + /** + * Gets over_budget + * + * @return bool|null + */ + public function getOverBudget() + { + return $this->container['over_budget']; + } + + /** + * Sets over_budget + * + * @param bool|null $over_budget Whether the budget has been exceeded in the period. + * + * @return self + */ + public function setOverBudget($over_budget) + { + if (is_null($over_budget)) { + throw new \InvalidArgumentException('non-nullable over_budget cannot be null'); + } + $this->container['over_budget'] = $over_budget; + + return $this; + } + + /** + * Gets under_budget + * + * @return bool|null + */ + public function getUnderBudget() + { + return $this->container['under_budget']; + } + + /** + * Sets under_budget + * + * @param bool|null $under_budget Whether the budget has not been exceeded in the period. + * + * @return self + */ + public function setUnderBudget($under_budget) + { + if (is_null($under_budget)) { + throw new \InvalidArgumentException('non-nullable under_budget cannot be null'); + } + $this->container['under_budget'] = $under_budget; + + return $this; + } + + /** + * Gets over_by + * + * @return float|null + */ + public function getOverBy() + { + return $this->container['over_by']; + } + + /** + * Sets over_by + * + * @param float|null $over_by How much the budget has been exceeded by in the period. + * + * @return self + */ + public function setOverBy($over_by) + { + if (is_null($over_by)) { + throw new \InvalidArgumentException('non-nullable over_by cannot be null'); + } + $this->container['over_by'] = $over_by; + + return $this; + } + + /** + * Gets under_by + * + * @return float|null + */ + public function getUnderBy() + { + return $this->container['under_by']; + } + + /** + * Sets under_by + * + * @param float|null $under_by How much there is left in the budget for the period. + * + * @return self + */ + public function setUnderBy($under_by) + { + if (is_null($under_by)) { + throw new \InvalidArgumentException('non-nullable under_by cannot be null'); + } + $this->container['under_by'] = $under_by; + + return $this; + } + + /** + * Gets percentage_used + * + * @return float|null + */ + public function getPercentageUsed() + { + return $this->container['percentage_used']; + } + + /** + * Sets percentage_used + * + * @param float|null $percentage_used The percentage of the budget that has been used in the period. + * + * @return self + */ + public function setPercentageUsed($percentage_used) + { + if (is_null($percentage_used)) { + throw new \InvalidArgumentException('non-nullable percentage_used cannot be null'); + } + $this->container['percentage_used'] = $percentage_used; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/SavedSearch.php b/lib/Model/SavedSearch.php new file mode 100644 index 0000000..1cff963 --- /dev/null +++ b/lib/Model/SavedSearch.php @@ -0,0 +1,512 @@ + + */ +class SavedSearch implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SavedSearch'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'title' => 'string', + 'created_at' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'created_at' => 'ISO 8601 timestamp', + 'updated_at' => 'ISO 8601 timestamp' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'title' => false, + 'created_at' => false, + 'updated_at' => 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', + 'title' => 'title', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $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 unique identifier of the saved search. + * + * @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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the saved search. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at When the saved search was created. + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at When the saved search was last updated. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Scenario.php b/lib/Model/Scenario.php new file mode 100644 index 0000000..9c9d0d7 --- /dev/null +++ b/lib/Model/Scenario.php @@ -0,0 +1,1126 @@ + + */ +class Scenario implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Scenario'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'title' => 'string', + 'description' => 'string', + 'interest_rate' => 'float', + 'interest_rate_repeat_id' => 'int', + 'type' => 'string', + 'minimum_value' => 'float', + 'maximum_value' => 'float', + 'achieve_date' => 'string', + 'starting_balance' => 'float', + 'starting_balance_date' => 'string', + 'closing_balance' => 'float', + 'closing_balance_date' => 'string', + 'current_balance' => 'float', + 'current_balance_date' => 'string', + 'current_balance_in_base_currency' => 'float', + 'current_balance_exchange_rate' => 'float', + 'safe_balance' => 'float', + 'safe_balance_in_base_currency' => 'float', + 'created_at' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'description' => null, + 'interest_rate' => null, + 'interest_rate_repeat_id' => null, + 'type' => null, + 'minimum_value' => null, + 'maximum_value' => null, + 'achieve_date' => null, + 'starting_balance' => null, + 'starting_balance_date' => null, + 'closing_balance' => null, + 'closing_balance_date' => null, + 'current_balance' => null, + 'current_balance_date' => null, + 'current_balance_in_base_currency' => null, + 'current_balance_exchange_rate' => null, + 'safe_balance' => null, + 'safe_balance_in_base_currency' => null, + 'created_at' => null, + 'updated_at' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'title' => false, + 'description' => false, + 'interest_rate' => false, + 'interest_rate_repeat_id' => false, + 'type' => false, + 'minimum_value' => false, + 'maximum_value' => false, + 'achieve_date' => false, + 'starting_balance' => false, + 'starting_balance_date' => false, + 'closing_balance' => false, + 'closing_balance_date' => false, + 'current_balance' => false, + 'current_balance_date' => false, + 'current_balance_in_base_currency' => false, + 'current_balance_exchange_rate' => false, + 'safe_balance' => false, + 'safe_balance_in_base_currency' => false, + 'created_at' => false, + 'updated_at' => 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', + 'title' => 'title', + 'description' => 'description', + 'interest_rate' => 'interest_rate', + 'interest_rate_repeat_id' => 'interest_rate_repeat_id', + 'type' => 'type', + 'minimum_value' => 'minimum-value', + 'maximum_value' => 'maximum-value', + 'achieve_date' => 'achieve_date', + 'starting_balance' => 'starting_balance', + 'starting_balance_date' => 'starting_balance_date', + 'closing_balance' => 'closing_balance', + 'closing_balance_date' => 'closing_balance_date', + 'current_balance' => 'current_balance', + 'current_balance_date' => 'current_balance_date', + 'current_balance_in_base_currency' => 'current_balance_in_base_currency', + 'current_balance_exchange_rate' => 'current_balance_exchange_rate', + 'safe_balance' => 'safe_balance', + 'safe_balance_in_base_currency' => 'safe_balance_in_base_currency', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'description' => 'setDescription', + 'interest_rate' => 'setInterestRate', + 'interest_rate_repeat_id' => 'setInterestRateRepeatId', + 'type' => 'setType', + 'minimum_value' => 'setMinimumValue', + 'maximum_value' => 'setMaximumValue', + 'achieve_date' => 'setAchieveDate', + 'starting_balance' => 'setStartingBalance', + 'starting_balance_date' => 'setStartingBalanceDate', + 'closing_balance' => 'setClosingBalance', + 'closing_balance_date' => 'setClosingBalanceDate', + 'current_balance' => 'setCurrentBalance', + 'current_balance_date' => 'setCurrentBalanceDate', + 'current_balance_in_base_currency' => 'setCurrentBalanceInBaseCurrency', + 'current_balance_exchange_rate' => 'setCurrentBalanceExchangeRate', + 'safe_balance' => 'setSafeBalance', + 'safe_balance_in_base_currency' => 'setSafeBalanceInBaseCurrency', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'description' => 'getDescription', + 'interest_rate' => 'getInterestRate', + 'interest_rate_repeat_id' => 'getInterestRateRepeatId', + 'type' => 'getType', + 'minimum_value' => 'getMinimumValue', + 'maximum_value' => 'getMaximumValue', + 'achieve_date' => 'getAchieveDate', + 'starting_balance' => 'getStartingBalance', + 'starting_balance_date' => 'getStartingBalanceDate', + 'closing_balance' => 'getClosingBalance', + 'closing_balance_date' => 'getClosingBalanceDate', + 'current_balance' => 'getCurrentBalance', + 'current_balance_date' => 'getCurrentBalanceDate', + 'current_balance_in_base_currency' => 'getCurrentBalanceInBaseCurrency', + 'current_balance_exchange_rate' => 'getCurrentBalanceExchangeRate', + 'safe_balance' => 'getSafeBalance', + 'safe_balance_in_base_currency' => 'getSafeBalanceInBaseCurrency', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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; + } + + public const TYPE_NO_INTEREST = 'no-interest'; + public const TYPE_SAVINGS = 'savings'; + public const TYPE_DEBT = 'debt'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_NO_INTEREST, + self::TYPE_SAVINGS, + self::TYPE_DEBT, + ]; + } + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('interest_rate', $data ?? [], null); + $this->setIfExists('interest_rate_repeat_id', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('minimum_value', $data ?? [], null); + $this->setIfExists('maximum_value', $data ?? [], null); + $this->setIfExists('achieve_date', $data ?? [], null); + $this->setIfExists('starting_balance', $data ?? [], null); + $this->setIfExists('starting_balance_date', $data ?? [], null); + $this->setIfExists('closing_balance', $data ?? [], null); + $this->setIfExists('closing_balance_date', $data ?? [], null); + $this->setIfExists('current_balance', $data ?? [], null); + $this->setIfExists('current_balance_date', $data ?? [], null); + $this->setIfExists('current_balance_in_base_currency', $data ?? [], null); + $this->setIfExists('current_balance_exchange_rate', $data ?? [], null); + $this->setIfExists('safe_balance', $data ?? [], null); + $this->setIfExists('safe_balance_in_base_currency', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $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 = []; + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + 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 unique identifier of the scenario. + * + * @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 title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the scenario. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description A short description of what the scenario is modelling. + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets interest_rate + * + * @return float|null + */ + public function getInterestRate() + { + return $this->container['interest_rate']; + } + + /** + * Sets interest_rate + * + * @param float|null $interest_rate The amount of interest to apply to the balance. Will apply periodically depending on what `interest_rate_repeat_id` is set to. + * + * @return self + */ + public function setInterestRate($interest_rate) + { + if (is_null($interest_rate)) { + throw new \InvalidArgumentException('non-nullable interest_rate cannot be null'); + } + $this->container['interest_rate'] = $interest_rate; + + return $this; + } + + /** + * Gets interest_rate_repeat_id + * + * @return int|null + */ + public function getInterestRateRepeatId() + { + return $this->container['interest_rate_repeat_id']; + } + + /** + * Sets interest_rate_repeat_id + * + * @param int|null $interest_rate_repeat_id A number representing how often the interest should be applied. 0 is used for no interest, 2 is weekly, 3 is fortnightly, 4 is monthly, 5 is yearly and 7 for quarterly. + * + * @return self + */ + public function setInterestRateRepeatId($interest_rate_repeat_id) + { + if (is_null($interest_rate_repeat_id)) { + throw new \InvalidArgumentException('non-nullable interest_rate_repeat_id cannot be null'); + } + $this->container['interest_rate_repeat_id'] = $interest_rate_repeat_id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of the scenario. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets minimum_value + * + * @return float|null + */ + public function getMinimumValue() + { + return $this->container['minimum_value']; + } + + /** + * Sets minimum_value + * + * @param float|null $minimum_value minimum_value + * + * @return self + */ + public function setMinimumValue($minimum_value) + { + if (is_null($minimum_value)) { + throw new \InvalidArgumentException('non-nullable minimum_value cannot be null'); + } + $this->container['minimum_value'] = $minimum_value; + + return $this; + } + + /** + * Gets maximum_value + * + * @return float|null + */ + public function getMaximumValue() + { + return $this->container['maximum_value']; + } + + /** + * Sets maximum_value + * + * @param float|null $maximum_value maximum_value + * + * @return self + */ + public function setMaximumValue($maximum_value) + { + if (is_null($maximum_value)) { + throw new \InvalidArgumentException('non-nullable maximum_value cannot be null'); + } + $this->container['maximum_value'] = $maximum_value; + + return $this; + } + + /** + * Gets achieve_date + * + * @return string|null + */ + public function getAchieveDate() + { + return $this->container['achieve_date']; + } + + /** + * Sets achieve_date + * + * @param string|null $achieve_date For goals, the date that they should be achieved by. + * + * @return self + */ + public function setAchieveDate($achieve_date) + { + if (is_null($achieve_date)) { + throw new \InvalidArgumentException('non-nullable achieve_date cannot be null'); + } + $this->container['achieve_date'] = $achieve_date; + + return $this; + } + + /** + * Gets starting_balance + * + * @return float|null + */ + public function getStartingBalance() + { + return $this->container['starting_balance']; + } + + /** + * Sets starting_balance + * + * @param float|null $starting_balance The starting balance of the scenario. + * + * @return self + */ + public function setStartingBalance($starting_balance) + { + if (is_null($starting_balance)) { + throw new \InvalidArgumentException('non-nullable starting_balance cannot be null'); + } + $this->container['starting_balance'] = $starting_balance; + + return $this; + } + + /** + * Gets starting_balance_date + * + * @return string|null + */ + public function getStartingBalanceDate() + { + return $this->container['starting_balance_date']; + } + + /** + * Sets starting_balance_date + * + * @param string|null $starting_balance_date The date of the starting balance. + * + * @return self + */ + public function setStartingBalanceDate($starting_balance_date) + { + if (is_null($starting_balance_date)) { + throw new \InvalidArgumentException('non-nullable starting_balance_date cannot be null'); + } + $this->container['starting_balance_date'] = $starting_balance_date; + + return $this; + } + + /** + * Gets closing_balance + * + * @return float|null + */ + public function getClosingBalance() + { + return $this->container['closing_balance']; + } + + /** + * Sets closing_balance + * + * @param float|null $closing_balance The closing balance of the scenario. + * + * @return self + */ + public function setClosingBalance($closing_balance) + { + if (is_null($closing_balance)) { + throw new \InvalidArgumentException('non-nullable closing_balance cannot be null'); + } + $this->container['closing_balance'] = $closing_balance; + + return $this; + } + + /** + * Gets closing_balance_date + * + * @return string|null + */ + public function getClosingBalanceDate() + { + return $this->container['closing_balance_date']; + } + + /** + * Sets closing_balance_date + * + * @param string|null $closing_balance_date The date of the closing balance. + * + * @return self + */ + public function setClosingBalanceDate($closing_balance_date) + { + if (is_null($closing_balance_date)) { + throw new \InvalidArgumentException('non-nullable closing_balance_date cannot be null'); + } + $this->container['closing_balance_date'] = $closing_balance_date; + + return $this; + } + + /** + * Gets current_balance + * + * @return float|null + */ + public function getCurrentBalance() + { + return $this->container['current_balance']; + } + + /** + * Sets current_balance + * + * @param float|null $current_balance The current balance of the scenario. + * + * @return self + */ + public function setCurrentBalance($current_balance) + { + if (is_null($current_balance)) { + throw new \InvalidArgumentException('non-nullable current_balance cannot be null'); + } + $this->container['current_balance'] = $current_balance; + + return $this; + } + + /** + * Gets current_balance_date + * + * @return string|null + */ + public function getCurrentBalanceDate() + { + return $this->container['current_balance_date']; + } + + /** + * Sets current_balance_date + * + * @param string|null $current_balance_date The date of the current balance. + * + * @return self + */ + public function setCurrentBalanceDate($current_balance_date) + { + if (is_null($current_balance_date)) { + throw new \InvalidArgumentException('non-nullable current_balance_date cannot be null'); + } + $this->container['current_balance_date'] = $current_balance_date; + + return $this; + } + + /** + * Gets current_balance_in_base_currency + * + * @return float|null + */ + public function getCurrentBalanceInBaseCurrency() + { + return $this->container['current_balance_in_base_currency']; + } + + /** + * Sets current_balance_in_base_currency + * + * @param float|null $current_balance_in_base_currency The current balance of the scenario in the user's base currency. + * + * @return self + */ + public function setCurrentBalanceInBaseCurrency($current_balance_in_base_currency) + { + if (is_null($current_balance_in_base_currency)) { + throw new \InvalidArgumentException('non-nullable current_balance_in_base_currency cannot be null'); + } + $this->container['current_balance_in_base_currency'] = $current_balance_in_base_currency; + + return $this; + } + + /** + * Gets current_balance_exchange_rate + * + * @return float|null + */ + public function getCurrentBalanceExchangeRate() + { + return $this->container['current_balance_exchange_rate']; + } + + /** + * Sets current_balance_exchange_rate + * + * @param float|null $current_balance_exchange_rate The exchange rate between the scenario's currency and the user's base currency, when different. If the currencies are the same, null is returned. + * + * @return self + */ + public function setCurrentBalanceExchangeRate($current_balance_exchange_rate) + { + if (is_null($current_balance_exchange_rate)) { + throw new \InvalidArgumentException('non-nullable current_balance_exchange_rate cannot be null'); + } + $this->container['current_balance_exchange_rate'] = $current_balance_exchange_rate; + + return $this; + } + + /** + * Gets safe_balance + * + * @return float|null + */ + public function getSafeBalance() + { + return $this->container['safe_balance']; + } + + /** + * Sets safe_balance + * + * @param float|null $safe_balance The current safe balance in the user's base currency, if safe balance is activated on the account associated with the scenario. If safe balance is not activated, then null is returned. + * + * @return self + */ + public function setSafeBalance($safe_balance) + { + if (is_null($safe_balance)) { + throw new \InvalidArgumentException('non-nullable safe_balance cannot be null'); + } + $this->container['safe_balance'] = $safe_balance; + + return $this; + } + + /** + * Gets safe_balance_in_base_currency + * + * @return float|null + */ + public function getSafeBalanceInBaseCurrency() + { + return $this->container['safe_balance_in_base_currency']; + } + + /** + * Sets safe_balance_in_base_currency + * + * @param float|null $safe_balance_in_base_currency The current safe balance in the user's base currency, if safe balance is activated on the account associated with the scenario. If safe balance is not available, then null is returned. + * + * @return self + */ + public function setSafeBalanceInBaseCurrency($safe_balance_in_base_currency) + { + if (is_null($safe_balance_in_base_currency)) { + throw new \InvalidArgumentException('non-nullable safe_balance_in_base_currency cannot be null'); + } + $this->container['safe_balance_in_base_currency'] = $safe_balance_in_base_currency; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at When the scenario was created. + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at When the scenario was last updated. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ScenariosIdEventsPostRequest.php b/lib/Model/ScenariosIdEventsPostRequest.php new file mode 100644 index 0000000..227615d --- /dev/null +++ b/lib/Model/ScenariosIdEventsPostRequest.php @@ -0,0 +1,636 @@ + + */ +class ScenariosIdEventsPostRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_scenarios__id__events_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'category_id' => 'int', + 'date' => 'string', + 'amount' => 'float', + 'repeat_type' => 'string', + 'repeat_interval' => 'int', + 'note' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'category_id' => null, + 'date' => null, + 'amount' => null, + 'repeat_type' => null, + 'repeat_interval' => null, + 'note' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'category_id' => false, + 'date' => false, + 'amount' => false, + 'repeat_type' => false, + 'repeat_interval' => false, + 'note' => 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 = [ + 'category_id' => 'category_id', + 'date' => 'date', + 'amount' => 'amount', + 'repeat_type' => 'repeat_type', + 'repeat_interval' => 'repeat_interval', + 'note' => 'note' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category_id' => 'setCategoryId', + 'date' => 'setDate', + 'amount' => 'setAmount', + 'repeat_type' => 'setRepeatType', + 'repeat_interval' => 'setRepeatInterval', + 'note' => 'setNote' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category_id' => 'getCategoryId', + 'date' => 'getDate', + 'amount' => 'getAmount', + 'repeat_type' => 'getRepeatType', + 'repeat_interval' => 'getRepeatInterval', + 'note' => 'getNote' + ]; + + /** + * 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; + } + + public const REPEAT_TYPE_ONCE = 'once'; + public const REPEAT_TYPE_DAILY = 'daily'; + public const REPEAT_TYPE_WEEKLY = 'weekly'; + public const REPEAT_TYPE_FORTNIGHTLY = 'fortnightly'; + public const REPEAT_TYPE_MONTHLY = 'monthly'; + public const REPEAT_TYPE_YEARLY = 'yearly'; + public const REPEAT_TYPE_EACH_WEEKDAY = 'each weekday'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRepeatTypeAllowableValues() + { + return [ + self::REPEAT_TYPE_ONCE, + self::REPEAT_TYPE_DAILY, + self::REPEAT_TYPE_WEEKLY, + self::REPEAT_TYPE_FORTNIGHTLY, + self::REPEAT_TYPE_MONTHLY, + self::REPEAT_TYPE_YEARLY, + self::REPEAT_TYPE_EACH_WEEKDAY, + ]; + } + + /** + * 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('category_id', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('repeat_type', $data ?? [], null); + $this->setIfExists('repeat_interval', $data ?? [], 1); + $this->setIfExists('note', $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['category_id'] === null) { + $invalidProperties[] = "'category_id' can't be null"; + } + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['repeat_type'] === null) { + $invalidProperties[] = "'repeat_type' can't be null"; + } + $allowedValues = $this->getRepeatTypeAllowableValues(); + if (!is_null($this->container['repeat_type']) && !in_array($this->container['repeat_type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'repeat_type', must be one of '%s'", + $this->container['repeat_type'], + implode("', '", $allowedValues) + ); + } + + 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 category_id + * + * @return int + */ + public function getCategoryId() + { + return $this->container['category_id']; + } + + /** + * Sets category_id + * + * @param int $category_id The unique identifier of the category for the event. + * + * @return self + */ + public function setCategoryId($category_id) + { + if (is_null($category_id)) { + throw new \InvalidArgumentException('non-nullable category_id cannot be null'); + } + $this->container['category_id'] = $category_id; + + return $this; + } + + /** + * Gets date + * + * @return string + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string $date The starting date of the event. + * + * @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 amount + * + * @return float + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float $amount The amount of the event. A positive amount is a credit, and a negative amount is a debit. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets repeat_type + * + * @return string + */ + public function getRepeatType() + { + return $this->container['repeat_type']; + } + + /** + * Sets repeat_type + * + * @param string $repeat_type The repeat type of the event. + * + * @return self + */ + public function setRepeatType($repeat_type) + { + if (is_null($repeat_type)) { + throw new \InvalidArgumentException('non-nullable repeat_type cannot be null'); + } + $allowedValues = $this->getRepeatTypeAllowableValues(); + if (!in_array($repeat_type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'repeat_type', must be one of '%s'", + $repeat_type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['repeat_type'] = $repeat_type; + + return $this; + } + + /** + * Gets repeat_interval + * + * @return int|null + */ + public function getRepeatInterval() + { + return $this->container['repeat_interval']; + } + + /** + * Sets repeat_interval + * + * @param int|null $repeat_interval The repeat interval of the event. + * + * @return self + */ + public function setRepeatInterval($repeat_interval) + { + if (is_null($repeat_interval)) { + throw new \InvalidArgumentException('non-nullable repeat_interval cannot be null'); + } + $this->container['repeat_interval'] = $repeat_interval; + + return $this; + } + + /** + * Gets note + * + * @return string|null + */ + public function getNote() + { + return $this->container['note']; + } + + /** + * Sets note + * + * @param string|null $note A note for the event. + * + * @return self + */ + public function setNote($note) + { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } + $this->container['note'] = $note; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/TimeZone.php b/lib/Model/TimeZone.php new file mode 100644 index 0000000..9b8d8fa --- /dev/null +++ b/lib/Model/TimeZone.php @@ -0,0 +1,580 @@ + + */ +class TimeZone implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TimeZone'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'utc_offset' => 'int', + 'formatted_name' => 'string', + 'formatted_offset' => 'string', + 'abbreviation' => 'string', + 'identifier' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'utc_offset' => null, + 'formatted_name' => null, + 'formatted_offset' => null, + 'abbreviation' => null, + 'identifier' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'utc_offset' => false, + 'formatted_name' => false, + 'formatted_offset' => false, + 'abbreviation' => false, + 'identifier' => 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', + 'utc_offset' => 'utc_offset', + 'formatted_name' => 'formatted_name', + 'formatted_offset' => 'formatted_offset', + 'abbreviation' => 'abbreviation', + 'identifier' => 'identifier' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'utc_offset' => 'setUtcOffset', + 'formatted_name' => 'setFormattedName', + 'formatted_offset' => 'setFormattedOffset', + 'abbreviation' => 'setAbbreviation', + 'identifier' => 'setIdentifier' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'utc_offset' => 'getUtcOffset', + 'formatted_name' => 'getFormattedName', + 'formatted_offset' => 'getFormattedOffset', + 'abbreviation' => 'getAbbreviation', + 'identifier' => 'getIdentifier' + ]; + + /** + * 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('utc_offset', $data ?? [], null); + $this->setIfExists('formatted_name', $data ?? [], null); + $this->setIfExists('formatted_offset', $data ?? [], null); + $this->setIfExists('abbreviation', $data ?? [], null); + $this->setIfExists('identifier', $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 The name of the time zone. + * + * @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 utc_offset + * + * @return int|null + */ + public function getUtcOffset() + { + return $this->container['utc_offset']; + } + + /** + * Sets utc_offset + * + * @param int|null $utc_offset The time zone's UTC offset in seconds. + * + * @return self + */ + public function setUtcOffset($utc_offset) + { + if (is_null($utc_offset)) { + throw new \InvalidArgumentException('non-nullable utc_offset cannot be null'); + } + $this->container['utc_offset'] = $utc_offset; + + return $this; + } + + /** + * Gets formatted_name + * + * @return string|null + */ + public function getFormattedName() + { + return $this->container['formatted_name']; + } + + /** + * Sets formatted_name + * + * @param string|null $formatted_name The formatted name of the time zone. + * + * @return self + */ + public function setFormattedName($formatted_name) + { + if (is_null($formatted_name)) { + throw new \InvalidArgumentException('non-nullable formatted_name cannot be null'); + } + $this->container['formatted_name'] = $formatted_name; + + return $this; + } + + /** + * Gets formatted_offset + * + * @return string|null + */ + public function getFormattedOffset() + { + return $this->container['formatted_offset']; + } + + /** + * Sets formatted_offset + * + * @param string|null $formatted_offset The formatted offset of the time zone. + * + * @return self + */ + public function setFormattedOffset($formatted_offset) + { + if (is_null($formatted_offset)) { + throw new \InvalidArgumentException('non-nullable formatted_offset cannot be null'); + } + $this->container['formatted_offset'] = $formatted_offset; + + return $this; + } + + /** + * Gets abbreviation + * + * @return string|null + */ + public function getAbbreviation() + { + return $this->container['abbreviation']; + } + + /** + * Sets abbreviation + * + * @param string|null $abbreviation The abbreviation of the time zone. + * + * @return self + */ + public function setAbbreviation($abbreviation) + { + if (is_null($abbreviation)) { + throw new \InvalidArgumentException('non-nullable abbreviation cannot be null'); + } + $this->container['abbreviation'] = $abbreviation; + + return $this; + } + + /** + * Gets identifier + * + * @return string|null + */ + public function getIdentifier() + { + return $this->container['identifier']; + } + + /** + * Sets identifier + * + * @param string|null $identifier The tz database name of the time zone. + * + * @return self + */ + public function setIdentifier($identifier) + { + if (is_null($identifier)) { + throw new \InvalidArgumentException('non-nullable identifier cannot be null'); + } + $this->container['identifier'] = $identifier; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Transaction.php b/lib/Model/Transaction.php new file mode 100644 index 0000000..883f6a6 --- /dev/null +++ b/lib/Model/Transaction.php @@ -0,0 +1,1124 @@ + + */ +class Transaction implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Transaction'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cheque_number' => 'string', + 'type' => 'string', + 'memo' => 'string', + 'payee' => 'string', + 'amount' => 'float', + 'amount_in_base_currency' => 'float', + 'date' => 'string', + 'is_transfer' => 'bool', + 'category' => '\OpenAPI\Client\Model\Category', + 'note' => 'string', + 'labels' => 'string[]', + 'id' => 'int', + 'original_payee' => 'string', + 'upload_source' => 'string', + 'closing_balance' => 'float', + 'transaction_account' => '\OpenAPI\Client\Model\TransactionAccount', + 'status' => 'string', + 'needs_review' => 'bool', + 'created_at' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cheque_number' => null, + 'type' => null, + 'memo' => null, + 'payee' => null, + 'amount' => null, + 'amount_in_base_currency' => null, + 'date' => null, + 'is_transfer' => null, + 'category' => null, + 'note' => null, + 'labels' => null, + 'id' => null, + 'original_payee' => null, + 'upload_source' => null, + 'closing_balance' => null, + 'transaction_account' => null, + 'status' => null, + 'needs_review' => null, + 'created_at' => null, + 'updated_at' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'cheque_number' => false, + 'type' => false, + 'memo' => false, + 'payee' => false, + 'amount' => false, + 'amount_in_base_currency' => false, + 'date' => false, + 'is_transfer' => false, + 'category' => false, + 'note' => false, + 'labels' => false, + 'id' => false, + 'original_payee' => false, + 'upload_source' => false, + 'closing_balance' => false, + 'transaction_account' => false, + 'status' => false, + 'needs_review' => false, + 'created_at' => false, + 'updated_at' => 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 = [ + 'cheque_number' => 'cheque_number', + 'type' => 'type', + 'memo' => 'memo', + 'payee' => 'payee', + 'amount' => 'amount', + 'amount_in_base_currency' => 'amount_in_base_currency', + 'date' => 'date', + 'is_transfer' => 'is_transfer', + 'category' => 'category', + 'note' => 'note', + 'labels' => 'labels', + 'id' => 'id', + 'original_payee' => 'original_payee', + 'upload_source' => 'upload_source', + 'closing_balance' => 'closing_balance', + 'transaction_account' => 'transaction_account', + 'status' => 'status', + 'needs_review' => 'needs_review', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cheque_number' => 'setChequeNumber', + 'type' => 'setType', + 'memo' => 'setMemo', + 'payee' => 'setPayee', + 'amount' => 'setAmount', + 'amount_in_base_currency' => 'setAmountInBaseCurrency', + 'date' => 'setDate', + 'is_transfer' => 'setIsTransfer', + 'category' => 'setCategory', + 'note' => 'setNote', + 'labels' => 'setLabels', + 'id' => 'setId', + 'original_payee' => 'setOriginalPayee', + 'upload_source' => 'setUploadSource', + 'closing_balance' => 'setClosingBalance', + 'transaction_account' => 'setTransactionAccount', + 'status' => 'setStatus', + 'needs_review' => 'setNeedsReview', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cheque_number' => 'getChequeNumber', + 'type' => 'getType', + 'memo' => 'getMemo', + 'payee' => 'getPayee', + 'amount' => 'getAmount', + 'amount_in_base_currency' => 'getAmountInBaseCurrency', + 'date' => 'getDate', + 'is_transfer' => 'getIsTransfer', + 'category' => 'getCategory', + 'note' => 'getNote', + 'labels' => 'getLabels', + 'id' => 'getId', + 'original_payee' => 'getOriginalPayee', + 'upload_source' => 'getUploadSource', + 'closing_balance' => 'getClosingBalance', + 'transaction_account' => 'getTransactionAccount', + 'status' => 'getStatus', + 'needs_review' => 'getNeedsReview', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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; + } + + public const TYPE_DEBIT = 'debit'; + public const TYPE_CREDIT = 'credit'; + public const STATUS_PENDING = 'pending'; + public const STATUS_POSTED = 'posted'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_DEBIT, + self::TYPE_CREDIT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PENDING, + self::STATUS_POSTED, + ]; + } + + /** + * 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('cheque_number', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('memo', $data ?? [], null); + $this->setIfExists('payee', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('amount_in_base_currency', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('is_transfer', $data ?? [], null); + $this->setIfExists('category', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('labels', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('original_payee', $data ?? [], null); + $this->setIfExists('upload_source', $data ?? [], null); + $this->setIfExists('closing_balance', $data ?? [], null); + $this->setIfExists('transaction_account', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('needs_review', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $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 = []; + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + 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 cheque_number + * + * @return string|null + */ + public function getChequeNumber() + { + return $this->container['cheque_number']; + } + + /** + * Sets cheque_number + * + * @param string|null $cheque_number cheque_number + * + * @return self + */ + public function setChequeNumber($cheque_number) + { + if (is_null($cheque_number)) { + throw new \InvalidArgumentException('non-nullable cheque_number cannot be null'); + } + $this->container['cheque_number'] = $cheque_number; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type Whether the transaction is a debit or a credit + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets memo + * + * @return string|null + */ + public function getMemo() + { + return $this->container['memo']; + } + + /** + * Sets memo + * + * @param string|null $memo memo + * + * @return self + */ + public function setMemo($memo) + { + if (is_null($memo)) { + throw new \InvalidArgumentException('non-nullable memo cannot be null'); + } + $this->container['memo'] = $memo; + + return $this; + } + + /** + * Gets payee + * + * @return string|null + */ + public function getPayee() + { + return $this->container['payee']; + } + + /** + * Sets payee + * + * @param string|null $payee The payee/merchant of the transaction. + * + * @return self + */ + public function setPayee($payee) + { + if (is_null($payee)) { + throw new \InvalidArgumentException('non-nullable payee cannot be null'); + } + $this->container['payee'] = $payee; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount amount + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets amount_in_base_currency + * + * @return float|null + */ + public function getAmountInBaseCurrency() + { + return $this->container['amount_in_base_currency']; + } + + /** + * Sets amount_in_base_currency + * + * @param float|null $amount_in_base_currency The amount of the transaction in the user's base currency. + * + * @return self + */ + public function setAmountInBaseCurrency($amount_in_base_currency) + { + if (is_null($amount_in_base_currency)) { + throw new \InvalidArgumentException('non-nullable amount_in_base_currency cannot be null'); + } + $this->container['amount_in_base_currency'] = $amount_in_base_currency; + + return $this; + } + + /** + * Gets date + * + * @return string|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string|null $date The date the transaction took place. + * + * @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 is_transfer + * + * @return bool|null + */ + public function getIsTransfer() + { + return $this->container['is_transfer']; + } + + /** + * Sets is_transfer + * + * @param bool|null $is_transfer Whether the transaction is a transfer. + * + * @return self + */ + public function setIsTransfer($is_transfer) + { + if (is_null($is_transfer)) { + throw new \InvalidArgumentException('non-nullable is_transfer cannot be null'); + } + $this->container['is_transfer'] = $is_transfer; + + return $this; + } + + /** + * Gets category + * + * @return \OpenAPI\Client\Model\Category|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param \OpenAPI\Client\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 note + * + * @return string|null + */ + public function getNote() + { + return $this->container['note']; + } + + /** + * Sets note + * + * @param string|null $note note + * + * @return self + */ + public function setNote($note) + { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } + $this->container['note'] = $note; + + return $this; + } + + /** + * Gets labels + * + * @return string[]|null + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string[]|null $labels labels + * + * @return self + */ + public function setLabels($labels) + { + if (is_null($labels)) { + throw new \InvalidArgumentException('non-nullable labels cannot be null'); + } + $this->container['labels'] = $labels; + + return $this; + } + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id The unique identifier of the transaction. + * + * @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 original_payee + * + * @return string|null + */ + public function getOriginalPayee() + { + return $this->container['original_payee']; + } + + /** + * Sets original_payee + * + * @param string|null $original_payee The payee the transaction was created with. + * + * @return self + */ + public function setOriginalPayee($original_payee) + { + if (is_null($original_payee)) { + throw new \InvalidArgumentException('non-nullable original_payee cannot be null'); + } + $this->container['original_payee'] = $original_payee; + + return $this; + } + + /** + * Gets upload_source + * + * @return string|null + */ + public function getUploadSource() + { + return $this->container['upload_source']; + } + + /** + * Sets upload_source + * + * @param string|null $upload_source Where the transaction came from. + * + * @return self + */ + public function setUploadSource($upload_source) + { + if (is_null($upload_source)) { + throw new \InvalidArgumentException('non-nullable upload_source cannot be null'); + } + $this->container['upload_source'] = $upload_source; + + return $this; + } + + /** + * Gets closing_balance + * + * @return float|null + */ + public function getClosingBalance() + { + return $this->container['closing_balance']; + } + + /** + * Sets closing_balance + * + * @param float|null $closing_balance The closing balance of the account at the transaction. + * + * @return self + */ + public function setClosingBalance($closing_balance) + { + if (is_null($closing_balance)) { + throw new \InvalidArgumentException('non-nullable closing_balance cannot be null'); + } + $this->container['closing_balance'] = $closing_balance; + + return $this; + } + + /** + * Gets transaction_account + * + * @return \OpenAPI\Client\Model\TransactionAccount|null + */ + public function getTransactionAccount() + { + return $this->container['transaction_account']; + } + + /** + * Sets transaction_account + * + * @param \OpenAPI\Client\Model\TransactionAccount|null $transaction_account transaction_account + * + * @return self + */ + public function setTransactionAccount($transaction_account) + { + if (is_null($transaction_account)) { + throw new \InvalidArgumentException('non-nullable transaction_account cannot be null'); + } + $this->container['transaction_account'] = $transaction_account; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status The status of the transaction. Pending transactions are temporary and may be superseded later by their posted counterparts, which are permanent. + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets needs_review + * + * @return bool|null + */ + public function getNeedsReview() + { + return $this->container['needs_review']; + } + + /** + * Sets needs_review + * + * @param bool|null $needs_review Whether the transaction needs to be reviewed. + * + * @return self + */ + public function setNeedsReview($needs_review) + { + if (is_null($needs_review)) { + throw new \InvalidArgumentException('non-nullable needs_review cannot be null'); + } + $this->container['needs_review'] = $needs_review; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at When the transaction was created. + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at When the transaction was last updated. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/TransactionAccount.php b/lib/Model/TransactionAccount.php new file mode 100644 index 0000000..d2ed3dd --- /dev/null +++ b/lib/Model/TransactionAccount.php @@ -0,0 +1,972 @@ + + */ +class TransactionAccount implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'TransactionAccount'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'name' => 'string', + 'number' => 'string', + 'current_balance' => 'float', + 'current_balance_date' => 'string', + 'current_balance_in_base_currency' => 'float', + 'current_balance_exchange_rate' => 'float', + 'safe_balance' => 'float', + 'safe_balance_in_base_currency' => 'float', + 'starting_balance' => 'float', + 'starting_balance_date' => 'string', + 'created_at' => 'string', + 'updated_at' => 'string', + 'institution' => '\OpenAPI\Client\Model\Institution', + 'currency_code' => 'string', + 'type' => '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, + 'number' => null, + 'current_balance' => null, + 'current_balance_date' => null, + 'current_balance_in_base_currency' => null, + 'current_balance_exchange_rate' => null, + 'safe_balance' => null, + 'safe_balance_in_base_currency' => null, + 'starting_balance' => null, + 'starting_balance_date' => null, + 'created_at' => null, + 'updated_at' => null, + 'institution' => null, + 'currency_code' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'number' => false, + 'current_balance' => false, + 'current_balance_date' => false, + 'current_balance_in_base_currency' => false, + 'current_balance_exchange_rate' => false, + 'safe_balance' => false, + 'safe_balance_in_base_currency' => false, + 'starting_balance' => false, + 'starting_balance_date' => false, + 'created_at' => false, + 'updated_at' => false, + 'institution' => false, + 'currency_code' => 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', + 'number' => 'number', + 'current_balance' => 'current_balance', + 'current_balance_date' => 'current_balance_date', + 'current_balance_in_base_currency' => 'current_balance_in_base_currency', + 'current_balance_exchange_rate' => 'current_balance_exchange_rate', + 'safe_balance' => 'safe_balance', + 'safe_balance_in_base_currency' => 'safe_balance_in_base_currency', + 'starting_balance' => 'starting_balance', + 'starting_balance_date' => 'starting_balance_date', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at', + 'institution' => 'institution', + 'currency_code' => 'currency_code', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'number' => 'setNumber', + 'current_balance' => 'setCurrentBalance', + 'current_balance_date' => 'setCurrentBalanceDate', + 'current_balance_in_base_currency' => 'setCurrentBalanceInBaseCurrency', + 'current_balance_exchange_rate' => 'setCurrentBalanceExchangeRate', + 'safe_balance' => 'setSafeBalance', + 'safe_balance_in_base_currency' => 'setSafeBalanceInBaseCurrency', + 'starting_balance' => 'setStartingBalance', + 'starting_balance_date' => 'setStartingBalanceDate', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'institution' => 'setInstitution', + 'currency_code' => 'setCurrencyCode', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'number' => 'getNumber', + 'current_balance' => 'getCurrentBalance', + 'current_balance_date' => 'getCurrentBalanceDate', + 'current_balance_in_base_currency' => 'getCurrentBalanceInBaseCurrency', + 'current_balance_exchange_rate' => 'getCurrentBalanceExchangeRate', + 'safe_balance' => 'getSafeBalance', + 'safe_balance_in_base_currency' => 'getSafeBalanceInBaseCurrency', + 'starting_balance' => 'getStartingBalance', + 'starting_balance_date' => 'getStartingBalanceDate', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'institution' => 'getInstitution', + 'currency_code' => 'getCurrencyCode', + '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; + } + + public const TYPE_BANK = 'bank'; + public const TYPE_CREDITS = 'credits'; + public const TYPE_CASH = 'cash'; + public const TYPE_STOCKS = 'stocks'; + public const TYPE_MORTGAGE = 'mortgage'; + public const TYPE_LOANS = 'loans'; + public const TYPE_VEHICLE = 'vehicle'; + public const TYPE_PROPERTY = 'property'; + public const TYPE_INSURANCE = 'insurance'; + public const TYPE_OTHER_ASSET = 'other_asset'; + public const TYPE_OTHER_LIABILITY = 'other_liability'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_BANK, + self::TYPE_CREDITS, + self::TYPE_CASH, + self::TYPE_STOCKS, + self::TYPE_MORTGAGE, + self::TYPE_LOANS, + self::TYPE_VEHICLE, + self::TYPE_PROPERTY, + self::TYPE_INSURANCE, + self::TYPE_OTHER_ASSET, + self::TYPE_OTHER_LIABILITY, + ]; + } + + /** + * 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('number', $data ?? [], null); + $this->setIfExists('current_balance', $data ?? [], null); + $this->setIfExists('current_balance_date', $data ?? [], null); + $this->setIfExists('current_balance_in_base_currency', $data ?? [], null); + $this->setIfExists('current_balance_exchange_rate', $data ?? [], null); + $this->setIfExists('safe_balance', $data ?? [], null); + $this->setIfExists('safe_balance_in_base_currency', $data ?? [], null); + $this->setIfExists('starting_balance', $data ?? [], null); + $this->setIfExists('starting_balance_date', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('institution', $data ?? [], null); + $this->setIfExists('currency_code', $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 = []; + + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + 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 number + * + * @return string|null + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param string|null $number number + * + * @return self + */ + public function setNumber($number) + { + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets current_balance + * + * @return float|null + */ + public function getCurrentBalance() + { + return $this->container['current_balance']; + } + + /** + * Sets current_balance + * + * @param float|null $current_balance current_balance + * + * @return self + */ + public function setCurrentBalance($current_balance) + { + if (is_null($current_balance)) { + throw new \InvalidArgumentException('non-nullable current_balance cannot be null'); + } + $this->container['current_balance'] = $current_balance; + + return $this; + } + + /** + * Gets current_balance_date + * + * @return string|null + */ + public function getCurrentBalanceDate() + { + return $this->container['current_balance_date']; + } + + /** + * Sets current_balance_date + * + * @param string|null $current_balance_date current_balance_date + * + * @return self + */ + public function setCurrentBalanceDate($current_balance_date) + { + if (is_null($current_balance_date)) { + throw new \InvalidArgumentException('non-nullable current_balance_date cannot be null'); + } + $this->container['current_balance_date'] = $current_balance_date; + + return $this; + } + + /** + * Gets current_balance_in_base_currency + * + * @return float|null + */ + public function getCurrentBalanceInBaseCurrency() + { + return $this->container['current_balance_in_base_currency']; + } + + /** + * Sets current_balance_in_base_currency + * + * @param float|null $current_balance_in_base_currency The current balance of the transaction account in the user's base currency. + * + * @return self + */ + public function setCurrentBalanceInBaseCurrency($current_balance_in_base_currency) + { + if (is_null($current_balance_in_base_currency)) { + throw new \InvalidArgumentException('non-nullable current_balance_in_base_currency cannot be null'); + } + $this->container['current_balance_in_base_currency'] = $current_balance_in_base_currency; + + return $this; + } + + /** + * Gets current_balance_exchange_rate + * + * @return float|null + */ + public function getCurrentBalanceExchangeRate() + { + return $this->container['current_balance_exchange_rate']; + } + + /** + * Sets current_balance_exchange_rate + * + * @param float|null $current_balance_exchange_rate The exchange rate between the transaction account's currency and the user's base currency, when different. If the currencies are the same, null is returned. + * + * @return self + */ + public function setCurrentBalanceExchangeRate($current_balance_exchange_rate) + { + if (is_null($current_balance_exchange_rate)) { + throw new \InvalidArgumentException('non-nullable current_balance_exchange_rate cannot be null'); + } + $this->container['current_balance_exchange_rate'] = $current_balance_exchange_rate; + + return $this; + } + + /** + * Gets safe_balance + * + * @return float|null + */ + public function getSafeBalance() + { + return $this->container['safe_balance']; + } + + /** + * Sets safe_balance + * + * @param float|null $safe_balance The current safe balance, if safe balance is activated and available for the transaction account. If safe balance is not available, then null is returned. + * + * @return self + */ + public function setSafeBalance($safe_balance) + { + if (is_null($safe_balance)) { + throw new \InvalidArgumentException('non-nullable safe_balance cannot be null'); + } + $this->container['safe_balance'] = $safe_balance; + + return $this; + } + + /** + * Gets safe_balance_in_base_currency + * + * @return float|null + */ + public function getSafeBalanceInBaseCurrency() + { + return $this->container['safe_balance_in_base_currency']; + } + + /** + * Sets safe_balance_in_base_currency + * + * @param float|null $safe_balance_in_base_currency The current safe balance in the user's base currency, if safe balance is activated and available for the transaction account. If safe balance is not available, then null is returned. + * + * @return self + */ + public function setSafeBalanceInBaseCurrency($safe_balance_in_base_currency) + { + if (is_null($safe_balance_in_base_currency)) { + throw new \InvalidArgumentException('non-nullable safe_balance_in_base_currency cannot be null'); + } + $this->container['safe_balance_in_base_currency'] = $safe_balance_in_base_currency; + + return $this; + } + + /** + * Gets starting_balance + * + * @return float|null + */ + public function getStartingBalance() + { + return $this->container['starting_balance']; + } + + /** + * Sets starting_balance + * + * @param float|null $starting_balance starting_balance + * + * @return self + */ + public function setStartingBalance($starting_balance) + { + if (is_null($starting_balance)) { + throw new \InvalidArgumentException('non-nullable starting_balance cannot be null'); + } + $this->container['starting_balance'] = $starting_balance; + + return $this; + } + + /** + * Gets starting_balance_date + * + * @return string|null + */ + public function getStartingBalanceDate() + { + return $this->container['starting_balance_date']; + } + + /** + * Sets starting_balance_date + * + * @param string|null $starting_balance_date starting_balance_date + * + * @return self + */ + public function setStartingBalanceDate($starting_balance_date) + { + if (is_null($starting_balance_date)) { + throw new \InvalidArgumentException('non-nullable starting_balance_date cannot be null'); + } + $this->container['starting_balance_date'] = $starting_balance_date; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at created_at + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at updated_at + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets institution + * + * @return \OpenAPI\Client\Model\Institution|null + */ + public function getInstitution() + { + return $this->container['institution']; + } + + /** + * Sets institution + * + * @param \OpenAPI\Client\Model\Institution|null $institution institution + * + * @return self + */ + public function setInstitution($institution) + { + if (is_null($institution)) { + throw new \InvalidArgumentException('non-nullable institution cannot be null'); + } + $this->container['institution'] = $institution; + + return $this; + } + + /** + * Gets currency_code + * + * @return string|null + */ + public function getCurrencyCode() + { + return $this->container['currency_code']; + } + + /** + * Sets currency_code + * + * @param string|null $currency_code The currency that the account is in. This is determined by the account that the transaction account belongs to. + * + * @return self + */ + public function setCurrencyCode($currency_code) + { + if (is_null($currency_code)) { + throw new \InvalidArgumentException('non-nullable currency_code cannot be null'); + } + $this->container['currency_code'] = $currency_code; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type The type of the transaction account. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $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/lib/Model/TransactionAccountsIdPutRequest.php b/lib/Model/TransactionAccountsIdPutRequest.php new file mode 100644 index 0000000..153dd83 --- /dev/null +++ b/lib/Model/TransactionAccountsIdPutRequest.php @@ -0,0 +1,478 @@ + + */ +class TransactionAccountsIdPutRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_transaction_accounts__id__put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'institution_id' => 'int', + 'starting_balance' => 'float', + 'starting_balance_date' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'institution_id' => null, + 'starting_balance' => null, + 'starting_balance_date' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'institution_id' => false, + 'starting_balance' => false, + 'starting_balance_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 = [ + 'institution_id' => 'institution_id', + 'starting_balance' => 'starting_balance', + 'starting_balance_date' => 'starting_balance_date' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'institution_id' => 'setInstitutionId', + 'starting_balance' => 'setStartingBalance', + 'starting_balance_date' => 'setStartingBalanceDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'institution_id' => 'getInstitutionId', + 'starting_balance' => 'getStartingBalance', + 'starting_balance_date' => 'getStartingBalanceDate' + ]; + + /** + * 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('institution_id', $data ?? [], null); + $this->setIfExists('starting_balance', $data ?? [], null); + $this->setIfExists('starting_balance_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 institution_id + * + * @return int|null + */ + public function getInstitutionId() + { + return $this->container['institution_id']; + } + + /** + * Sets institution_id + * + * @param int|null $institution_id The unique identifier of a new institution for the transaction account. + * + * @return self + */ + public function setInstitutionId($institution_id) + { + if (is_null($institution_id)) { + throw new \InvalidArgumentException('non-nullable institution_id cannot be null'); + } + $this->container['institution_id'] = $institution_id; + + return $this; + } + + /** + * Gets starting_balance + * + * @return float|null + */ + public function getStartingBalance() + { + return $this->container['starting_balance']; + } + + /** + * Sets starting_balance + * + * @param float|null $starting_balance The starting balance amount of the transaction account. + * + * @return self + */ + public function setStartingBalance($starting_balance) + { + if (is_null($starting_balance)) { + throw new \InvalidArgumentException('non-nullable starting_balance cannot be null'); + } + $this->container['starting_balance'] = $starting_balance; + + return $this; + } + + /** + * Gets starting_balance_date + * + * @return string|null + */ + public function getStartingBalanceDate() + { + return $this->container['starting_balance_date']; + } + + /** + * Sets starting_balance_date + * + * @param string|null $starting_balance_date The starting balance date of the transaction account. + * + * @return self + */ + public function setStartingBalanceDate($starting_balance_date) + { + if (is_null($starting_balance_date)) { + throw new \InvalidArgumentException('non-nullable starting_balance_date cannot be null'); + } + $this->container['starting_balance_date'] = $starting_balance_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/lib/Model/TransactionAccountsIdTransactionsPostRequest.php b/lib/Model/TransactionAccountsIdTransactionsPostRequest.php new file mode 100644 index 0000000..d9a6587 --- /dev/null +++ b/lib/Model/TransactionAccountsIdTransactionsPostRequest.php @@ -0,0 +1,725 @@ + + */ +class TransactionAccountsIdTransactionsPostRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_transaction_accounts__id__transactions_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'payee' => 'string', + 'amount' => 'float', + 'date' => 'string', + 'is_transfer' => 'bool', + 'labels' => 'string', + 'category_id' => 'int', + 'note' => 'string', + 'memo' => 'string', + 'cheque_number' => 'string', + 'needs_review' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'payee' => null, + 'amount' => null, + 'date' => null, + 'is_transfer' => null, + 'labels' => null, + 'category_id' => null, + 'note' => null, + 'memo' => null, + 'cheque_number' => null, + 'needs_review' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'payee' => false, + 'amount' => false, + 'date' => false, + 'is_transfer' => false, + 'labels' => false, + 'category_id' => false, + 'note' => false, + 'memo' => false, + 'cheque_number' => false, + 'needs_review' => 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 = [ + 'payee' => 'payee', + 'amount' => 'amount', + 'date' => 'date', + 'is_transfer' => 'is_transfer', + 'labels' => 'labels', + 'category_id' => 'category_id', + 'note' => 'note', + 'memo' => 'memo', + 'cheque_number' => 'cheque_number', + 'needs_review' => 'needs_review' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'payee' => 'setPayee', + 'amount' => 'setAmount', + 'date' => 'setDate', + 'is_transfer' => 'setIsTransfer', + 'labels' => 'setLabels', + 'category_id' => 'setCategoryId', + 'note' => 'setNote', + 'memo' => 'setMemo', + 'cheque_number' => 'setChequeNumber', + 'needs_review' => 'setNeedsReview' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'payee' => 'getPayee', + 'amount' => 'getAmount', + 'date' => 'getDate', + 'is_transfer' => 'getIsTransfer', + 'labels' => 'getLabels', + 'category_id' => 'getCategoryId', + 'note' => 'getNote', + 'memo' => 'getMemo', + 'cheque_number' => 'getChequeNumber', + 'needs_review' => 'getNeedsReview' + ]; + + /** + * 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('payee', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('is_transfer', $data ?? [], null); + $this->setIfExists('labels', $data ?? [], null); + $this->setIfExists('category_id', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('memo', $data ?? [], null); + $this->setIfExists('cheque_number', $data ?? [], null); + $this->setIfExists('needs_review', $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['payee'] === null) { + $invalidProperties[] = "'payee' can't be null"; + } + if ($this->container['amount'] === null) { + $invalidProperties[] = "'amount' can't be null"; + } + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' 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 payee + * + * @return string + */ + public function getPayee() + { + return $this->container['payee']; + } + + /** + * Sets payee + * + * @param string $payee The payee/merchant of the transaction. + * + * @return self + */ + public function setPayee($payee) + { + if (is_null($payee)) { + throw new \InvalidArgumentException('non-nullable payee cannot be null'); + } + $this->container['payee'] = $payee; + + return $this; + } + + /** + * Gets amount + * + * @return float + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float $amount The amount of the transaction. A positive amount is a credit, and a negative amount is a debit. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets date + * + * @return string + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string $date The date when the transaction occurred. + * + * @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 is_transfer + * + * @return bool|null + */ + public function getIsTransfer() + { + return $this->container['is_transfer']; + } + + /** + * Sets is_transfer + * + * @param bool|null $is_transfer Whether the transaction should be indicated as a transfer. + * + * @return self + */ + public function setIsTransfer($is_transfer) + { + if (is_null($is_transfer)) { + throw new \InvalidArgumentException('non-nullable is_transfer cannot be null'); + } + $this->container['is_transfer'] = $is_transfer; + + return $this; + } + + /** + * Gets labels + * + * @return string|null + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string|null $labels A set of comma-separated labels for the transaction. + * + * @return self + */ + public function setLabels($labels) + { + if (is_null($labels)) { + throw new \InvalidArgumentException('non-nullable labels cannot be null'); + } + $this->container['labels'] = $labels; + + return $this; + } + + /** + * Gets category_id + * + * @return int|null + */ + public function getCategoryId() + { + return $this->container['category_id']; + } + + /** + * Sets category_id + * + * @param int|null $category_id The unique identifier of a category for the transaction. + * + * @return self + */ + public function setCategoryId($category_id) + { + if (is_null($category_id)) { + throw new \InvalidArgumentException('non-nullable category_id cannot be null'); + } + $this->container['category_id'] = $category_id; + + return $this; + } + + /** + * Gets note + * + * @return string|null + */ + public function getNote() + { + return $this->container['note']; + } + + /** + * Sets note + * + * @param string|null $note A note for the transaction. + * + * @return self + */ + public function setNote($note) + { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } + $this->container['note'] = $note; + + return $this; + } + + /** + * Gets memo + * + * @return string|null + */ + public function getMemo() + { + return $this->container['memo']; + } + + /** + * Sets memo + * + * @param string|null $memo A memo for the transaction. + * + * @return self + */ + public function setMemo($memo) + { + if (is_null($memo)) { + throw new \InvalidArgumentException('non-nullable memo cannot be null'); + } + $this->container['memo'] = $memo; + + return $this; + } + + /** + * Gets cheque_number + * + * @return string|null + */ + public function getChequeNumber() + { + return $this->container['cheque_number']; + } + + /** + * Sets cheque_number + * + * @param string|null $cheque_number A cheque number for the transaction. + * + * @return self + */ + public function setChequeNumber($cheque_number) + { + if (is_null($cheque_number)) { + throw new \InvalidArgumentException('non-nullable cheque_number cannot be null'); + } + $this->container['cheque_number'] = $cheque_number; + + return $this; + } + + /** + * Gets needs_review + * + * @return bool|null + */ + public function getNeedsReview() + { + return $this->container['needs_review']; + } + + /** + * Sets needs_review + * + * @param bool|null $needs_review Whether the transaction needs to be reviewed or not. + * + * @return self + */ + public function setNeedsReview($needs_review) + { + if (is_null($needs_review)) { + throw new \InvalidArgumentException('non-nullable needs_review cannot be null'); + } + $this->container['needs_review'] = $needs_review; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/TransactionsIdAttachmentsPostRequest.php b/lib/Model/TransactionsIdAttachmentsPostRequest.php new file mode 100644 index 0000000..5df3f96 --- /dev/null +++ b/lib/Model/TransactionsIdAttachmentsPostRequest.php @@ -0,0 +1,410 @@ + + */ +class TransactionsIdAttachmentsPostRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_transactions__id__attachments_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'attachment_id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'attachment_id' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'attachment_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 = [ + 'attachment_id' => 'attachment_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'attachment_id' => 'setAttachmentId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'attachment_id' => 'getAttachmentId' + ]; + + /** + * 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('attachment_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 attachment_id + * + * @return int|null + */ + public function getAttachmentId() + { + return $this->container['attachment_id']; + } + + /** + * Sets attachment_id + * + * @param int|null $attachment_id The unique identifier of the attachment. + * + * @return self + */ + public function setAttachmentId($attachment_id) + { + if (is_null($attachment_id)) { + throw new \InvalidArgumentException('non-nullable attachment_id cannot be null'); + } + $this->container['attachment_id'] = $attachment_id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/TransactionsIdPutRequest.php b/lib/Model/TransactionsIdPutRequest.php new file mode 100644 index 0000000..123b3bc --- /dev/null +++ b/lib/Model/TransactionsIdPutRequest.php @@ -0,0 +1,716 @@ + + */ +class TransactionsIdPutRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_transactions__id__put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'memo' => 'string', + 'cheque_number' => 'string', + 'payee' => 'string', + 'amount' => 'float', + 'date' => 'string', + 'is_transfer' => 'bool', + 'category_id' => 'int', + 'note' => 'string', + 'needs_review' => 'bool', + 'labels' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'memo' => null, + 'cheque_number' => null, + 'payee' => null, + 'amount' => null, + 'date' => null, + 'is_transfer' => null, + 'category_id' => null, + 'note' => null, + 'needs_review' => null, + 'labels' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'memo' => false, + 'cheque_number' => false, + 'payee' => false, + 'amount' => false, + 'date' => false, + 'is_transfer' => false, + 'category_id' => false, + 'note' => false, + 'needs_review' => false, + 'labels' => 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 = [ + 'memo' => 'memo', + 'cheque_number' => 'cheque_number', + 'payee' => 'payee', + 'amount' => 'amount', + 'date' => 'date', + 'is_transfer' => 'is_transfer', + 'category_id' => 'category_id', + 'note' => 'note', + 'needs_review' => 'needs_review', + 'labels' => 'labels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'memo' => 'setMemo', + 'cheque_number' => 'setChequeNumber', + 'payee' => 'setPayee', + 'amount' => 'setAmount', + 'date' => 'setDate', + 'is_transfer' => 'setIsTransfer', + 'category_id' => 'setCategoryId', + 'note' => 'setNote', + 'needs_review' => 'setNeedsReview', + 'labels' => 'setLabels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'memo' => 'getMemo', + 'cheque_number' => 'getChequeNumber', + 'payee' => 'getPayee', + 'amount' => 'getAmount', + 'date' => 'getDate', + 'is_transfer' => 'getIsTransfer', + 'category_id' => 'getCategoryId', + 'note' => 'getNote', + 'needs_review' => 'getNeedsReview', + 'labels' => 'getLabels' + ]; + + /** + * 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('memo', $data ?? [], null); + $this->setIfExists('cheque_number', $data ?? [], null); + $this->setIfExists('payee', $data ?? [], null); + $this->setIfExists('amount', $data ?? [], null); + $this->setIfExists('date', $data ?? [], null); + $this->setIfExists('is_transfer', $data ?? [], null); + $this->setIfExists('category_id', $data ?? [], null); + $this->setIfExists('note', $data ?? [], null); + $this->setIfExists('needs_review', $data ?? [], null); + $this->setIfExists('labels', $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 memo + * + * @return string|null + */ + public function getMemo() + { + return $this->container['memo']; + } + + /** + * Sets memo + * + * @param string|null $memo A new memo for the transaction. + * + * @return self + */ + public function setMemo($memo) + { + if (is_null($memo)) { + throw new \InvalidArgumentException('non-nullable memo cannot be null'); + } + $this->container['memo'] = $memo; + + return $this; + } + + /** + * Gets cheque_number + * + * @return string|null + */ + public function getChequeNumber() + { + return $this->container['cheque_number']; + } + + /** + * Sets cheque_number + * + * @param string|null $cheque_number A new cheque number for the transaction. + * + * @return self + */ + public function setChequeNumber($cheque_number) + { + if (is_null($cheque_number)) { + throw new \InvalidArgumentException('non-nullable cheque_number cannot be null'); + } + $this->container['cheque_number'] = $cheque_number; + + return $this; + } + + /** + * Gets payee + * + * @return string|null + */ + public function getPayee() + { + return $this->container['payee']; + } + + /** + * Sets payee + * + * @param string|null $payee A new payee for the transaction. + * + * @return self + */ + public function setPayee($payee) + { + if (is_null($payee)) { + throw new \InvalidArgumentException('non-nullable payee cannot be null'); + } + $this->container['payee'] = $payee; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount A new amount for the transaction. + * + * @return self + */ + public function setAmount($amount) + { + if (is_null($amount)) { + throw new \InvalidArgumentException('non-nullable amount cannot be null'); + } + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets date + * + * @return string|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string|null $date A new date for the transaction. + * + * @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 is_transfer + * + * @return bool|null + */ + public function getIsTransfer() + { + return $this->container['is_transfer']; + } + + /** + * Sets is_transfer + * + * @param bool|null $is_transfer Whether the transaction is a transfer or not. + * + * @return self + */ + public function setIsTransfer($is_transfer) + { + if (is_null($is_transfer)) { + throw new \InvalidArgumentException('non-nullable is_transfer cannot be null'); + } + $this->container['is_transfer'] = $is_transfer; + + return $this; + } + + /** + * Gets category_id + * + * @return int|null + */ + public function getCategoryId() + { + return $this->container['category_id']; + } + + /** + * Sets category_id + * + * @param int|null $category_id The unique identifier of a new category for the transaction. + * + * @return self + */ + public function setCategoryId($category_id) + { + if (is_null($category_id)) { + throw new \InvalidArgumentException('non-nullable category_id cannot be null'); + } + $this->container['category_id'] = $category_id; + + return $this; + } + + /** + * Gets note + * + * @return string|null + */ + public function getNote() + { + return $this->container['note']; + } + + /** + * Sets note + * + * @param string|null $note A new note for the transaction. + * + * @return self + */ + public function setNote($note) + { + if (is_null($note)) { + throw new \InvalidArgumentException('non-nullable note cannot be null'); + } + $this->container['note'] = $note; + + return $this; + } + + /** + * Gets needs_review + * + * @return bool|null + */ + public function getNeedsReview() + { + return $this->container['needs_review']; + } + + /** + * Sets needs_review + * + * @param bool|null $needs_review Whether the transaction needs to be reviewed or not. + * + * @return self + */ + public function setNeedsReview($needs_review) + { + if (is_null($needs_review)) { + throw new \InvalidArgumentException('non-nullable needs_review cannot be null'); + } + $this->container['needs_review'] = $needs_review; + + return $this; + } + + /** + * Gets labels + * + * @return string|null + */ + public function getLabels() + { + return $this->container['labels']; + } + + /** + * Sets labels + * + * @param string|null $labels A new comma-separated set of labels for the transaction. + * + * @return self + */ + public function setLabels($labels) + { + if (is_null($labels)) { + throw new \InvalidArgumentException('non-nullable labels cannot be null'); + } + $this->container['labels'] = $labels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/User.php b/lib/Model/User.php new file mode 100644 index 0000000..5dd8b07 --- /dev/null +++ b/lib/Model/User.php @@ -0,0 +1,1192 @@ + + */ +class User implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'User'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'login' => 'string', + 'name' => 'string', + 'email' => 'string', + 'avatar_url' => 'string', + 'beta_user' => 'bool', + 'time_zone' => 'string', + 'week_start_day' => 'int', + 'is_reviewing_transactions' => 'bool', + 'base_currency_code' => 'string', + 'always_show_base_currency' => 'bool', + 'using_multiple_currencies' => 'bool', + 'available_accounts' => 'int', + 'available_budgets' => 'int', + 'forecast_last_updated_at' => 'string', + 'forecast_last_accessed_at' => 'string', + 'forecast_start_date' => 'string', + 'forecast_end_date' => 'string', + 'forecast_defer_recalculate' => 'bool', + 'forecast_needs_recalculate' => 'bool', + 'last_logged_in_at' => 'string', + 'last_activity_at' => 'string', + 'created_at' => 'string', + 'updated_at' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'login' => null, + 'name' => null, + 'email' => null, + 'avatar_url' => null, + 'beta_user' => null, + 'time_zone' => null, + 'week_start_day' => null, + 'is_reviewing_transactions' => null, + 'base_currency_code' => null, + 'always_show_base_currency' => null, + 'using_multiple_currencies' => null, + 'available_accounts' => null, + 'available_budgets' => null, + 'forecast_last_updated_at' => null, + 'forecast_last_accessed_at' => null, + 'forecast_start_date' => null, + 'forecast_end_date' => null, + 'forecast_defer_recalculate' => null, + 'forecast_needs_recalculate' => null, + 'last_logged_in_at' => null, + 'last_activity_at' => null, + 'created_at' => null, + 'updated_at' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'login' => false, + 'name' => false, + 'email' => false, + 'avatar_url' => false, + 'beta_user' => false, + 'time_zone' => false, + 'week_start_day' => false, + 'is_reviewing_transactions' => false, + 'base_currency_code' => false, + 'always_show_base_currency' => false, + 'using_multiple_currencies' => false, + 'available_accounts' => false, + 'available_budgets' => false, + 'forecast_last_updated_at' => false, + 'forecast_last_accessed_at' => false, + 'forecast_start_date' => false, + 'forecast_end_date' => false, + 'forecast_defer_recalculate' => false, + 'forecast_needs_recalculate' => false, + 'last_logged_in_at' => false, + 'last_activity_at' => false, + 'created_at' => false, + 'updated_at' => 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', + 'login' => 'login', + 'name' => 'name', + 'email' => 'email', + 'avatar_url' => 'avatar_url', + 'beta_user' => 'beta_user', + 'time_zone' => 'time_zone', + 'week_start_day' => 'week_start_day', + 'is_reviewing_transactions' => 'is_reviewing_transactions', + 'base_currency_code' => 'base_currency_code', + 'always_show_base_currency' => 'always_show_base_currency', + 'using_multiple_currencies' => 'using_multiple_currencies', + 'available_accounts' => 'available_accounts', + 'available_budgets' => 'available_budgets', + 'forecast_last_updated_at' => 'forecast_last_updated_at', + 'forecast_last_accessed_at' => 'forecast_last_accessed_at', + 'forecast_start_date' => 'forecast_start_date', + 'forecast_end_date' => 'forecast_end_date', + 'forecast_defer_recalculate' => 'forecast_defer_recalculate', + 'forecast_needs_recalculate' => 'forecast_needs_recalculate', + 'last_logged_in_at' => 'last_logged_in_at', + 'last_activity_at' => 'last_activity_at', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'login' => 'setLogin', + 'name' => 'setName', + 'email' => 'setEmail', + 'avatar_url' => 'setAvatarUrl', + 'beta_user' => 'setBetaUser', + 'time_zone' => 'setTimeZone', + 'week_start_day' => 'setWeekStartDay', + 'is_reviewing_transactions' => 'setIsReviewingTransactions', + 'base_currency_code' => 'setBaseCurrencyCode', + 'always_show_base_currency' => 'setAlwaysShowBaseCurrency', + 'using_multiple_currencies' => 'setUsingMultipleCurrencies', + 'available_accounts' => 'setAvailableAccounts', + 'available_budgets' => 'setAvailableBudgets', + 'forecast_last_updated_at' => 'setForecastLastUpdatedAt', + 'forecast_last_accessed_at' => 'setForecastLastAccessedAt', + 'forecast_start_date' => 'setForecastStartDate', + 'forecast_end_date' => 'setForecastEndDate', + 'forecast_defer_recalculate' => 'setForecastDeferRecalculate', + 'forecast_needs_recalculate' => 'setForecastNeedsRecalculate', + 'last_logged_in_at' => 'setLastLoggedInAt', + 'last_activity_at' => 'setLastActivityAt', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'login' => 'getLogin', + 'name' => 'getName', + 'email' => 'getEmail', + 'avatar_url' => 'getAvatarUrl', + 'beta_user' => 'getBetaUser', + 'time_zone' => 'getTimeZone', + 'week_start_day' => 'getWeekStartDay', + 'is_reviewing_transactions' => 'getIsReviewingTransactions', + 'base_currency_code' => 'getBaseCurrencyCode', + 'always_show_base_currency' => 'getAlwaysShowBaseCurrency', + 'using_multiple_currencies' => 'getUsingMultipleCurrencies', + 'available_accounts' => 'getAvailableAccounts', + 'available_budgets' => 'getAvailableBudgets', + 'forecast_last_updated_at' => 'getForecastLastUpdatedAt', + 'forecast_last_accessed_at' => 'getForecastLastAccessedAt', + 'forecast_start_date' => 'getForecastStartDate', + 'forecast_end_date' => 'getForecastEndDate', + 'forecast_defer_recalculate' => 'getForecastDeferRecalculate', + 'forecast_needs_recalculate' => 'getForecastNeedsRecalculate', + 'last_logged_in_at' => 'getLastLoggedInAt', + 'last_activity_at' => 'getLastActivityAt', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt' + ]; + + /** + * 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('login', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('avatar_url', $data ?? [], null); + $this->setIfExists('beta_user', $data ?? [], null); + $this->setIfExists('time_zone', $data ?? [], null); + $this->setIfExists('week_start_day', $data ?? [], null); + $this->setIfExists('is_reviewing_transactions', $data ?? [], null); + $this->setIfExists('base_currency_code', $data ?? [], null); + $this->setIfExists('always_show_base_currency', $data ?? [], null); + $this->setIfExists('using_multiple_currencies', $data ?? [], null); + $this->setIfExists('available_accounts', $data ?? [], null); + $this->setIfExists('available_budgets', $data ?? [], null); + $this->setIfExists('forecast_last_updated_at', $data ?? [], null); + $this->setIfExists('forecast_last_accessed_at', $data ?? [], null); + $this->setIfExists('forecast_start_date', $data ?? [], null); + $this->setIfExists('forecast_end_date', $data ?? [], null); + $this->setIfExists('forecast_defer_recalculate', $data ?? [], null); + $this->setIfExists('forecast_needs_recalculate', $data ?? [], null); + $this->setIfExists('last_logged_in_at', $data ?? [], null); + $this->setIfExists('last_activity_at', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $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 unique identifier of the user. + * + * @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 login + * + * @return string|null + */ + public function getLogin() + { + return $this->container['login']; + } + + /** + * Sets login + * + * @param string|null $login The user's username. + * + * @return self + */ + public function setLogin($login) + { + if (is_null($login)) { + throw new \InvalidArgumentException('non-nullable login cannot be null'); + } + $this->container['login'] = $login; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The full name of the user, although not all users will have a name set. + * + * @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 email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email The user's email address. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets avatar_url + * + * @return string|null + */ + public function getAvatarUrl() + { + return $this->container['avatar_url']; + } + + /** + * Sets avatar_url + * + * @param string|null $avatar_url The URL to the user's avatar. + * + * @return self + */ + public function setAvatarUrl($avatar_url) + { + if (is_null($avatar_url)) { + throw new \InvalidArgumentException('non-nullable avatar_url cannot be null'); + } + $this->container['avatar_url'] = $avatar_url; + + return $this; + } + + /** + * Gets beta_user + * + * @return bool|null + */ + public function getBetaUser() + { + return $this->container['beta_user']; + } + + /** + * Sets beta_user + * + * @param bool|null $beta_user Whether the user has opted in to beta features. + * + * @return self + */ + public function setBetaUser($beta_user) + { + if (is_null($beta_user)) { + throw new \InvalidArgumentException('non-nullable beta_user cannot be null'); + } + $this->container['beta_user'] = $beta_user; + + return $this; + } + + /** + * Gets time_zone + * + * @return string|null + */ + public function getTimeZone() + { + return $this->container['time_zone']; + } + + /** + * Sets time_zone + * + * @param string|null $time_zone The user's time zone. + * + * @return self + */ + public function setTimeZone($time_zone) + { + if (is_null($time_zone)) { + throw new \InvalidArgumentException('non-nullable time_zone cannot be null'); + } + $this->container['time_zone'] = $time_zone; + + return $this; + } + + /** + * Gets week_start_day + * + * @return int|null + */ + public function getWeekStartDay() + { + return $this->container['week_start_day']; + } + + /** + * Sets week_start_day + * + * @param int|null $week_start_day The day of the week the user wishes their calendars to start on. A number between 0 and 6, where 0 is Sunday and 6 is Saturday. + * + * @return self + */ + public function setWeekStartDay($week_start_day) + { + if (is_null($week_start_day)) { + throw new \InvalidArgumentException('non-nullable week_start_day cannot be null'); + } + $this->container['week_start_day'] = $week_start_day; + + return $this; + } + + /** + * Gets is_reviewing_transactions + * + * @return bool|null + */ + public function getIsReviewingTransactions() + { + return $this->container['is_reviewing_transactions']; + } + + /** + * Sets is_reviewing_transactions + * + * @param bool|null $is_reviewing_transactions Whether the user wants to review new transactions, transfer transactions or categorisation. + * + * @return self + */ + public function setIsReviewingTransactions($is_reviewing_transactions) + { + if (is_null($is_reviewing_transactions)) { + throw new \InvalidArgumentException('non-nullable is_reviewing_transactions cannot be null'); + } + $this->container['is_reviewing_transactions'] = $is_reviewing_transactions; + + return $this; + } + + /** + * Gets base_currency_code + * + * @return string|null + */ + public function getBaseCurrencyCode() + { + return $this->container['base_currency_code']; + } + + /** + * Sets base_currency_code + * + * @param string|null $base_currency_code The user's base currency. + * + * @return self + */ + public function setBaseCurrencyCode($base_currency_code) + { + if (is_null($base_currency_code)) { + throw new \InvalidArgumentException('non-nullable base_currency_code cannot be null'); + } + $this->container['base_currency_code'] = $base_currency_code; + + return $this; + } + + /** + * Gets always_show_base_currency + * + * @return bool|null + */ + public function getAlwaysShowBaseCurrency() + { + return $this->container['always_show_base_currency']; + } + + /** + * Sets always_show_base_currency + * + * @param bool|null $always_show_base_currency Whether the user wants to see all accounts in their base currency instead of the native account currency. + * + * @return self + */ + public function setAlwaysShowBaseCurrency($always_show_base_currency) + { + if (is_null($always_show_base_currency)) { + throw new \InvalidArgumentException('non-nullable always_show_base_currency cannot be null'); + } + $this->container['always_show_base_currency'] = $always_show_base_currency; + + return $this; + } + + /** + * Gets using_multiple_currencies + * + * @return bool|null + */ + public function getUsingMultipleCurrencies() + { + return $this->container['using_multiple_currencies']; + } + + /** + * Sets using_multiple_currencies + * + * @param bool|null $using_multiple_currencies Whether the user has multiple currencies in use across their account. + * + * @return self + */ + public function setUsingMultipleCurrencies($using_multiple_currencies) + { + if (is_null($using_multiple_currencies)) { + throw new \InvalidArgumentException('non-nullable using_multiple_currencies cannot be null'); + } + $this->container['using_multiple_currencies'] = $using_multiple_currencies; + + return $this; + } + + /** + * Gets available_accounts + * + * @return int|null + */ + public function getAvailableAccounts() + { + return $this->container['available_accounts']; + } + + /** + * Sets available_accounts + * + * @param int|null $available_accounts The user's total number of available accounts. + * + * @return self + */ + public function setAvailableAccounts($available_accounts) + { + if (is_null($available_accounts)) { + throw new \InvalidArgumentException('non-nullable available_accounts cannot be null'); + } + $this->container['available_accounts'] = $available_accounts; + + return $this; + } + + /** + * Gets available_budgets + * + * @return int|null + */ + public function getAvailableBudgets() + { + return $this->container['available_budgets']; + } + + /** + * Sets available_budgets + * + * @param int|null $available_budgets The user's total number of available budgets. + * + * @return self + */ + public function setAvailableBudgets($available_budgets) + { + if (is_null($available_budgets)) { + throw new \InvalidArgumentException('non-nullable available_budgets cannot be null'); + } + $this->container['available_budgets'] = $available_budgets; + + return $this; + } + + /** + * Gets forecast_last_updated_at + * + * @return string|null + */ + public function getForecastLastUpdatedAt() + { + return $this->container['forecast_last_updated_at']; + } + + /** + * Sets forecast_last_updated_at + * + * @param string|null $forecast_last_updated_at When the user's forecast was last updated. + * + * @return self + */ + public function setForecastLastUpdatedAt($forecast_last_updated_at) + { + if (is_null($forecast_last_updated_at)) { + throw new \InvalidArgumentException('non-nullable forecast_last_updated_at cannot be null'); + } + $this->container['forecast_last_updated_at'] = $forecast_last_updated_at; + + return $this; + } + + /** + * Gets forecast_last_accessed_at + * + * @return string|null + */ + public function getForecastLastAccessedAt() + { + return $this->container['forecast_last_accessed_at']; + } + + /** + * Sets forecast_last_accessed_at + * + * @param string|null $forecast_last_accessed_at When the user's forecast was last accessed. + * + * @return self + */ + public function setForecastLastAccessedAt($forecast_last_accessed_at) + { + if (is_null($forecast_last_accessed_at)) { + throw new \InvalidArgumentException('non-nullable forecast_last_accessed_at cannot be null'); + } + $this->container['forecast_last_accessed_at'] = $forecast_last_accessed_at; + + return $this; + } + + /** + * Gets forecast_start_date + * + * @return string|null + */ + public function getForecastStartDate() + { + return $this->container['forecast_start_date']; + } + + /** + * Sets forecast_start_date + * + * @param string|null $forecast_start_date The date that the user's forecast starts. + * + * @return self + */ + public function setForecastStartDate($forecast_start_date) + { + if (is_null($forecast_start_date)) { + throw new \InvalidArgumentException('non-nullable forecast_start_date cannot be null'); + } + $this->container['forecast_start_date'] = $forecast_start_date; + + return $this; + } + + /** + * Gets forecast_end_date + * + * @return string|null + */ + public function getForecastEndDate() + { + return $this->container['forecast_end_date']; + } + + /** + * Sets forecast_end_date + * + * @param string|null $forecast_end_date The date that the user's forecast ends. + * + * @return self + */ + public function setForecastEndDate($forecast_end_date) + { + if (is_null($forecast_end_date)) { + throw new \InvalidArgumentException('non-nullable forecast_end_date cannot be null'); + } + $this->container['forecast_end_date'] = $forecast_end_date; + + return $this; + } + + /** + * Gets forecast_defer_recalculate + * + * @return bool|null + */ + public function getForecastDeferRecalculate() + { + return $this->container['forecast_defer_recalculate']; + } + + /** + * Sets forecast_defer_recalculate + * + * @param bool|null $forecast_defer_recalculate Whether the user's forecast recalculation should be deferred. + * + * @return self + */ + public function setForecastDeferRecalculate($forecast_defer_recalculate) + { + if (is_null($forecast_defer_recalculate)) { + throw new \InvalidArgumentException('non-nullable forecast_defer_recalculate cannot be null'); + } + $this->container['forecast_defer_recalculate'] = $forecast_defer_recalculate; + + return $this; + } + + /** + * Gets forecast_needs_recalculate + * + * @return bool|null + */ + public function getForecastNeedsRecalculate() + { + return $this->container['forecast_needs_recalculate']; + } + + /** + * Sets forecast_needs_recalculate + * + * @param bool|null $forecast_needs_recalculate Whether the user's forecast needs to be recalculated. + * + * @return self + */ + public function setForecastNeedsRecalculate($forecast_needs_recalculate) + { + if (is_null($forecast_needs_recalculate)) { + throw new \InvalidArgumentException('non-nullable forecast_needs_recalculate cannot be null'); + } + $this->container['forecast_needs_recalculate'] = $forecast_needs_recalculate; + + return $this; + } + + /** + * Gets last_logged_in_at + * + * @return string|null + */ + public function getLastLoggedInAt() + { + return $this->container['last_logged_in_at']; + } + + /** + * Sets last_logged_in_at + * + * @param string|null $last_logged_in_at When the user last logged into PocketSmith. + * + * @return self + */ + public function setLastLoggedInAt($last_logged_in_at) + { + if (is_null($last_logged_in_at)) { + throw new \InvalidArgumentException('non-nullable last_logged_in_at cannot be null'); + } + $this->container['last_logged_in_at'] = $last_logged_in_at; + + return $this; + } + + /** + * Gets last_activity_at + * + * @return string|null + */ + public function getLastActivityAt() + { + return $this->container['last_activity_at']; + } + + /** + * Sets last_activity_at + * + * @param string|null $last_activity_at When the user last interacted with PocketSmith, via any application or the API. + * + * @return self + */ + public function setLastActivityAt($last_activity_at) + { + if (is_null($last_activity_at)) { + throw new \InvalidArgumentException('non-nullable last_activity_at cannot be null'); + } + $this->container['last_activity_at'] = $last_activity_at; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at When the user signed up. + * + * @return self + */ + public function setCreatedAt($created_at) + { + if (is_null($created_at)) { + throw new \InvalidArgumentException('non-nullable created_at cannot be null'); + } + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at When the user was last updated. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + if (is_null($updated_at)) { + throw new \InvalidArgumentException('non-nullable updated_at cannot be null'); + } + $this->container['updated_at'] = $updated_at; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/UsersIdAccountsPostRequest.php b/lib/Model/UsersIdAccountsPostRequest.php new file mode 100644 index 0000000..c367fbe --- /dev/null +++ b/lib/Model/UsersIdAccountsPostRequest.php @@ -0,0 +1,576 @@ + + */ +class UsersIdAccountsPostRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_users__id__accounts_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'institution_id' => 'int', + 'title' => 'string', + 'currency_code' => 'string', + 'type' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'institution_id' => null, + 'title' => null, + 'currency_code' => null, + 'type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'institution_id' => false, + 'title' => false, + 'currency_code' => 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 = [ + 'institution_id' => 'institution_id', + 'title' => 'title', + 'currency_code' => 'currency_code', + 'type' => 'type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'institution_id' => 'setInstitutionId', + 'title' => 'setTitle', + 'currency_code' => 'setCurrencyCode', + 'type' => 'setType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'institution_id' => 'getInstitutionId', + 'title' => 'getTitle', + 'currency_code' => 'getCurrencyCode', + '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; + } + + public const TYPE_BANK = 'bank'; + public const TYPE_CREDITS = 'credits'; + public const TYPE_CASH = 'cash'; + public const TYPE_LOANS = 'loans'; + public const TYPE_MORTGAGE = 'mortgage'; + public const TYPE_STOCKS = 'stocks'; + public const TYPE_VEHICLE = 'vehicle'; + public const TYPE_PROPERTY = 'property'; + public const TYPE_INSURANCE = 'insurance'; + public const TYPE_OTHER_ASSET = 'other_asset'; + public const TYPE_OTHER_LIABILITY = 'other_liability'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypeAllowableValues() + { + return [ + self::TYPE_BANK, + self::TYPE_CREDITS, + self::TYPE_CASH, + self::TYPE_LOANS, + self::TYPE_MORTGAGE, + self::TYPE_STOCKS, + self::TYPE_VEHICLE, + self::TYPE_PROPERTY, + self::TYPE_INSURANCE, + self::TYPE_OTHER_ASSET, + self::TYPE_OTHER_LIABILITY, + ]; + } + + /** + * 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('institution_id', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('currency_code', $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 = []; + + if ($this->container['institution_id'] === null) { + $invalidProperties[] = "'institution_id' can't be null"; + } + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['currency_code'] === null) { + $invalidProperties[] = "'currency_code' can't be null"; + } + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + $allowedValues = $this->getTypeAllowableValues(); + if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'type', must be one of '%s'", + $this->container['type'], + implode("', '", $allowedValues) + ); + } + + 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 institution_id + * + * @return int + */ + public function getInstitutionId() + { + return $this->container['institution_id']; + } + + /** + * Sets institution_id + * + * @param int $institution_id The ID of the institution to create this account in. + * + * @return self + */ + public function setInstitutionId($institution_id) + { + if (is_null($institution_id)) { + throw new \InvalidArgumentException('non-nullable institution_id cannot be null'); + } + $this->container['institution_id'] = $institution_id; + + return $this; + } + + /** + * Gets title + * + * @return string + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title A title for the account. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets currency_code + * + * @return string + */ + public function getCurrencyCode() + { + return $this->container['currency_code']; + } + + /** + * Sets currency_code + * + * @param string $currency_code A currency code for the account. + * + * @return self + */ + public function setCurrencyCode($currency_code) + { + if (is_null($currency_code)) { + throw new \InvalidArgumentException('non-nullable currency_code cannot be null'); + } + $this->container['currency_code'] = $currency_code; + + return $this; + } + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type The type of the account. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $allowedValues = $this->getTypeAllowableValues(); + if (!in_array($type, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'type', must be one of '%s'", + $type, + implode("', '", $allowedValues) + ) + ); + } + $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/lib/Model/UsersIdAccountsPutRequest.php b/lib/Model/UsersIdAccountsPutRequest.php new file mode 100644 index 0000000..9f3a316 --- /dev/null +++ b/lib/Model/UsersIdAccountsPutRequest.php @@ -0,0 +1,413 @@ + + */ +class UsersIdAccountsPutRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_users__id__accounts_put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'accounts' => '\OpenAPI\Client\Model\Account[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'accounts' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'accounts' => 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 = [ + 'accounts' => 'accounts' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'accounts' => 'setAccounts' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'accounts' => 'getAccounts' + ]; + + /** + * 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('accounts', $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['accounts'] === null) { + $invalidProperties[] = "'accounts' 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 accounts + * + * @return \OpenAPI\Client\Model\Account[] + */ + public function getAccounts() + { + return $this->container['accounts']; + } + + /** + * Sets accounts + * + * @param \OpenAPI\Client\Model\Account[] $accounts List the account objects in their new display order. + * + * @return self + */ + public function setAccounts($accounts) + { + if (is_null($accounts)) { + throw new \InvalidArgumentException('non-nullable accounts cannot be null'); + } + $this->container['accounts'] = $accounts; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/UsersIdAttachmentsPostRequest.php b/lib/Model/UsersIdAttachmentsPostRequest.php new file mode 100644 index 0000000..32d5df3 --- /dev/null +++ b/lib/Model/UsersIdAttachmentsPostRequest.php @@ -0,0 +1,478 @@ + + */ +class UsersIdAttachmentsPostRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_users__id__attachments_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => 'string', + 'file_name' => 'string', + 'file_data' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'file_name' => null, + 'file_data' => 'base64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'file_name' => false, + 'file_data' => 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 = [ + 'title' => 'title', + 'file_name' => 'file_name', + 'file_data' => 'file_data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'file_name' => 'setFileName', + 'file_data' => 'setFileData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'file_name' => 'getFileName', + 'file_data' => 'getFileData' + ]; + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('file_name', $data ?? [], null); + $this->setIfExists('file_data', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the attachment. If the title is blank or not provided, the title will derived from the file name. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets file_name + * + * @return string|null + */ + public function getFileName() + { + return $this->container['file_name']; + } + + /** + * Sets file_name + * + * @param string|null $file_name The file name of the attachment. + * + * @return self + */ + public function setFileName($file_name) + { + if (is_null($file_name)) { + throw new \InvalidArgumentException('non-nullable file_name cannot be null'); + } + $this->container['file_name'] = $file_name; + + return $this; + } + + /** + * Gets file_data + * + * @return string|null + */ + public function getFileData() + { + return $this->container['file_data']; + } + + /** + * Sets file_data + * + * @param string|null $file_data The base64-encoded contents of the source file. The supported file types are png, jpg, pdf, xls, xlsx, doc, docx. + * + * @return self + */ + public function setFileData($file_data) + { + if (is_null($file_data)) { + throw new \InvalidArgumentException('non-nullable file_data cannot be null'); + } + $this->container['file_data'] = $file_data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/UsersIdCategoriesPostRequest.php b/lib/Model/UsersIdCategoriesPostRequest.php new file mode 100644 index 0000000..4de20a9 --- /dev/null +++ b/lib/Model/UsersIdCategoriesPostRequest.php @@ -0,0 +1,660 @@ + + */ +class UsersIdCategoriesPostRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_users__id__categories_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => 'string', + 'colour' => 'string', + 'parent_id' => 'int', + 'is_transfer' => 'bool', + 'is_bill' => 'bool', + 'roll_up' => 'bool', + 'refund_behaviour' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'colour' => null, + 'parent_id' => null, + 'is_transfer' => null, + 'is_bill' => null, + 'roll_up' => null, + 'refund_behaviour' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'colour' => false, + 'parent_id' => false, + 'is_transfer' => false, + 'is_bill' => false, + 'roll_up' => false, + 'refund_behaviour' => 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 = [ + 'title' => 'title', + 'colour' => 'colour', + 'parent_id' => 'parent_id', + 'is_transfer' => 'is_transfer', + 'is_bill' => 'is_bill', + 'roll_up' => 'roll_up', + 'refund_behaviour' => 'refund_behaviour' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'colour' => 'setColour', + 'parent_id' => 'setParentId', + 'is_transfer' => 'setIsTransfer', + 'is_bill' => 'setIsBill', + 'roll_up' => 'setRollUp', + 'refund_behaviour' => 'setRefundBehaviour' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'colour' => 'getColour', + 'parent_id' => 'getParentId', + 'is_transfer' => 'getIsTransfer', + 'is_bill' => 'getIsBill', + 'roll_up' => 'getRollUp', + 'refund_behaviour' => 'getRefundBehaviour' + ]; + + /** + * 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; + } + + public const REFUND_BEHAVIOUR_DEBITS_ARE_DEDUCTIONS = 'debits_are_deductions'; + public const REFUND_BEHAVIOUR_CREDITS_ARE_REFUNDS = 'credits_are_refunds'; + public const REFUND_BEHAVIOUR_NULL = 'null'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRefundBehaviourAllowableValues() + { + return [ + self::REFUND_BEHAVIOUR_DEBITS_ARE_DEDUCTIONS, + self::REFUND_BEHAVIOUR_CREDITS_ARE_REFUNDS, + self::REFUND_BEHAVIOUR_NULL, + ]; + } + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('colour', $data ?? [], null); + $this->setIfExists('parent_id', $data ?? [], null); + $this->setIfExists('is_transfer', $data ?? [], null); + $this->setIfExists('is_bill', $data ?? [], null); + $this->setIfExists('roll_up', $data ?? [], null); + $this->setIfExists('refund_behaviour', $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['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + $allowedValues = $this->getRefundBehaviourAllowableValues(); + if (!is_null($this->container['refund_behaviour']) && !in_array($this->container['refund_behaviour'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'refund_behaviour', must be one of '%s'", + $this->container['refund_behaviour'], + implode("', '", $allowedValues) + ); + } + + 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 title + * + * @return string + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title A title for the category. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets colour + * + * @return string|null + */ + public function getColour() + { + return $this->container['colour']; + } + + /** + * Sets colour + * + * @param string|null $colour A CSS-style hex colour for the category. + * + * @return self + */ + public function setColour($colour) + { + if (is_null($colour)) { + throw new \InvalidArgumentException('non-nullable colour cannot be null'); + } + $this->container['colour'] = $colour; + + return $this; + } + + /** + * Gets parent_id + * + * @return int|null + */ + public function getParentId() + { + return $this->container['parent_id']; + } + + /** + * Sets parent_id + * + * @param int|null $parent_id The unique identifier of a category to be the parent of this category. + * + * @return self + */ + public function setParentId($parent_id) + { + if (is_null($parent_id)) { + throw new \InvalidArgumentException('non-nullable parent_id cannot be null'); + } + $this->container['parent_id'] = $parent_id; + + return $this; + } + + /** + * Gets is_transfer + * + * @return bool|null + */ + public function getIsTransfer() + { + return $this->container['is_transfer']; + } + + /** + * Sets is_transfer + * + * @param bool|null $is_transfer Set the category as a transfer category. + * + * @return self + */ + public function setIsTransfer($is_transfer) + { + if (is_null($is_transfer)) { + throw new \InvalidArgumentException('non-nullable is_transfer cannot be null'); + } + $this->container['is_transfer'] = $is_transfer; + + return $this; + } + + /** + * Gets is_bill + * + * @return bool|null + */ + public function getIsBill() + { + return $this->container['is_bill']; + } + + /** + * Sets is_bill + * + * @param bool|null $is_bill Set the category as a bill category. + * + * @return self + */ + public function setIsBill($is_bill) + { + if (is_null($is_bill)) { + throw new \InvalidArgumentException('non-nullable is_bill cannot be null'); + } + $this->container['is_bill'] = $is_bill; + + return $this; + } + + /** + * Gets roll_up + * + * @return bool|null + */ + public function getRollUp() + { + return $this->container['roll_up']; + } + + /** + * Sets roll_up + * + * @param bool|null $roll_up Set the category to be rolled up into its parent category. + * + * @return self + */ + public function setRollUp($roll_up) + { + if (is_null($roll_up)) { + throw new \InvalidArgumentException('non-nullable roll_up cannot be null'); + } + $this->container['roll_up'] = $roll_up; + + return $this; + } + + /** + * Gets refund_behaviour + * + * @return string|null + */ + public function getRefundBehaviour() + { + return $this->container['refund_behaviour']; + } + + /** + * Sets refund_behaviour + * + * @param string|null $refund_behaviour Set the refund behaviour of the category. + * + * @return self + */ + public function setRefundBehaviour($refund_behaviour) + { + if (is_null($refund_behaviour)) { + array_push($this->openAPINullablesSetToNull, 'refund_behaviour'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('refund_behaviour', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $allowedValues = $this->getRefundBehaviourAllowableValues(); + if (!is_null($refund_behaviour) && !in_array($refund_behaviour, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'refund_behaviour', must be one of '%s'", + $refund_behaviour, + implode("', '", $allowedValues) + ) + ); + } + $this->container['refund_behaviour'] = $refund_behaviour; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/UsersIdInstitutionsPostRequest.php b/lib/Model/UsersIdInstitutionsPostRequest.php new file mode 100644 index 0000000..fc07dec --- /dev/null +++ b/lib/Model/UsersIdInstitutionsPostRequest.php @@ -0,0 +1,450 @@ + + */ +class UsersIdInstitutionsPostRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_users__id__institutions_post_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => 'string', + 'currency_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'currency_code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'currency_code' => 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 = [ + 'title' => 'title', + 'currency_code' => 'currency_code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'currency_code' => 'setCurrencyCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'currency_code' => 'getCurrencyCode' + ]; + + /** + * 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('title', $data ?? [], null); + $this->setIfExists('currency_code', $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['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['currency_code'] === null) { + $invalidProperties[] = "'currency_code' 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 title + * + * @return string + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title A title for the institution. + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets currency_code + * + * @return string + */ + public function getCurrencyCode() + { + return $this->container['currency_code']; + } + + /** + * Sets currency_code + * + * @param string $currency_code A currency code for the institution. + * + * @return self + */ + public function setCurrencyCode($currency_code) + { + if (is_null($currency_code)) { + throw new \InvalidArgumentException('non-nullable currency_code cannot be null'); + } + $this->container['currency_code'] = $currency_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/UsersIdPutRequest.php b/lib/Model/UsersIdPutRequest.php new file mode 100644 index 0000000..aed4e54 --- /dev/null +++ b/lib/Model/UsersIdPutRequest.php @@ -0,0 +1,614 @@ + + */ +class UsersIdPutRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '_users__id__put_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email' => 'string', + 'name' => 'string', + 'time_zone' => 'string', + 'week_start_day' => 'int', + 'beta_user' => 'bool', + 'base_currency_code' => 'string', + 'always_show_base_currency' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email' => null, + 'name' => null, + 'time_zone' => null, + 'week_start_day' => null, + 'beta_user' => null, + 'base_currency_code' => null, + 'always_show_base_currency' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email' => false, + 'name' => false, + 'time_zone' => false, + 'week_start_day' => false, + 'beta_user' => false, + 'base_currency_code' => false, + 'always_show_base_currency' => 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 = [ + 'email' => 'email', + 'name' => 'name', + 'time_zone' => 'time_zone', + 'week_start_day' => 'week_start_day', + 'beta_user' => 'beta_user', + 'base_currency_code' => 'base_currency_code', + 'always_show_base_currency' => 'always_show_base_currency' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email' => 'setEmail', + 'name' => 'setName', + 'time_zone' => 'setTimeZone', + 'week_start_day' => 'setWeekStartDay', + 'beta_user' => 'setBetaUser', + 'base_currency_code' => 'setBaseCurrencyCode', + 'always_show_base_currency' => 'setAlwaysShowBaseCurrency' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email' => 'getEmail', + 'name' => 'getName', + 'time_zone' => 'getTimeZone', + 'week_start_day' => 'getWeekStartDay', + 'beta_user' => 'getBetaUser', + 'base_currency_code' => 'getBaseCurrencyCode', + 'always_show_base_currency' => 'getAlwaysShowBaseCurrency' + ]; + + /** + * 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('email', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('time_zone', $data ?? [], null); + $this->setIfExists('week_start_day', $data ?? [], null); + $this->setIfExists('beta_user', $data ?? [], null); + $this->setIfExists('base_currency_code', $data ?? [], null); + $this->setIfExists('always_show_base_currency', $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 email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email A new email address for the user. + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + throw new \InvalidArgumentException('non-nullable email cannot be null'); + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name A new name for the user. + * + * @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 time_zone + * + * @return string|null + */ + public function getTimeZone() + { + return $this->container['time_zone']; + } + + /** + * Sets time_zone + * + * @param string|null $time_zone A new time zone for the user. + * + * @return self + */ + public function setTimeZone($time_zone) + { + if (is_null($time_zone)) { + throw new \InvalidArgumentException('non-nullable time_zone cannot be null'); + } + $this->container['time_zone'] = $time_zone; + + return $this; + } + + /** + * Gets week_start_day + * + * @return int|null + */ + public function getWeekStartDay() + { + return $this->container['week_start_day']; + } + + /** + * Sets week_start_day + * + * @param int|null $week_start_day The day of the week the user wishes their calendars to start on. A number between 0 and 6, where 0 is Sunday and 6 is Saturday. + * + * @return self + */ + public function setWeekStartDay($week_start_day) + { + if (is_null($week_start_day)) { + throw new \InvalidArgumentException('non-nullable week_start_day cannot be null'); + } + $this->container['week_start_day'] = $week_start_day; + + return $this; + } + + /** + * Gets beta_user + * + * @return bool|null + */ + public function getBetaUser() + { + return $this->container['beta_user']; + } + + /** + * Sets beta_user + * + * @param bool|null $beta_user Whether the user is a beta user, and wishes to try out new features. + * + * @return self + */ + public function setBetaUser($beta_user) + { + if (is_null($beta_user)) { + throw new \InvalidArgumentException('non-nullable beta_user cannot be null'); + } + $this->container['beta_user'] = $beta_user; + + return $this; + } + + /** + * Gets base_currency_code + * + * @return string|null + */ + public function getBaseCurrencyCode() + { + return $this->container['base_currency_code']; + } + + /** + * Sets base_currency_code + * + * @param string|null $base_currency_code A new base currency code for the user. + * + * @return self + */ + public function setBaseCurrencyCode($base_currency_code) + { + if (is_null($base_currency_code)) { + throw new \InvalidArgumentException('non-nullable base_currency_code cannot be null'); + } + $this->container['base_currency_code'] = $base_currency_code; + + return $this; + } + + /** + * Gets always_show_base_currency + * + * @return bool|null + */ + public function getAlwaysShowBaseCurrency() + { + return $this->container['always_show_base_currency']; + } + + /** + * Sets always_show_base_currency + * + * @param bool|null $always_show_base_currency Whether the user wishes to have all monetary values converted to their base currency. + * + * @return self + */ + public function setAlwaysShowBaseCurrency($always_show_base_currency) + { + if (is_null($always_show_base_currency)) { + throw new \InvalidArgumentException('non-nullable always_show_base_currency cannot be null'); + } + $this->container['always_show_base_currency'] = $always_show_base_currency; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php new file mode 100644 index 0000000..65e91ab --- /dev/null +++ b/lib/ObjectSerializer.php @@ -0,0 +1,568 @@ +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 = '\OpenAPI\Client\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/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..485899a --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./lib/Api + ./lib/Model + + + + + ./test/Api + ./test/Model + + + + + + diff --git a/test/Api/AccountsApiTest.php b/test/Api/AccountsApiTest.php new file mode 100644 index 0000000..cc6d004 --- /dev/null +++ b/test/Api/AccountsApiTest.php @@ -0,0 +1,158 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for accountsIdGet + * + * Get account. + * + */ + public function testAccountsIdGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for accountsIdPut + * + * Update account. + * + */ + public function testAccountsIdPut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for institutionsIdAccountsGet + * + * List accounts in institution. + * + */ + public function testInstitutionsIdAccountsGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdAccountsGet + * + * List accounts in user. + * + */ + public function testUsersIdAccountsGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdAccountsPost + * + * Create an account in user. + * + */ + public function testUsersIdAccountsPost() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdAccountsPut + * + * Update the display order of accounts in user. + * + */ + public function testUsersIdAccountsPut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/AttachmentsApiTest.php b/test/Api/AttachmentsApiTest.php new file mode 100644 index 0000000..e36cff2 --- /dev/null +++ b/test/Api/AttachmentsApiTest.php @@ -0,0 +1,170 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for attachmentsIdGet + * + * Get attachment. + * + */ + public function testAttachmentsIdGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for attachmentsIdPut + * + * Update attachment. + * + */ + public function testAttachmentsIdPut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for transactionsIdAttachmentsGet + * + * List attachments in transaction. + * + */ + public function testTransactionsIdAttachmentsGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for transactionsIdAttachmentsPost + * + * Assigns attachment to transaction. + * + */ + public function testTransactionsIdAttachmentsPost() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for transactionsTransactionIdAttachmentsAttachmentIdDelete + * + * Unassigns attachment in transaction. + * + */ + public function testTransactionsTransactionIdAttachmentsAttachmentIdDelete() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdAttachmentsGet + * + * Lists attachments in user. + * + */ + public function testUsersIdAttachmentsGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdAttachmentsPost + * + * Create attachment in user. + * + */ + public function testUsersIdAttachmentsPost() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/BudgetingApiTest.php b/test/Api/BudgetingApiTest.php new file mode 100644 index 0000000..b92bcfe --- /dev/null +++ b/test/Api/BudgetingApiTest.php @@ -0,0 +1,122 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdBudgetSummaryGet + * + * Get budget summary for user. + * + */ + public function testUsersIdBudgetSummaryGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdForecastCacheDelete + * + * Delete forecast cache for user. + * + */ + public function testUsersIdForecastCacheDelete() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdTrendAnalysisGet + * + * Get trend analysis for user. + * + */ + public function testUsersIdTrendAnalysisGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/CategoriesApiTest.php b/test/Api/CategoriesApiTest.php new file mode 100644 index 0000000..ebf0bde --- /dev/null +++ b/test/Api/CategoriesApiTest.php @@ -0,0 +1,134 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for categoriesIdGet + * + * Get category. + * + */ + public function testCategoriesIdGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for categoriesIdPut + * + * Update category. + * + */ + public function testCategoriesIdPut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdCategoriesGet + * + * List categories in user. + * + */ + public function testUsersIdCategoriesGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdCategoriesPost + * + * Create category in user. + * + */ + public function testUsersIdCategoriesPost() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/CategoryRulesApiTest.php b/test/Api/CategoryRulesApiTest.php new file mode 100644 index 0000000..ccea56c --- /dev/null +++ b/test/Api/CategoryRulesApiTest.php @@ -0,0 +1,98 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdCategoryRulesGet + * + * List category rules in user. + * + */ + public function testUsersIdCategoryRulesGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/CurrenciesApiTest.php b/test/Api/CurrenciesApiTest.php new file mode 100644 index 0000000..6f5695f --- /dev/null +++ b/test/Api/CurrenciesApiTest.php @@ -0,0 +1,98 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for currenciesIdGet + * + * Get currency. + * + */ + public function testCurrenciesIdGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/EventsApiTest.php b/test/Api/EventsApiTest.php new file mode 100644 index 0000000..930f72b --- /dev/null +++ b/test/Api/EventsApiTest.php @@ -0,0 +1,146 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for eventsIdGet + * + * Get event. + * + */ + public function testEventsIdGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for eventsIdPut + * + * Update event. + * + */ + public function testEventsIdPut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for scenariosIdEventsGet + * + * List events in scenario.. + * + */ + public function testScenariosIdEventsGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for scenariosIdEventsPost + * + * Create event in scenario. + * + */ + public function testScenariosIdEventsPost() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdEventsGet + * + * List events in user.. + * + */ + public function testUsersIdEventsGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/InstitutionsApiTest.php b/test/Api/InstitutionsApiTest.php new file mode 100644 index 0000000..db54b7b --- /dev/null +++ b/test/Api/InstitutionsApiTest.php @@ -0,0 +1,134 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for institutionsIdGet + * + * Get institution. + * + */ + public function testInstitutionsIdGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for institutionsIdPut + * + * Update institution. + * + */ + public function testInstitutionsIdPut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdInstitutionsGet + * + * List institutions in user. + * + */ + public function testUsersIdInstitutionsGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdInstitutionsPost + * + * Create institution in user. + * + */ + public function testUsersIdInstitutionsPost() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/LabelsApiTest.php b/test/Api/LabelsApiTest.php new file mode 100644 index 0000000..85e3902 --- /dev/null +++ b/test/Api/LabelsApiTest.php @@ -0,0 +1,86 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/SavedSearchesApiTest.php b/test/Api/SavedSearchesApiTest.php new file mode 100644 index 0000000..f10710f --- /dev/null +++ b/test/Api/SavedSearchesApiTest.php @@ -0,0 +1,86 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/TimeZonesApiTest.php b/test/Api/TimeZonesApiTest.php new file mode 100644 index 0000000..5403a34 --- /dev/null +++ b/test/Api/TimeZonesApiTest.php @@ -0,0 +1,86 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/TransactionAccountsApiTest.php b/test/Api/TransactionAccountsApiTest.php new file mode 100644 index 0000000..c9db8e3 --- /dev/null +++ b/test/Api/TransactionAccountsApiTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for transactionAccountsIdPut + * + * Update transaction account. + * + */ + public function testTransactionAccountsIdPut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdTransactionAccountsGet + * + * List transaction accounts in user. + * + */ + public function testUsersIdTransactionAccountsGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/TransactionsApiTest.php b/test/Api/TransactionsApiTest.php new file mode 100644 index 0000000..750a227 --- /dev/null +++ b/test/Api/TransactionsApiTest.php @@ -0,0 +1,170 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for categoriesIdTransactionsGet + * + * List transactions in categories. + * + */ + public function testCategoriesIdTransactionsGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for transactionAccountsIdTransactionsGet + * + * List transactions in transaction account. + * + */ + public function testTransactionAccountsIdTransactionsGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for transactionAccountsIdTransactionsPost + * + * Create a transaction in transaction account. + * + */ + public function testTransactionAccountsIdTransactionsPost() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for transactionsIdDelete + * + * Delete transaction. + * + */ + public function testTransactionsIdDelete() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for transactionsIdGet + * + * Get a transaction. + * + */ + public function testTransactionsIdGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for transactionsIdPut + * + * Update a transaction. + * + */ + public function testTransactionsIdPut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdTransactionsGet + * + * List transactions in user. + * + */ + public function testUsersIdTransactionsGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/UsersApiTest.php b/test/Api/UsersApiTest.php new file mode 100644 index 0000000..02099dc --- /dev/null +++ b/test/Api/UsersApiTest.php @@ -0,0 +1,110 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdGet + * + * Get user. + * + */ + public function testUsersIdGet() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for usersIdPut + * + * Update user. + * + */ + public function testUsersIdPut() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AccountTest.php b/test/Model/AccountTest.php new file mode 100644 index 0000000..b0fc087 --- /dev/null +++ b/test/Model/AccountTest.php @@ -0,0 +1,235 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency_code" + */ + public function testPropertyCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_net_worth" + */ + public function testPropertyIsNetWorth() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "primary_transaction_account" + */ + public function testPropertyPrimaryTransactionAccount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "primary_scenario" + */ + public function testPropertyPrimaryScenario() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "transaction_accounts" + */ + public function testPropertyTransactionAccounts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "scenarios" + */ + public function testPropertyScenarios() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance" + */ + public function testPropertyCurrentBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance_date" + */ + public function testPropertyCurrentBalanceDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance_in_base_currency" + */ + public function testPropertyCurrentBalanceInBaseCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance_exchange_rate" + */ + public function testPropertyCurrentBalanceExchangeRate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "safe_balance" + */ + public function testPropertySafeBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "safe_balance_in_base_currency" + */ + public function testPropertySafeBalanceInBaseCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AccountsIdPutRequestTest.php b/test/Model/AccountsIdPutRequestTest.php new file mode 100644 index 0000000..f339fa8 --- /dev/null +++ b/test/Model/AccountsIdPutRequestTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency_code" + */ + public function testPropertyCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_net_worth" + */ + public function testPropertyIsNetWorth() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AttachmentContentTypeMetaTest.php b/test/Model/AttachmentContentTypeMetaTest.php new file mode 100644 index 0000000..e388e7a --- /dev/null +++ b/test/Model/AttachmentContentTypeMetaTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "extension" + */ + public function testPropertyExtension() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AttachmentTest.php b/test/Model/AttachmentTest.php new file mode 100644 index 0000000..8b090c9 --- /dev/null +++ b/test/Model/AttachmentTest.php @@ -0,0 +1,172 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "file_name" + */ + public function testPropertyFileName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_type" + */ + public function testPropertyContentType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content_type_meta" + */ + public function testPropertyContentTypeMeta() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "original_url" + */ + public function testPropertyOriginalUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "variants" + */ + public function testPropertyVariants() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AttachmentVariantsTest.php b/test/Model/AttachmentVariantsTest.php new file mode 100644 index 0000000..48b5e6d --- /dev/null +++ b/test/Model/AttachmentVariantsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "large_url" + */ + public function testPropertyLargeUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "thumb_url" + */ + public function testPropertyThumbUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/AttachmentsIdPutRequestTest.php b/test/Model/AttachmentsIdPutRequestTest.php new file mode 100644 index 0000000..639bf46 --- /dev/null +++ b/test/Model/AttachmentsIdPutRequestTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BudgetAnalysisPackageTest.php b/test/Model/BudgetAnalysisPackageTest.php new file mode 100644 index 0000000..8b1b259 --- /dev/null +++ b/test/Model/BudgetAnalysisPackageTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "category" + */ + public function testPropertyCategory() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_transfer" + */ + public function testPropertyIsTransfer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "expense" + */ + public function testPropertyExpense() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "income" + */ + public function testPropertyIncome() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/BudgetAnalysisTest.php b/test/Model/BudgetAnalysisTest.php new file mode 100644 index 0000000..d1ad43e --- /dev/null +++ b/test/Model/BudgetAnalysisTest.php @@ -0,0 +1,172 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "start_date" + */ + public function testPropertyStartDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "end_date" + */ + public function testPropertyEndDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency_code" + */ + public function testPropertyCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_actual_amount" + */ + public function testPropertyTotalActualAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "average_actual_amount" + */ + public function testPropertyAverageActualAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_forecast_amount" + */ + public function testPropertyTotalForecastAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "average_forecast_amount" + */ + public function testPropertyAverageForecastAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_over_by" + */ + public function testPropertyTotalOverBy() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "total_under_by" + */ + public function testPropertyTotalUnderBy() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "periods" + */ + public function testPropertyPeriods() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CategoriesIdCategoryRulesPostRequestTest.php b/test/Model/CategoriesIdCategoryRulesPostRequestTest.php new file mode 100644 index 0000000..92bd7b0 --- /dev/null +++ b/test/Model/CategoriesIdCategoryRulesPostRequestTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payee_matches" + */ + public function testPropertyPayeeMatches() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "apply_to_uncategorised" + */ + public function testPropertyApplyToUncategorised() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "apply_to_all" + */ + public function testPropertyApplyToAll() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CategoriesIdPutRequestTest.php b/test/Model/CategoriesIdPutRequestTest.php new file mode 100644 index 0000000..feb39ae --- /dev/null +++ b/test/Model/CategoriesIdPutRequestTest.php @@ -0,0 +1,145 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "colour" + */ + public function testPropertyColour() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "parent_id" + */ + public function testPropertyParentId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_transfer" + */ + public function testPropertyIsTransfer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_bill" + */ + public function testPropertyIsBill() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "roll_up" + */ + public function testPropertyRollUp() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "refund_behaviour" + */ + public function testPropertyRefundBehaviour() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CategoryRuleTest.php b/test/Model/CategoryRuleTest.php new file mode 100644 index 0000000..e69c3e8 --- /dev/null +++ b/test/Model/CategoryRuleTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "category" + */ + public function testPropertyCategory() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payee_matches" + */ + public function testPropertyPayeeMatches() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CategoryTest.php b/test/Model/CategoryTest.php new file mode 100644 index 0000000..5c24603 --- /dev/null +++ b/test/Model/CategoryTest.php @@ -0,0 +1,181 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "colour" + */ + public function testPropertyColour() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "children" + */ + public function testPropertyChildren() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "parent_id" + */ + public function testPropertyParentId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_transfer" + */ + public function testPropertyIsTransfer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_bill" + */ + public function testPropertyIsBill() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "roll_up" + */ + public function testPropertyRollUp() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "refund_behaviour" + */ + public function testPropertyRefundBehaviour() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CurrencySeparatorsTest.php b/test/Model/CurrencySeparatorsTest.php new file mode 100644 index 0000000..16e4f16 --- /dev/null +++ b/test/Model/CurrencySeparatorsTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "major" + */ + public function testPropertyMajor() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "minor" + */ + public function testPropertyMinor() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/CurrencyTest.php b/test/Model/CurrencyTest.php new file mode 100644 index 0000000..3197560 --- /dev/null +++ b/test/Model/CurrencyTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "minor_unit" + */ + public function testPropertyMinorUnit() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "separators" + */ + public function testPropertySeparators() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "symbol" + */ + public function testPropertySymbol() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorTest.php b/test/Model/ErrorTest.php new file mode 100644 index 0000000..5b28c18 --- /dev/null +++ b/test/Model/ErrorTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error" + */ + public function testPropertyError() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EventTest.php b/test/Model/EventTest.php new file mode 100644 index 0000000..669c5b7 --- /dev/null +++ b/test/Model/EventTest.php @@ -0,0 +1,208 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "category" + */ + public function testPropertyCategory() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "scenario" + */ + public function testPropertyScenario() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount_in_base_currency" + */ + public function testPropertyAmountInBaseCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency_code" + */ + public function testPropertyCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "date" + */ + public function testPropertyDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "colour" + */ + public function testPropertyColour() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "note" + */ + public function testPropertyNote() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "repeat_type" + */ + public function testPropertyRepeatType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "repeat_interval" + */ + public function testPropertyRepeatInterval() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "series_id" + */ + public function testPropertySeriesId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "series_start_id" + */ + public function testPropertySeriesStartId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "infinite_series" + */ + public function testPropertyInfiniteSeries() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/EventsIdPutRequestTest.php b/test/Model/EventsIdPutRequestTest.php new file mode 100644 index 0000000..91b8efe --- /dev/null +++ b/test/Model/EventsIdPutRequestTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "behaviour" + */ + public function testPropertyBehaviour() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "repeat_type" + */ + public function testPropertyRepeatType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "repeat_interval" + */ + public function testPropertyRepeatInterval() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "note" + */ + public function testPropertyNote() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InstitutionTest.php b/test/Model/InstitutionTest.php new file mode 100644 index 0000000..4f6b9c3 --- /dev/null +++ b/test/Model/InstitutionTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency_code" + */ + public function testPropertyCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/InstitutionsIdPutRequestTest.php b/test/Model/InstitutionsIdPutRequestTest.php new file mode 100644 index 0000000..cb82b83 --- /dev/null +++ b/test/Model/InstitutionsIdPutRequestTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency_code" + */ + public function testPropertyCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PeriodTest.php b/test/Model/PeriodTest.php new file mode 100644 index 0000000..7be8671 --- /dev/null +++ b/test/Model/PeriodTest.php @@ -0,0 +1,190 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "start_date" + */ + public function testPropertyStartDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "end_date" + */ + public function testPropertyEndDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency_code" + */ + public function testPropertyCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "actual_amount" + */ + public function testPropertyActualAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "forecast_amount" + */ + public function testPropertyForecastAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "refund_amount" + */ + public function testPropertyRefundAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current" + */ + public function testPropertyCurrent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "over_budget" + */ + public function testPropertyOverBudget() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "under_budget" + */ + public function testPropertyUnderBudget() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "over_by" + */ + public function testPropertyOverBy() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "under_by" + */ + public function testPropertyUnderBy() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "percentage_used" + */ + public function testPropertyPercentageUsed() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SavedSearchTest.php b/test/Model/SavedSearchTest.php new file mode 100644 index 0000000..6e71679 --- /dev/null +++ b/test/Model/SavedSearchTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ScenarioTest.php b/test/Model/ScenarioTest.php new file mode 100644 index 0000000..9bcff9c --- /dev/null +++ b/test/Model/ScenarioTest.php @@ -0,0 +1,271 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "interest_rate" + */ + public function testPropertyInterestRate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "interest_rate_repeat_id" + */ + public function testPropertyInterestRateRepeatId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "minimum_value" + */ + public function testPropertyMinimumValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "maximum_value" + */ + public function testPropertyMaximumValue() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "achieve_date" + */ + public function testPropertyAchieveDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "starting_balance" + */ + public function testPropertyStartingBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "starting_balance_date" + */ + public function testPropertyStartingBalanceDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "closing_balance" + */ + public function testPropertyClosingBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "closing_balance_date" + */ + public function testPropertyClosingBalanceDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance" + */ + public function testPropertyCurrentBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance_date" + */ + public function testPropertyCurrentBalanceDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance_in_base_currency" + */ + public function testPropertyCurrentBalanceInBaseCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance_exchange_rate" + */ + public function testPropertyCurrentBalanceExchangeRate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "safe_balance" + */ + public function testPropertySafeBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "safe_balance_in_base_currency" + */ + public function testPropertySafeBalanceInBaseCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ScenariosIdEventsPostRequestTest.php b/test/Model/ScenariosIdEventsPostRequestTest.php new file mode 100644 index 0000000..9f4518d --- /dev/null +++ b/test/Model/ScenariosIdEventsPostRequestTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "category_id" + */ + public function testPropertyCategoryId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "date" + */ + public function testPropertyDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "repeat_type" + */ + public function testPropertyRepeatType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "repeat_interval" + */ + public function testPropertyRepeatInterval() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "note" + */ + public function testPropertyNote() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TimeZoneTest.php b/test/Model/TimeZoneTest.php new file mode 100644 index 0000000..d82031a --- /dev/null +++ b/test/Model/TimeZoneTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "utc_offset" + */ + public function testPropertyUtcOffset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "formatted_name" + */ + public function testPropertyFormattedName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "formatted_offset" + */ + public function testPropertyFormattedOffset() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "abbreviation" + */ + public function testPropertyAbbreviation() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "identifier" + */ + public function testPropertyIdentifier() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TransactionAccountTest.php b/test/Model/TransactionAccountTest.php new file mode 100644 index 0000000..c3bf009 --- /dev/null +++ b/test/Model/TransactionAccountTest.php @@ -0,0 +1,226 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance" + */ + public function testPropertyCurrentBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance_date" + */ + public function testPropertyCurrentBalanceDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance_in_base_currency" + */ + public function testPropertyCurrentBalanceInBaseCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "current_balance_exchange_rate" + */ + public function testPropertyCurrentBalanceExchangeRate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "safe_balance" + */ + public function testPropertySafeBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "safe_balance_in_base_currency" + */ + public function testPropertySafeBalanceInBaseCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "starting_balance" + */ + public function testPropertyStartingBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "starting_balance_date" + */ + public function testPropertyStartingBalanceDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "institution" + */ + public function testPropertyInstitution() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency_code" + */ + public function testPropertyCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TransactionAccountsIdPutRequestTest.php b/test/Model/TransactionAccountsIdPutRequestTest.php new file mode 100644 index 0000000..fe36635 --- /dev/null +++ b/test/Model/TransactionAccountsIdPutRequestTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "institution_id" + */ + public function testPropertyInstitutionId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "starting_balance" + */ + public function testPropertyStartingBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "starting_balance_date" + */ + public function testPropertyStartingBalanceDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TransactionAccountsIdTransactionsPostRequestTest.php b/test/Model/TransactionAccountsIdTransactionsPostRequestTest.php new file mode 100644 index 0000000..377b618 --- /dev/null +++ b/test/Model/TransactionAccountsIdTransactionsPostRequestTest.php @@ -0,0 +1,172 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payee" + */ + public function testPropertyPayee() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "date" + */ + public function testPropertyDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_transfer" + */ + public function testPropertyIsTransfer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "labels" + */ + public function testPropertyLabels() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "category_id" + */ + public function testPropertyCategoryId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "note" + */ + public function testPropertyNote() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "memo" + */ + public function testPropertyMemo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cheque_number" + */ + public function testPropertyChequeNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "needs_review" + */ + public function testPropertyNeedsReview() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TransactionTest.php b/test/Model/TransactionTest.php new file mode 100644 index 0000000..471c5ba --- /dev/null +++ b/test/Model/TransactionTest.php @@ -0,0 +1,262 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cheque_number" + */ + public function testPropertyChequeNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "memo" + */ + public function testPropertyMemo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payee" + */ + public function testPropertyPayee() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount_in_base_currency" + */ + public function testPropertyAmountInBaseCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "date" + */ + public function testPropertyDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_transfer" + */ + public function testPropertyIsTransfer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "category" + */ + public function testPropertyCategory() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "note" + */ + public function testPropertyNote() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "labels" + */ + public function testPropertyLabels() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "original_payee" + */ + public function testPropertyOriginalPayee() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "upload_source" + */ + public function testPropertyUploadSource() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "closing_balance" + */ + public function testPropertyClosingBalance() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "transaction_account" + */ + public function testPropertyTransactionAccount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "needs_review" + */ + public function testPropertyNeedsReview() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TransactionsIdAttachmentsPostRequestTest.php b/test/Model/TransactionsIdAttachmentsPostRequestTest.php new file mode 100644 index 0000000..50f9a21 --- /dev/null +++ b/test/Model/TransactionsIdAttachmentsPostRequestTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "attachment_id" + */ + public function testPropertyAttachmentId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TransactionsIdPutRequestTest.php b/test/Model/TransactionsIdPutRequestTest.php new file mode 100644 index 0000000..41d7282 --- /dev/null +++ b/test/Model/TransactionsIdPutRequestTest.php @@ -0,0 +1,172 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "memo" + */ + public function testPropertyMemo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "cheque_number" + */ + public function testPropertyChequeNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "payee" + */ + public function testPropertyPayee() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "amount" + */ + public function testPropertyAmount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "date" + */ + public function testPropertyDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_transfer" + */ + public function testPropertyIsTransfer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "category_id" + */ + public function testPropertyCategoryId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "note" + */ + public function testPropertyNote() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "needs_review" + */ + public function testPropertyNeedsReview() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "labels" + */ + public function testPropertyLabels() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UserTest.php b/test/Model/UserTest.php new file mode 100644 index 0000000..f09615d --- /dev/null +++ b/test/Model/UserTest.php @@ -0,0 +1,298 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "login" + */ + public function testPropertyLogin() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email" + */ + public function testPropertyEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "avatar_url" + */ + public function testPropertyAvatarUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "beta_user" + */ + public function testPropertyBetaUser() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "time_zone" + */ + public function testPropertyTimeZone() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "week_start_day" + */ + public function testPropertyWeekStartDay() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_reviewing_transactions" + */ + public function testPropertyIsReviewingTransactions() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "base_currency_code" + */ + public function testPropertyBaseCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "always_show_base_currency" + */ + public function testPropertyAlwaysShowBaseCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "using_multiple_currencies" + */ + public function testPropertyUsingMultipleCurrencies() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "available_accounts" + */ + public function testPropertyAvailableAccounts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "available_budgets" + */ + public function testPropertyAvailableBudgets() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "forecast_last_updated_at" + */ + public function testPropertyForecastLastUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "forecast_last_accessed_at" + */ + public function testPropertyForecastLastAccessedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "forecast_start_date" + */ + public function testPropertyForecastStartDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "forecast_end_date" + */ + public function testPropertyForecastEndDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "forecast_defer_recalculate" + */ + public function testPropertyForecastDeferRecalculate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "forecast_needs_recalculate" + */ + public function testPropertyForecastNeedsRecalculate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last_logged_in_at" + */ + public function testPropertyLastLoggedInAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "last_activity_at" + */ + public function testPropertyLastActivityAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "created_at" + */ + public function testPropertyCreatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "updated_at" + */ + public function testPropertyUpdatedAt() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UsersIdAccountsPostRequestTest.php b/test/Model/UsersIdAccountsPostRequestTest.php new file mode 100644 index 0000000..da8c19d --- /dev/null +++ b/test/Model/UsersIdAccountsPostRequestTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "institution_id" + */ + public function testPropertyInstitutionId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency_code" + */ + public function testPropertyCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "type" + */ + public function testPropertyType() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UsersIdAccountsPutRequestTest.php b/test/Model/UsersIdAccountsPutRequestTest.php new file mode 100644 index 0000000..d3b3e4b --- /dev/null +++ b/test/Model/UsersIdAccountsPutRequestTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "accounts" + */ + public function testPropertyAccounts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UsersIdAttachmentsPostRequestTest.php b/test/Model/UsersIdAttachmentsPostRequestTest.php new file mode 100644 index 0000000..3d47808 --- /dev/null +++ b/test/Model/UsersIdAttachmentsPostRequestTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "file_name" + */ + public function testPropertyFileName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "file_data" + */ + public function testPropertyFileData() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UsersIdCategoriesPostRequestTest.php b/test/Model/UsersIdCategoriesPostRequestTest.php new file mode 100644 index 0000000..9e22821 --- /dev/null +++ b/test/Model/UsersIdCategoriesPostRequestTest.php @@ -0,0 +1,145 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "colour" + */ + public function testPropertyColour() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "parent_id" + */ + public function testPropertyParentId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_transfer" + */ + public function testPropertyIsTransfer() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "is_bill" + */ + public function testPropertyIsBill() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "roll_up" + */ + public function testPropertyRollUp() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "refund_behaviour" + */ + public function testPropertyRefundBehaviour() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UsersIdInstitutionsPostRequestTest.php b/test/Model/UsersIdInstitutionsPostRequestTest.php new file mode 100644 index 0000000..03e592f --- /dev/null +++ b/test/Model/UsersIdInstitutionsPostRequestTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currency_code" + */ + public function testPropertyCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/UsersIdPutRequestTest.php b/test/Model/UsersIdPutRequestTest.php new file mode 100644 index 0000000..f50ed53 --- /dev/null +++ b/test/Model/UsersIdPutRequestTest.php @@ -0,0 +1,145 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email" + */ + public function testPropertyEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "time_zone" + */ + public function testPropertyTimeZone() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "week_start_day" + */ + public function testPropertyWeekStartDay() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "beta_user" + */ + public function testPropertyBetaUser() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "base_currency_code" + */ + public function testPropertyBaseCurrencyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "always_show_base_currency" + */ + public function testPropertyAlwaysShowBaseCurrency() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +}