From 5dac5a2ff67d8159545aa8b99b62b10bed07fdb5 Mon Sep 17 00:00:00 2001 From: Brady Holt Date: Wed, 15 Apr 2026 16:55:14 -0500 Subject: [PATCH] Generate against server v1.83.0 --- .openapi-generator/FILES | 36 ++ .openapi-generator/VERSION | 2 +- docs/Account.md | 6 + docs/AccountBase.md | 46 +++ docs/Category.md | 14 + docs/CategoryBase.md | 54 +++ docs/ExistingCategory.md | 3 +- docs/HybridTransaction.md | 2 + docs/MoneyMovement.md | 2 + docs/MoneyMovementBase.md | 37 ++ docs/MonthDetail.md | 8 + docs/MonthDetailBase.md | 37 ++ docs/MonthSummary.md | 8 + docs/MonthSummaryBase.md | 36 ++ docs/NewCategory.md | 3 +- docs/PayeesApi.md | 83 +++++ docs/PlanDetail.md | 14 +- docs/PostPayee.md | 29 ++ docs/PostPayeeWrapper.md | 29 ++ docs/SaveAccount.md | 2 +- docs/SaveAccountType.md | 21 ++ docs/SaveCategory.md | 3 +- docs/SavePayee.md | 2 +- docs/ScheduledSubTransaction.md | 2 + docs/ScheduledSubTransactionBase.md | 38 +++ docs/ScheduledTransactionDetail.md | 2 + docs/ScheduledTransactionSummary.md | 2 + docs/ScheduledTransactionSummaryBase.md | 41 +++ docs/SubTransaction.md | 2 + docs/SubTransactionBase.md | 39 +++ docs/TransactionDetail.md | 2 + docs/TransactionSummary.md | 2 + docs/TransactionSummaryBase.md | 47 +++ open_api_spec.yaml | 316 ++++++++++++++++-- pyproject.toml | 2 +- requirements.txt | 2 +- test/test_account_base.py | 84 +++++ test/test_category_base.py | 84 +++++ test/test_money_movement_base.py | 61 ++++ test/test_month_detail_base.py | 122 +++++++ test/test_month_summary_base.py | 64 ++++ test/test_post_payee.py | 52 +++ test/test_post_payee_wrapper.py | 54 +++ test/test_save_account_type.py | 33 ++ test/test_scheduled_sub_transaction_base.py | 64 ++++ ...test_scheduled_transaction_summary_base.py | 70 ++++ test/test_sub_transaction_base.py | 65 ++++ test/test_transaction_summary_base.py | 76 +++++ ynab/__init__.py | 28 +- ynab/api/accounts_api.py | 2 +- ynab/api/categories_api.py | 2 +- ynab/api/money_movements_api.py | 2 +- ynab/api/months_api.py | 2 +- ynab/api/payee_locations_api.py | 2 +- ynab/api/payees_api.py | 295 +++++++++++++++- ynab/api/plans_api.py | 2 +- ynab/api/scheduled_transactions_api.py | 2 +- ynab/api/transactions_api.py | 2 +- ynab/api/user_api.py | 2 +- ynab/api_client.py | 9 +- ynab/configuration.py | 6 +- ynab/exceptions.py | 2 +- ynab/models/__init__.py | 14 +- ynab/models/account.py | 51 ++- ynab/models/account_base.py | 145 ++++++++ ynab/models/account_response.py | 9 +- ynab/models/account_response_data.py | 9 +- ynab/models/account_type.py | 2 +- ynab/models/accounts_response.py | 9 +- ynab/models/accounts_response_data.py | 9 +- ynab/models/bulk_response.py | 9 +- ynab/models/bulk_response_data.py | 9 +- ynab/models/bulk_response_data_bulk.py | 9 +- ynab/models/bulk_transactions.py | 9 +- ynab/models/categories_response.py | 9 +- ynab/models/categories_response_data.py | 9 +- ynab/models/category.py | 133 ++++---- ynab/models/category_base.py | 235 +++++++++++++ ynab/models/category_group.py | 9 +- ynab/models/category_group_with_categories.py | 9 +- ynab/models/category_response.py | 9 +- ynab/models/category_response_data.py | 9 +- ynab/models/currency_format.py | 9 +- ynab/models/date_format.py | 9 +- ynab/models/error_detail.py | 9 +- ynab/models/error_response.py | 9 +- ynab/models/existing_category.py | 19 +- ynab/models/existing_transaction.py | 9 +- ynab/models/hybrid_transaction.py | 19 +- ynab/models/hybrid_transactions_response.py | 9 +- .../hybrid_transactions_response_data.py | 9 +- ynab/models/money_movement.py | 56 +--- ynab/models/money_movement_base.py | 141 ++++++++ ynab/models/money_movement_group.py | 9 +- ynab/models/money_movement_groups_response.py | 9 +- .../money_movement_groups_response_data.py | 9 +- ynab/models/money_movements_response.py | 9 +- ynab/models/money_movements_response_data.py | 9 +- ynab/models/month_detail.py | 31 +- ynab/models/month_detail_base.py | 113 +++++++ ynab/models/month_detail_response.py | 9 +- ynab/models/month_detail_response_data.py | 9 +- ynab/models/month_summaries_response.py | 9 +- ynab/models/month_summaries_response_data.py | 9 +- ynab/models/month_summary.py | 43 ++- ynab/models/month_summary_base.py | 113 +++++++ ynab/models/new_category.py | 19 +- ynab/models/new_transaction.py | 9 +- ynab/models/patch_category_group_wrapper.py | 9 +- ynab/models/patch_category_wrapper.py | 9 +- ynab/models/patch_month_category_wrapper.py | 9 +- ynab/models/patch_payee_wrapper.py | 9 +- ynab/models/patch_transactions_wrapper.py | 9 +- ynab/models/payee.py | 9 +- ynab/models/payee_location.py | 9 +- ynab/models/payee_location_response.py | 9 +- ynab/models/payee_location_response_data.py | 9 +- ynab/models/payee_locations_response.py | 9 +- ynab/models/payee_locations_response_data.py | 9 +- ynab/models/payee_response.py | 9 +- ynab/models/payee_response_data.py | 9 +- ynab/models/payees_response.py | 9 +- ynab/models/payees_response_data.py | 9 +- ynab/models/plan_detail.py | 51 +-- ynab/models/plan_detail_response.py | 9 +- ynab/models/plan_detail_response_data.py | 9 +- ynab/models/plan_settings.py | 9 +- ynab/models/plan_settings_response.py | 9 +- ynab/models/plan_settings_response_data.py | 9 +- ynab/models/plan_summary.py | 9 +- ynab/models/plan_summary_response.py | 9 +- ynab/models/plan_summary_response_data.py | 9 +- ynab/models/post_account_wrapper.py | 9 +- ynab/models/post_category_group_wrapper.py | 9 +- ynab/models/post_category_wrapper.py | 9 +- ynab/models/post_payee.py | 89 +++++ ynab/models/post_payee_wrapper.py | 92 +++++ .../post_scheduled_transaction_wrapper.py | 9 +- ynab/models/post_transactions_wrapper.py | 9 +- .../put_scheduled_transaction_wrapper.py | 9 +- ynab/models/put_transaction_wrapper.py | 9 +- ynab/models/save_account.py | 13 +- ynab/models/save_account_type.py | 41 +++ ynab/models/save_category.py | 24 +- ynab/models/save_category_group.py | 9 +- ynab/models/save_category_group_response.py | 9 +- .../save_category_group_response_data.py | 9 +- ynab/models/save_category_response.py | 9 +- ynab/models/save_category_response_data.py | 9 +- ynab/models/save_month_category.py | 9 +- ynab/models/save_payee.py | 11 +- ynab/models/save_payee_response.py | 9 +- ynab/models/save_payee_response_data.py | 9 +- ynab/models/save_scheduled_transaction.py | 9 +- ynab/models/save_sub_transaction.py | 9 +- .../save_transaction_with_id_or_import_id.py | 9 +- .../save_transaction_with_optional_fields.py | 9 +- ynab/models/save_transactions_response.py | 9 +- .../models/save_transactions_response_data.py | 9 +- ynab/models/scheduled_sub_transaction.py | 51 +-- ynab/models/scheduled_sub_transaction_base.py | 137 ++++++++ ynab/models/scheduled_transaction_detail.py | 19 +- .../models/scheduled_transaction_frequency.py | 2 +- ynab/models/scheduled_transaction_response.py | 9 +- .../scheduled_transaction_response_data.py | 9 +- ynab/models/scheduled_transaction_summary.py | 46 +-- .../scheduled_transaction_summary_base.py | 152 +++++++++ .../models/scheduled_transactions_response.py | 9 +- .../scheduled_transactions_response_data.py | 9 +- ynab/models/sub_transaction.py | 56 +--- ynab/models/sub_transaction_base.py | 144 ++++++++ ynab/models/transaction_cleared_status.py | 2 +- ynab/models/transaction_detail.py | 19 +- ynab/models/transaction_flag_color.py | 2 +- ynab/models/transaction_response.py | 9 +- ynab/models/transaction_response_data.py | 9 +- ynab/models/transaction_summary.py | 71 +--- ynab/models/transaction_summary_base.py | 198 +++++++++++ ynab/models/transactions_import_response.py | 9 +- .../transactions_import_response_data.py | 9 +- ynab/models/transactions_response.py | 9 +- ynab/models/transactions_response_data.py | 9 +- ynab/models/user.py | 9 +- ynab/models/user_response.py | 9 +- ynab/models/user_response_data.py | 9 +- ynab/rest.py | 2 +- 186 files changed, 4474 insertions(+), 835 deletions(-) create mode 100644 docs/AccountBase.md create mode 100644 docs/CategoryBase.md create mode 100644 docs/MoneyMovementBase.md create mode 100644 docs/MonthDetailBase.md create mode 100644 docs/MonthSummaryBase.md create mode 100644 docs/PostPayee.md create mode 100644 docs/PostPayeeWrapper.md create mode 100644 docs/SaveAccountType.md create mode 100644 docs/ScheduledSubTransactionBase.md create mode 100644 docs/ScheduledTransactionSummaryBase.md create mode 100644 docs/SubTransactionBase.md create mode 100644 docs/TransactionSummaryBase.md create mode 100644 test/test_account_base.py create mode 100644 test/test_category_base.py create mode 100644 test/test_money_movement_base.py create mode 100644 test/test_month_detail_base.py create mode 100644 test/test_month_summary_base.py create mode 100644 test/test_post_payee.py create mode 100644 test/test_post_payee_wrapper.py create mode 100644 test/test_save_account_type.py create mode 100644 test/test_scheduled_sub_transaction_base.py create mode 100644 test/test_scheduled_transaction_summary_base.py create mode 100644 test/test_sub_transaction_base.py create mode 100644 test/test_transaction_summary_base.py create mode 100644 ynab/models/account_base.py create mode 100644 ynab/models/category_base.py create mode 100644 ynab/models/money_movement_base.py create mode 100644 ynab/models/month_detail_base.py create mode 100644 ynab/models/month_summary_base.py create mode 100644 ynab/models/post_payee.py create mode 100644 ynab/models/post_payee_wrapper.py create mode 100644 ynab/models/save_account_type.py create mode 100644 ynab/models/scheduled_sub_transaction_base.py create mode 100644 ynab/models/scheduled_transaction_summary_base.py create mode 100644 ynab/models/sub_transaction_base.py create mode 100644 ynab/models/transaction_summary_base.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index d7e460d..7eda09f 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,5 +1,6 @@ .gitignore docs/Account.md +docs/AccountBase.md docs/AccountResponse.md docs/AccountResponseData.md docs/AccountType.md @@ -14,6 +15,7 @@ docs/CategoriesApi.md docs/CategoriesResponse.md docs/CategoriesResponseData.md docs/Category.md +docs/CategoryBase.md docs/CategoryGroup.md docs/CategoryGroupWithCategories.md docs/CategoryResponse.md @@ -28,6 +30,7 @@ docs/HybridTransaction.md docs/HybridTransactionsResponse.md docs/HybridTransactionsResponseData.md docs/MoneyMovement.md +docs/MoneyMovementBase.md docs/MoneyMovementGroup.md docs/MoneyMovementGroupsResponse.md docs/MoneyMovementGroupsResponseData.md @@ -35,11 +38,13 @@ docs/MoneyMovementsApi.md docs/MoneyMovementsResponse.md docs/MoneyMovementsResponseData.md docs/MonthDetail.md +docs/MonthDetailBase.md docs/MonthDetailResponse.md docs/MonthDetailResponseData.md docs/MonthSummariesResponse.md docs/MonthSummariesResponseData.md docs/MonthSummary.md +docs/MonthSummaryBase.md docs/MonthsApi.md docs/NewCategory.md docs/NewTransaction.md @@ -73,11 +78,14 @@ docs/PlansApi.md docs/PostAccountWrapper.md docs/PostCategoryGroupWrapper.md docs/PostCategoryWrapper.md +docs/PostPayee.md +docs/PostPayeeWrapper.md docs/PostScheduledTransactionWrapper.md docs/PostTransactionsWrapper.md docs/PutScheduledTransactionWrapper.md docs/PutTransactionWrapper.md docs/SaveAccount.md +docs/SaveAccountType.md docs/SaveCategory.md docs/SaveCategoryGroup.md docs/SaveCategoryGroupResponse.md @@ -95,21 +103,25 @@ docs/SaveTransactionWithOptionalFields.md docs/SaveTransactionsResponse.md docs/SaveTransactionsResponseData.md docs/ScheduledSubTransaction.md +docs/ScheduledSubTransactionBase.md docs/ScheduledTransactionDetail.md docs/ScheduledTransactionFrequency.md docs/ScheduledTransactionResponse.md docs/ScheduledTransactionResponseData.md docs/ScheduledTransactionSummary.md +docs/ScheduledTransactionSummaryBase.md docs/ScheduledTransactionsApi.md docs/ScheduledTransactionsResponse.md docs/ScheduledTransactionsResponseData.md docs/SubTransaction.md +docs/SubTransactionBase.md docs/TransactionClearedStatus.md docs/TransactionDetail.md docs/TransactionFlagColor.md docs/TransactionResponse.md docs/TransactionResponseData.md docs/TransactionSummary.md +docs/TransactionSummaryBase.md docs/TransactionsApi.md docs/TransactionsImportResponse.md docs/TransactionsImportResponseData.md @@ -123,6 +135,18 @@ pyproject.toml requirements.txt test-requirements.txt test/__init__.py +test/test_account_base.py +test/test_category_base.py +test/test_money_movement_base.py +test/test_month_detail_base.py +test/test_month_summary_base.py +test/test_post_payee.py +test/test_post_payee_wrapper.py +test/test_save_account_type.py +test/test_scheduled_sub_transaction_base.py +test/test_scheduled_transaction_summary_base.py +test/test_sub_transaction_base.py +test/test_transaction_summary_base.py tox.ini ynab/__init__.py ynab/api/__init__.py @@ -142,6 +166,7 @@ ynab/configuration.py ynab/exceptions.py ynab/models/__init__.py ynab/models/account.py +ynab/models/account_base.py ynab/models/account_response.py ynab/models/account_response_data.py ynab/models/account_type.py @@ -154,6 +179,7 @@ ynab/models/bulk_transactions.py ynab/models/categories_response.py ynab/models/categories_response_data.py ynab/models/category.py +ynab/models/category_base.py ynab/models/category_group.py ynab/models/category_group_with_categories.py ynab/models/category_response.py @@ -168,17 +194,20 @@ ynab/models/hybrid_transaction.py ynab/models/hybrid_transactions_response.py ynab/models/hybrid_transactions_response_data.py ynab/models/money_movement.py +ynab/models/money_movement_base.py ynab/models/money_movement_group.py ynab/models/money_movement_groups_response.py ynab/models/money_movement_groups_response_data.py ynab/models/money_movements_response.py ynab/models/money_movements_response_data.py ynab/models/month_detail.py +ynab/models/month_detail_base.py ynab/models/month_detail_response.py ynab/models/month_detail_response_data.py ynab/models/month_summaries_response.py ynab/models/month_summaries_response_data.py ynab/models/month_summary.py +ynab/models/month_summary_base.py ynab/models/new_category.py ynab/models/new_transaction.py ynab/models/patch_category_group_wrapper.py @@ -208,11 +237,14 @@ ynab/models/plan_summary_response_data.py ynab/models/post_account_wrapper.py ynab/models/post_category_group_wrapper.py ynab/models/post_category_wrapper.py +ynab/models/post_payee.py +ynab/models/post_payee_wrapper.py ynab/models/post_scheduled_transaction_wrapper.py ynab/models/post_transactions_wrapper.py ynab/models/put_scheduled_transaction_wrapper.py ynab/models/put_transaction_wrapper.py ynab/models/save_account.py +ynab/models/save_account_type.py ynab/models/save_category.py ynab/models/save_category_group.py ynab/models/save_category_group_response.py @@ -230,20 +262,24 @@ ynab/models/save_transaction_with_optional_fields.py ynab/models/save_transactions_response.py ynab/models/save_transactions_response_data.py ynab/models/scheduled_sub_transaction.py +ynab/models/scheduled_sub_transaction_base.py ynab/models/scheduled_transaction_detail.py ynab/models/scheduled_transaction_frequency.py ynab/models/scheduled_transaction_response.py ynab/models/scheduled_transaction_response_data.py ynab/models/scheduled_transaction_summary.py +ynab/models/scheduled_transaction_summary_base.py ynab/models/scheduled_transactions_response.py ynab/models/scheduled_transactions_response_data.py ynab/models/sub_transaction.py +ynab/models/sub_transaction_base.py ynab/models/transaction_cleared_status.py ynab/models/transaction_detail.py ynab/models/transaction_flag_color.py ynab/models/transaction_response.py ynab/models/transaction_response_data.py ynab/models/transaction_summary.py +ynab/models/transaction_summary_base.py ynab/models/transactions_import_response.py ynab/models/transactions_import_response_data.py ynab/models/transactions_response.py diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 2540a3a..a29ba3d 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.20.0 +7.21.0 diff --git a/docs/Account.md b/docs/Account.md index e67627e..402bdf8 100644 --- a/docs/Account.md +++ b/docs/Account.md @@ -23,6 +23,12 @@ Name | Type | Description | Notes **debt_minimum_payments** | **Dict[str, int]** | | [optional] **debt_escrow_amounts** | **Dict[str, int]** | | [optional] **deleted** | **bool** | Whether or not the account has been deleted. Deleted accounts will only be included in delta requests. | +**balance_formatted** | **str** | The current available balance of the account formatted in the plan's currency format | [optional] +**balance_currency** | **float** | The current available balance of the account as a decimal currency amount | [optional] +**cleared_balance_formatted** | **str** | The current cleared balance of the account formatted in the plan's currency format | [optional] +**cleared_balance_currency** | **float** | The current cleared balance of the account as a decimal currency amount | [optional] +**uncleared_balance_formatted** | **str** | The current uncleared balance of the account formatted in the plan's currency format | [optional] +**uncleared_balance_currency** | **float** | The current uncleared balance of the account as a decimal currency amount | [optional] ## Example diff --git a/docs/AccountBase.md b/docs/AccountBase.md new file mode 100644 index 0000000..2603a55 --- /dev/null +++ b/docs/AccountBase.md @@ -0,0 +1,46 @@ +# AccountBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **UUID** | | +**name** | **str** | | +**type** | [**AccountType**](AccountType.md) | | +**on_budget** | **bool** | Whether this account is \"on budget\" or not | +**closed** | **bool** | Whether this account is closed or not | +**note** | **str** | | [optional] +**balance** | **int** | The current available balance of the account in milliunits format | +**cleared_balance** | **int** | The current cleared balance of the account in milliunits format | +**uncleared_balance** | **int** | The current uncleared balance of the account in milliunits format | +**transfer_payee_id** | **UUID** | The payee id which should be used when transferring to this account | +**direct_import_linked** | **bool** | Whether or not the account is linked to a financial institution for automatic transaction import. | [optional] +**direct_import_in_error** | **bool** | If an account linked to a financial institution (direct_import_linked=true) and the linked connection is not in a healthy state, this will be true. | [optional] +**last_reconciled_at** | **datetime** | A date/time specifying when the account was last reconciled. | [optional] +**debt_original_balance** | **int** | This field is deprecated and will always be null. | [optional] +**debt_interest_rates** | **Dict[str, int]** | | [optional] +**debt_minimum_payments** | **Dict[str, int]** | | [optional] +**debt_escrow_amounts** | **Dict[str, int]** | | [optional] +**deleted** | **bool** | Whether or not the account has been deleted. Deleted accounts will only be included in delta requests. | + +## Example + +```python +from ynab.models.account_base import AccountBase + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountBase from a JSON string +account_base_instance = AccountBase.from_json(json) +# print the JSON string representation of the object +print(AccountBase.to_json()) + +# convert the object into a dict +account_base_dict = account_base_instance.to_dict() +# create an instance of AccountBase from a dict +account_base_from_dict = AccountBase.from_dict(account_base_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Category.md b/docs/Category.md index da7ebe5..1ac1475 100644 --- a/docs/Category.md +++ b/docs/Category.md @@ -31,6 +31,20 @@ Name | Type | Description | Notes **goal_overall_left** | **int** | The amount of funding still needed to complete the goal within the current goal period. | [optional] **goal_snoozed_at** | **datetime** | The date/time the goal was snoozed. If the goal is not snoozed, this will be null. | [optional] **deleted** | **bool** | Whether or not the category has been deleted. Deleted categories will only be included in delta requests. | +**balance_formatted** | **str** | Available balance of the category formatted in the plan's currency format | [optional] +**balance_currency** | **float** | Available balance of the category as a decimal currency amount | [optional] +**activity_formatted** | **str** | Activity of the category formatted in the plan's currency format | [optional] +**activity_currency** | **float** | Activity of the category as a decimal currency amount | [optional] +**budgeted_formatted** | **str** | Assigned (budgeted) amount of the category formatted in the plan's currency format | [optional] +**budgeted_currency** | **float** | Assigned (budgeted) amount of the category as a decimal currency amount | [optional] +**goal_target_formatted** | **str** | The goal target amount formatted in the plan's currency format | [optional] +**goal_target_currency** | **float** | The goal target amount as a decimal currency amount | [optional] +**goal_under_funded_formatted** | **str** | The goal underfunded amount formatted in the plan's currency format | [optional] +**goal_under_funded_currency** | **float** | The goal underfunded amount as a decimal currency amount | [optional] +**goal_overall_funded_formatted** | **str** | The total amount funded towards the goal formatted in the plan's currency format | [optional] +**goal_overall_funded_currency** | **float** | The total amount funded towards the goal as a decimal currency amount | [optional] +**goal_overall_left_formatted** | **str** | The amount of funding still needed to complete the goal formatted in the plan's currency format | [optional] +**goal_overall_left_currency** | **float** | The amount of funding still needed to complete the goal as a decimal currency amount | [optional] ## Example diff --git a/docs/CategoryBase.md b/docs/CategoryBase.md new file mode 100644 index 0000000..0611faf --- /dev/null +++ b/docs/CategoryBase.md @@ -0,0 +1,54 @@ +# CategoryBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **UUID** | | +**category_group_id** | **UUID** | | +**category_group_name** | **str** | | [optional] +**name** | **str** | | +**hidden** | **bool** | Whether or not the category is hidden | +**original_category_group_id** | **UUID** | DEPRECATED: No longer used. Value will always be null. | [optional] +**note** | **str** | | [optional] +**budgeted** | **int** | Assigned (budgeted) amount in milliunits format | +**activity** | **int** | Activity amount in milliunits format | +**balance** | **int** | Available balance in milliunits format | +**goal_type** | **str** | The type of goal, if the category has a goal (TB='Target Category Balance', TBD='Target Category Balance by Date', MF='Monthly Funding', NEED='Plan Your Spending') | [optional] +**goal_needs_whole_amount** | **bool** | Indicates the monthly rollover behavior for \"NEED\"-type goals. When \"true\", the goal will always ask for the target amount in the new month (\"Set Aside\"). When \"false\", previous month category funding is used (\"Refill\"). For other goal types, this field will be null. | [optional] +**goal_day** | **int** | A day offset modifier for the goal's due date. When goal_cadence is 2 (Weekly), this value specifies which day of the week the goal is due (0 = Sunday, 6 = Saturday). Otherwise, this value specifies which day of the month the goal is due (1 = 1st, 31 = 31st, null = Last day of Month). | [optional] +**goal_cadence** | **int** | The goal cadence. Value in range 0-14. There are two subsets of these values which behave differently. For values 0, 1, 2, and 13, the goal's due date repeats every goal_cadence * goal_cadence_frequency, where 0 = None, 1 = Monthly, 2 = Weekly, and 13 = Yearly. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. For values 3-12 and 14, goal_cadence_frequency is ignored and the goal's due date repeats every goal_cadence, where 3 = Every 2 Months, 4 = Every 3 Months, ..., 12 = Every 11 Months, and 14 = Every 2 Years. | [optional] +**goal_cadence_frequency** | **int** | The goal cadence frequency. When goal_cadence is 0, 1, 2, or 13, a goal's due date repeats every goal_cadence * goal_cadence_frequency. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. When goal_cadence is 3-12 or 14, goal_cadence_frequency is ignored. | [optional] +**goal_creation_month** | **date** | The month a goal was created | [optional] +**goal_target** | **int** | The goal target amount in milliunits | [optional] +**goal_target_month** | **date** | DEPRECATED: No longer used. Use `goal_target_date` instead. | [optional] +**goal_target_date** | **date** | The target date for the goal to be completed. Only some goal types specify this date. | [optional] +**goal_percentage_complete** | **int** | The percentage completion of the goal | [optional] +**goal_months_to_budget** | **int** | The number of months, including the current month, left in the current goal period. | [optional] +**goal_under_funded** | **int** | The amount of funding still needed in the current month to stay on track towards completing the goal within the current goal period. This amount will generally correspond to the 'Underfunded' amount in the web and mobile clients except when viewing a category with a Needed for Spending Goal in a future month. The web and mobile clients will ignore any funding from a prior goal period when viewing category with a Needed for Spending Goal in a future month. | [optional] +**goal_overall_funded** | **int** | The total amount funded towards the goal within the current goal period. | [optional] +**goal_overall_left** | **int** | The amount of funding still needed to complete the goal within the current goal period. | [optional] +**goal_snoozed_at** | **datetime** | The date/time the goal was snoozed. If the goal is not snoozed, this will be null. | [optional] +**deleted** | **bool** | Whether or not the category has been deleted. Deleted categories will only be included in delta requests. | + +## Example + +```python +from ynab.models.category_base import CategoryBase + +# TODO update the JSON string below +json = "{}" +# create an instance of CategoryBase from a JSON string +category_base_instance = CategoryBase.from_json(json) +# print the JSON string representation of the object +print(CategoryBase.to_json()) + +# convert the object into a dict +category_base_dict = category_base_instance.to_dict() +# create an instance of CategoryBase from a dict +category_base_from_dict = CategoryBase.from_dict(category_base_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ExistingCategory.md b/docs/ExistingCategory.md index d62a64f..f189dd6 100644 --- a/docs/ExistingCategory.md +++ b/docs/ExistingCategory.md @@ -8,8 +8,9 @@ Name | Type | Description | Notes **name** | **str** | | [optional] **note** | **str** | | [optional] **category_group_id** | **UUID** | | [optional] -**goal_target** | **int** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount. | [optional] +**goal_target** | **int** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories. | [optional] **goal_target_date** | **date** | The goal target date in ISO format (e.g. 2016-12-01). | [optional] +**goal_needs_whole_amount** | **bool** | Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'. | [optional] ## Example diff --git a/docs/HybridTransaction.md b/docs/HybridTransaction.md index 959b10a..0183974 100644 --- a/docs/HybridTransaction.md +++ b/docs/HybridTransaction.md @@ -24,6 +24,8 @@ Name | Type | Description | Notes **import_payee_name_original** | **str** | If the transaction was imported, the original payee name as it appeared on the statement | [optional] **debt_transaction_type** | **str** | If the transaction is a debt/loan account transaction, the type of transaction | [optional] **deleted** | **bool** | Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. | +**amount_formatted** | **str** | The transaction amount formatted in the plan's currency format | [optional] +**amount_currency** | **float** | The transaction amount as a decimal currency amount | [optional] **type** | **str** | Whether the hybrid transaction represents a regular transaction or a subtransaction | **parent_transaction_id** | **str** | For subtransaction types, this is the id of the parent transaction. For transaction types, this id will be always be null. | [optional] **account_name** | **str** | | diff --git a/docs/MoneyMovement.md b/docs/MoneyMovement.md index 914840f..84891ed 100644 --- a/docs/MoneyMovement.md +++ b/docs/MoneyMovement.md @@ -14,6 +14,8 @@ Name | Type | Description | Notes **from_category_id** | **UUID** | The id of the category the money was moved from | [optional] **to_category_id** | **UUID** | The id of the category the money was moved to | [optional] **amount** | **int** | The amount of the money movement in milliunits format | +**amount_formatted** | **str** | The money movement amount formatted in the plan's currency format | [optional] +**amount_currency** | **float** | The money movement amount as a decimal currency amount | [optional] ## Example diff --git a/docs/MoneyMovementBase.md b/docs/MoneyMovementBase.md new file mode 100644 index 0000000..40eee91 --- /dev/null +++ b/docs/MoneyMovementBase.md @@ -0,0 +1,37 @@ +# MoneyMovementBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **UUID** | | +**month** | **date** | The month of the money movement in ISO format (e.g. 2024-01-01) | [optional] +**moved_at** | **datetime** | The date/time the money movement was processed on the server in ISO format (e.g. 2024-01-01T12:00:00Z) | [optional] +**note** | **str** | | [optional] +**money_movement_group_id** | **UUID** | The id of the money movement group this movement belongs to | [optional] +**performed_by_user_id** | **UUID** | The id of the user who performed the money movement | [optional] +**from_category_id** | **UUID** | The id of the category the money was moved from | [optional] +**to_category_id** | **UUID** | The id of the category the money was moved to | [optional] +**amount** | **int** | The amount of the money movement in milliunits format | + +## Example + +```python +from ynab.models.money_movement_base import MoneyMovementBase + +# TODO update the JSON string below +json = "{}" +# create an instance of MoneyMovementBase from a JSON string +money_movement_base_instance = MoneyMovementBase.from_json(json) +# print the JSON string representation of the object +print(MoneyMovementBase.to_json()) + +# convert the object into a dict +money_movement_base_dict = money_movement_base_instance.to_dict() +# create an instance of MoneyMovementBase from a dict +money_movement_base_from_dict = MoneyMovementBase.from_dict(money_movement_base_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MonthDetail.md b/docs/MonthDetail.md index 6972992..8206fcb 100644 --- a/docs/MonthDetail.md +++ b/docs/MonthDetail.md @@ -13,6 +13,14 @@ Name | Type | Description | Notes **to_be_budgeted** | **int** | The available amount for 'Ready to Assign' | **age_of_money** | **int** | The Age of Money as of the month | [optional] **deleted** | **bool** | Whether or not the month has been deleted. Deleted months will only be included in delta requests. | +**income_formatted** | **str** | The total income formatted in the plan's currency format | [optional] +**income_currency** | **float** | The total income as a decimal currency amount | [optional] +**budgeted_formatted** | **str** | The total amount assigned formatted in the plan's currency format | [optional] +**budgeted_currency** | **float** | The total amount assigned as a decimal currency amount | [optional] +**activity_formatted** | **str** | The total activity amount formatted in the plan's currency format | [optional] +**activity_currency** | **float** | The total activity amount as a decimal currency amount | [optional] +**to_be_budgeted_formatted** | **str** | The available amount for 'Ready to Assign' formatted in the plan's currency format | [optional] +**to_be_budgeted_currency** | **float** | The available amount for 'Ready to Assign' as a decimal currency amount | [optional] **categories** | [**List[Category]**](Category.md) | The plan month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified. | ## Example diff --git a/docs/MonthDetailBase.md b/docs/MonthDetailBase.md new file mode 100644 index 0000000..88b8821 --- /dev/null +++ b/docs/MonthDetailBase.md @@ -0,0 +1,37 @@ +# MonthDetailBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**month** | **date** | | +**note** | **str** | | [optional] +**income** | **int** | The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month | +**budgeted** | **int** | The total amount assigned (budgeted) in the month | +**activity** | **int** | The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign' | +**to_be_budgeted** | **int** | The available amount for 'Ready to Assign' | +**age_of_money** | **int** | The Age of Money as of the month | [optional] +**deleted** | **bool** | Whether or not the month has been deleted. Deleted months will only be included in delta requests. | +**categories** | [**List[CategoryBase]**](CategoryBase.md) | The plan month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified. | + +## Example + +```python +from ynab.models.month_detail_base import MonthDetailBase + +# TODO update the JSON string below +json = "{}" +# create an instance of MonthDetailBase from a JSON string +month_detail_base_instance = MonthDetailBase.from_json(json) +# print the JSON string representation of the object +print(MonthDetailBase.to_json()) + +# convert the object into a dict +month_detail_base_dict = month_detail_base_instance.to_dict() +# create an instance of MonthDetailBase from a dict +month_detail_base_from_dict = MonthDetailBase.from_dict(month_detail_base_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/MonthSummary.md b/docs/MonthSummary.md index bd4ac76..502981f 100644 --- a/docs/MonthSummary.md +++ b/docs/MonthSummary.md @@ -13,6 +13,14 @@ Name | Type | Description | Notes **to_be_budgeted** | **int** | The available amount for 'Ready to Assign' | **age_of_money** | **int** | The Age of Money as of the month | [optional] **deleted** | **bool** | Whether or not the month has been deleted. Deleted months will only be included in delta requests. | +**income_formatted** | **str** | The total income formatted in the plan's currency format | [optional] +**income_currency** | **float** | The total income as a decimal currency amount | [optional] +**budgeted_formatted** | **str** | The total amount assigned formatted in the plan's currency format | [optional] +**budgeted_currency** | **float** | The total amount assigned as a decimal currency amount | [optional] +**activity_formatted** | **str** | The total activity amount formatted in the plan's currency format | [optional] +**activity_currency** | **float** | The total activity amount as a decimal currency amount | [optional] +**to_be_budgeted_formatted** | **str** | The available amount for 'Ready to Assign' formatted in the plan's currency format | [optional] +**to_be_budgeted_currency** | **float** | The available amount for 'Ready to Assign' as a decimal currency amount | [optional] ## Example diff --git a/docs/MonthSummaryBase.md b/docs/MonthSummaryBase.md new file mode 100644 index 0000000..79d1fba --- /dev/null +++ b/docs/MonthSummaryBase.md @@ -0,0 +1,36 @@ +# MonthSummaryBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**month** | **date** | | +**note** | **str** | | [optional] +**income** | **int** | The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month | +**budgeted** | **int** | The total amount assigned (budgeted) in the month | +**activity** | **int** | The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign' | +**to_be_budgeted** | **int** | The available amount for 'Ready to Assign' | +**age_of_money** | **int** | The Age of Money as of the month | [optional] +**deleted** | **bool** | Whether or not the month has been deleted. Deleted months will only be included in delta requests. | + +## Example + +```python +from ynab.models.month_summary_base import MonthSummaryBase + +# TODO update the JSON string below +json = "{}" +# create an instance of MonthSummaryBase from a JSON string +month_summary_base_instance = MonthSummaryBase.from_json(json) +# print the JSON string representation of the object +print(MonthSummaryBase.to_json()) + +# convert the object into a dict +month_summary_base_dict = month_summary_base_instance.to_dict() +# create an instance of MonthSummaryBase from a dict +month_summary_base_from_dict = MonthSummaryBase.from_dict(month_summary_base_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/NewCategory.md b/docs/NewCategory.md index 3e66f6e..a0c2922 100644 --- a/docs/NewCategory.md +++ b/docs/NewCategory.md @@ -8,8 +8,9 @@ Name | Type | Description | Notes **name** | **str** | | [optional] **note** | **str** | | [optional] **category_group_id** | **UUID** | | [optional] -**goal_target** | **int** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount. | [optional] +**goal_target** | **int** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories. | [optional] **goal_target_date** | **date** | The goal target date in ISO format (e.g. 2016-12-01). | [optional] +**goal_needs_whole_amount** | **bool** | Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'. | [optional] ## Example diff --git a/docs/PayeesApi.md b/docs/PayeesApi.md index 02291f1..eaef559 100644 --- a/docs/PayeesApi.md +++ b/docs/PayeesApi.md @@ -4,11 +4,94 @@ All URIs are relative to *https://api.ynab.com/v1* Method | HTTP request | Description ------------- | ------------- | ------------- +[**create_payee**](PayeesApi.md#create_payee) | **POST** /plans/{plan_id}/payees | Create a payee [**get_payee_by_id**](PayeesApi.md#get_payee_by_id) | **GET** /plans/{plan_id}/payees/{payee_id} | Get a payee [**get_payees**](PayeesApi.md#get_payees) | **GET** /plans/{plan_id}/payees | Get all payees [**update_payee**](PayeesApi.md#update_payee) | **PATCH** /plans/{plan_id}/payees/{payee_id} | Update a payee +# **create_payee** +> SavePayeeResponse create_payee(plan_id, data) + +Create a payee + +Creates a new payee + +### Example + +* Bearer Authentication (bearer): + +```python +import ynab +from ynab.models.post_payee_wrapper import PostPayeeWrapper +from ynab.models.save_payee_response import SavePayeeResponse +from ynab.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.ynab.com/v1 +# See configuration.py for a list of all supported configuration parameters. +configuration = ynab.Configuration( + host = "https://api.ynab.com/v1" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: bearer +configuration = ynab.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with ynab.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = ynab.PayeesApi(api_client) + plan_id = 'plan_id_example' # str | The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). + data = ynab.PostPayeeWrapper() # PostPayeeWrapper | The payee to create + + try: + # Create a payee + api_response = api_instance.create_payee(plan_id, data) + print("The response of PayeesApi->create_payee:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PayeesApi->create_payee: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **plan_id** | **str**| The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). | + **data** | [**PostPayeeWrapper**](PostPayeeWrapper.md)| The payee to create | + +### Return type + +[**SavePayeeResponse**](SavePayeeResponse.md) + +### Authorization + +[bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | The payee was successfully created | - | +**400** | The request could not be understood due to malformed syntax or validation error(s) | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **get_payee_by_id** > PayeeResponse get_payee_by_id(plan_id, payee_id) diff --git a/docs/PlanDetail.md b/docs/PlanDetail.md index 55b4e04..3687c8e 100644 --- a/docs/PlanDetail.md +++ b/docs/PlanDetail.md @@ -12,16 +12,16 @@ Name | Type | Description | Notes **last_month** | **date** | The latest plan month | [optional] **date_format** | [**DateFormat**](DateFormat.md) | | [optional] **currency_format** | [**CurrencyFormat**](CurrencyFormat.md) | | [optional] -**accounts** | [**List[Account]**](Account.md) | | [optional] +**accounts** | [**List[AccountBase]**](AccountBase.md) | | [optional] **payees** | [**List[Payee]**](Payee.md) | | [optional] **payee_locations** | [**List[PayeeLocation]**](PayeeLocation.md) | | [optional] **category_groups** | [**List[CategoryGroup]**](CategoryGroup.md) | | [optional] -**categories** | [**List[Category]**](Category.md) | | [optional] -**months** | [**List[MonthDetail]**](MonthDetail.md) | | [optional] -**transactions** | [**List[TransactionSummary]**](TransactionSummary.md) | | [optional] -**subtransactions** | [**List[SubTransaction]**](SubTransaction.md) | | [optional] -**scheduled_transactions** | [**List[ScheduledTransactionSummary]**](ScheduledTransactionSummary.md) | | [optional] -**scheduled_subtransactions** | [**List[ScheduledSubTransaction]**](ScheduledSubTransaction.md) | | [optional] +**categories** | [**List[CategoryBase]**](CategoryBase.md) | | [optional] +**months** | [**List[MonthDetailBase]**](MonthDetailBase.md) | | [optional] +**transactions** | [**List[TransactionSummaryBase]**](TransactionSummaryBase.md) | | [optional] +**subtransactions** | [**List[SubTransactionBase]**](SubTransactionBase.md) | | [optional] +**scheduled_transactions** | [**List[ScheduledTransactionSummaryBase]**](ScheduledTransactionSummaryBase.md) | | [optional] +**scheduled_subtransactions** | [**List[ScheduledSubTransactionBase]**](ScheduledSubTransactionBase.md) | | [optional] ## Example diff --git a/docs/PostPayee.md b/docs/PostPayee.md new file mode 100644 index 0000000..617248a --- /dev/null +++ b/docs/PostPayee.md @@ -0,0 +1,29 @@ +# PostPayee + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | The name of the payee. | + +## Example + +```python +from ynab.models.post_payee import PostPayee + +# TODO update the JSON string below +json = "{}" +# create an instance of PostPayee from a JSON string +post_payee_instance = PostPayee.from_json(json) +# print the JSON string representation of the object +print(PostPayee.to_json()) + +# convert the object into a dict +post_payee_dict = post_payee_instance.to_dict() +# create an instance of PostPayee from a dict +post_payee_from_dict = PostPayee.from_dict(post_payee_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PostPayeeWrapper.md b/docs/PostPayeeWrapper.md new file mode 100644 index 0000000..c9494c7 --- /dev/null +++ b/docs/PostPayeeWrapper.md @@ -0,0 +1,29 @@ +# PostPayeeWrapper + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**payee** | [**PostPayee**](PostPayee.md) | | + +## Example + +```python +from ynab.models.post_payee_wrapper import PostPayeeWrapper + +# TODO update the JSON string below +json = "{}" +# create an instance of PostPayeeWrapper from a JSON string +post_payee_wrapper_instance = PostPayeeWrapper.from_json(json) +# print the JSON string representation of the object +print(PostPayeeWrapper.to_json()) + +# convert the object into a dict +post_payee_wrapper_dict = post_payee_wrapper_instance.to_dict() +# create an instance of PostPayeeWrapper from a dict +post_payee_wrapper_from_dict = PostPayeeWrapper.from_dict(post_payee_wrapper_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SaveAccount.md b/docs/SaveAccount.md index 663c359..07717c5 100644 --- a/docs/SaveAccount.md +++ b/docs/SaveAccount.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **str** | The name of the account | -**type** | [**AccountType**](AccountType.md) | | +**type** | [**SaveAccountType**](SaveAccountType.md) | | **balance** | **int** | The current balance of the account in milliunits format | ## Example diff --git a/docs/SaveAccountType.md b/docs/SaveAccountType.md new file mode 100644 index 0000000..bcd041b --- /dev/null +++ b/docs/SaveAccountType.md @@ -0,0 +1,21 @@ +# SaveAccountType + +The type of account to create or update + +## Enum + +* `CHECKING` (value: `'checking'`) + +* `SAVINGS` (value: `'savings'`) + +* `CASH` (value: `'cash'`) + +* `CREDITCARD` (value: `'creditCard'`) + +* `OTHERASSET` (value: `'otherAsset'`) + +* `OTHERLIABILITY` (value: `'otherLiability'`) + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SaveCategory.md b/docs/SaveCategory.md index 2eaf754..ea0eca3 100644 --- a/docs/SaveCategory.md +++ b/docs/SaveCategory.md @@ -8,8 +8,9 @@ Name | Type | Description | Notes **name** | **str** | | [optional] **note** | **str** | | [optional] **category_group_id** | **UUID** | | [optional] -**goal_target** | **int** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount. | [optional] +**goal_target** | **int** | The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories. | [optional] **goal_target_date** | **date** | The goal target date in ISO format (e.g. 2016-12-01). | [optional] +**goal_needs_whole_amount** | **bool** | Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'. | [optional] ## Example diff --git a/docs/SavePayee.md b/docs/SavePayee.md index ebc99ea..df9e5f7 100644 --- a/docs/SavePayee.md +++ b/docs/SavePayee.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **str** | The name of the payee. The name must be a maximum of 500 characters. | [optional] +**name** | **str** | The name of the payee. | [optional] ## Example diff --git a/docs/ScheduledSubTransaction.md b/docs/ScheduledSubTransaction.md index 8ba03a6..cd946f8 100644 --- a/docs/ScheduledSubTransaction.md +++ b/docs/ScheduledSubTransaction.md @@ -15,6 +15,8 @@ Name | Type | Description | Notes **category_name** | **str** | | [optional] **transfer_account_id** | **UUID** | If a transfer, the account_id which the scheduled subtransaction transfers to | [optional] **deleted** | **bool** | Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests. | +**amount_formatted** | **str** | The scheduled subtransaction amount formatted in the plan's currency format | [optional] +**amount_currency** | **float** | The scheduled subtransaction amount as a decimal currency amount | [optional] ## Example diff --git a/docs/ScheduledSubTransactionBase.md b/docs/ScheduledSubTransactionBase.md new file mode 100644 index 0000000..a7015c9 --- /dev/null +++ b/docs/ScheduledSubTransactionBase.md @@ -0,0 +1,38 @@ +# ScheduledSubTransactionBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **UUID** | | +**scheduled_transaction_id** | **UUID** | | +**amount** | **int** | The scheduled subtransaction amount in milliunits format | +**memo** | **str** | | [optional] +**payee_id** | **UUID** | | [optional] +**payee_name** | **str** | | [optional] +**category_id** | **UUID** | | [optional] +**category_name** | **str** | | [optional] +**transfer_account_id** | **UUID** | If a transfer, the account_id which the scheduled subtransaction transfers to | [optional] +**deleted** | **bool** | Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests. | + +## Example + +```python +from ynab.models.scheduled_sub_transaction_base import ScheduledSubTransactionBase + +# TODO update the JSON string below +json = "{}" +# create an instance of ScheduledSubTransactionBase from a JSON string +scheduled_sub_transaction_base_instance = ScheduledSubTransactionBase.from_json(json) +# print the JSON string representation of the object +print(ScheduledSubTransactionBase.to_json()) + +# convert the object into a dict +scheduled_sub_transaction_base_dict = scheduled_sub_transaction_base_instance.to_dict() +# create an instance of ScheduledSubTransactionBase from a dict +scheduled_sub_transaction_base_from_dict = ScheduledSubTransactionBase.from_dict(scheduled_sub_transaction_base_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ScheduledTransactionDetail.md b/docs/ScheduledTransactionDetail.md index 4b5a1ac..4f44120 100644 --- a/docs/ScheduledTransactionDetail.md +++ b/docs/ScheduledTransactionDetail.md @@ -18,6 +18,8 @@ Name | Type | Description | Notes **category_id** | **UUID** | | [optional] **transfer_account_id** | **UUID** | If a transfer, the account_id which the scheduled transaction transfers to | [optional] **deleted** | **bool** | Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. | +**amount_formatted** | **str** | The scheduled transaction amount formatted in the plan's currency format | [optional] +**amount_currency** | **float** | The scheduled transaction amount as a decimal currency amount | [optional] **account_name** | **str** | | **payee_name** | **str** | | [optional] **category_name** | **str** | The name of the category. If a split scheduled transaction, this will be 'Split'. | [optional] diff --git a/docs/ScheduledTransactionSummary.md b/docs/ScheduledTransactionSummary.md index 42b1118..3b5dbe4 100644 --- a/docs/ScheduledTransactionSummary.md +++ b/docs/ScheduledTransactionSummary.md @@ -18,6 +18,8 @@ Name | Type | Description | Notes **category_id** | **UUID** | | [optional] **transfer_account_id** | **UUID** | If a transfer, the account_id which the scheduled transaction transfers to | [optional] **deleted** | **bool** | Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. | +**amount_formatted** | **str** | The scheduled transaction amount formatted in the plan's currency format | [optional] +**amount_currency** | **float** | The scheduled transaction amount as a decimal currency amount | [optional] ## Example diff --git a/docs/ScheduledTransactionSummaryBase.md b/docs/ScheduledTransactionSummaryBase.md new file mode 100644 index 0000000..6d059c0 --- /dev/null +++ b/docs/ScheduledTransactionSummaryBase.md @@ -0,0 +1,41 @@ +# ScheduledTransactionSummaryBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **UUID** | | +**date_first** | **date** | The first date for which the Scheduled Transaction was scheduled. | +**date_next** | **date** | The next date for which the Scheduled Transaction is scheduled. | +**frequency** | **str** | | +**amount** | **int** | The scheduled transaction amount in milliunits format | +**memo** | **str** | | [optional] +**flag_color** | [**TransactionFlagColor**](TransactionFlagColor.md) | | [optional] +**flag_name** | **str** | The customized name of a transaction flag | [optional] +**account_id** | **UUID** | | +**payee_id** | **UUID** | | [optional] +**category_id** | **UUID** | | [optional] +**transfer_account_id** | **UUID** | If a transfer, the account_id which the scheduled transaction transfers to | [optional] +**deleted** | **bool** | Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. | + +## Example + +```python +from ynab.models.scheduled_transaction_summary_base import ScheduledTransactionSummaryBase + +# TODO update the JSON string below +json = "{}" +# create an instance of ScheduledTransactionSummaryBase from a JSON string +scheduled_transaction_summary_base_instance = ScheduledTransactionSummaryBase.from_json(json) +# print the JSON string representation of the object +print(ScheduledTransactionSummaryBase.to_json()) + +# convert the object into a dict +scheduled_transaction_summary_base_dict = scheduled_transaction_summary_base_instance.to_dict() +# create an instance of ScheduledTransactionSummaryBase from a dict +scheduled_transaction_summary_base_from_dict = ScheduledTransactionSummaryBase.from_dict(scheduled_transaction_summary_base_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SubTransaction.md b/docs/SubTransaction.md index 0ed6aad..1d4eddc 100644 --- a/docs/SubTransaction.md +++ b/docs/SubTransaction.md @@ -16,6 +16,8 @@ Name | Type | Description | Notes **transfer_account_id** | **UUID** | If a transfer, the account_id which the subtransaction transfers to | [optional] **transfer_transaction_id** | **str** | If a transfer, the id of transaction on the other side of the transfer | [optional] **deleted** | **bool** | Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests. | +**amount_formatted** | **str** | The subtransaction amount formatted in the plan's currency format | [optional] +**amount_currency** | **float** | The subtransaction amount as a decimal currency amount | [optional] ## Example diff --git a/docs/SubTransactionBase.md b/docs/SubTransactionBase.md new file mode 100644 index 0000000..438deb0 --- /dev/null +++ b/docs/SubTransactionBase.md @@ -0,0 +1,39 @@ +# SubTransactionBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | +**transaction_id** | **str** | | +**amount** | **int** | The subtransaction amount in milliunits format | +**memo** | **str** | | [optional] +**payee_id** | **UUID** | | [optional] +**payee_name** | **str** | | [optional] +**category_id** | **UUID** | | [optional] +**category_name** | **str** | | [optional] +**transfer_account_id** | **UUID** | If a transfer, the account_id which the subtransaction transfers to | [optional] +**transfer_transaction_id** | **str** | If a transfer, the id of transaction on the other side of the transfer | [optional] +**deleted** | **bool** | Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests. | + +## Example + +```python +from ynab.models.sub_transaction_base import SubTransactionBase + +# TODO update the JSON string below +json = "{}" +# create an instance of SubTransactionBase from a JSON string +sub_transaction_base_instance = SubTransactionBase.from_json(json) +# print the JSON string representation of the object +print(SubTransactionBase.to_json()) + +# convert the object into a dict +sub_transaction_base_dict = sub_transaction_base_instance.to_dict() +# create an instance of SubTransactionBase from a dict +sub_transaction_base_from_dict = SubTransactionBase.from_dict(sub_transaction_base_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TransactionDetail.md b/docs/TransactionDetail.md index f2624a3..01d19c8 100644 --- a/docs/TransactionDetail.md +++ b/docs/TransactionDetail.md @@ -24,6 +24,8 @@ Name | Type | Description | Notes **import_payee_name_original** | **str** | If the transaction was imported, the original payee name as it appeared on the statement | [optional] **debt_transaction_type** | **str** | If the transaction is a debt/loan account transaction, the type of transaction | [optional] **deleted** | **bool** | Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. | +**amount_formatted** | **str** | The transaction amount formatted in the plan's currency format | [optional] +**amount_currency** | **float** | The transaction amount as a decimal currency amount | [optional] **account_name** | **str** | | **payee_name** | **str** | | [optional] **category_name** | **str** | The name of the category. If a split transaction, this will be 'Split'. | [optional] diff --git a/docs/TransactionSummary.md b/docs/TransactionSummary.md index 7941337..a8dcbe1 100644 --- a/docs/TransactionSummary.md +++ b/docs/TransactionSummary.md @@ -24,6 +24,8 @@ Name | Type | Description | Notes **import_payee_name_original** | **str** | If the transaction was imported, the original payee name as it appeared on the statement | [optional] **debt_transaction_type** | **str** | If the transaction is a debt/loan account transaction, the type of transaction | [optional] **deleted** | **bool** | Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. | +**amount_formatted** | **str** | The transaction amount formatted in the plan's currency format | [optional] +**amount_currency** | **float** | The transaction amount as a decimal currency amount | [optional] ## Example diff --git a/docs/TransactionSummaryBase.md b/docs/TransactionSummaryBase.md new file mode 100644 index 0000000..799276f --- /dev/null +++ b/docs/TransactionSummaryBase.md @@ -0,0 +1,47 @@ +# TransactionSummaryBase + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | +**var_date** | **date** | The transaction date in ISO format (e.g. 2016-12-01) | +**amount** | **int** | The transaction amount in milliunits format | +**memo** | **str** | | [optional] +**cleared** | [**TransactionClearedStatus**](TransactionClearedStatus.md) | | +**approved** | **bool** | Whether or not the transaction is approved | +**flag_color** | [**TransactionFlagColor**](TransactionFlagColor.md) | | [optional] +**flag_name** | **str** | The customized name of a transaction flag | [optional] +**account_id** | **UUID** | | +**payee_id** | **UUID** | | [optional] +**category_id** | **UUID** | | [optional] +**transfer_account_id** | **UUID** | If a transfer transaction, the account to which it transfers | [optional] +**transfer_transaction_id** | **str** | If a transfer transaction, the id of transaction on the other side of the transfer | [optional] +**matched_transaction_id** | **str** | If transaction is matched, the id of the matched transaction | [optional] +**import_id** | **str** | If the transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. | [optional] +**import_payee_name** | **str** | If the transaction was imported, the payee name that was used when importing and before applying any payee rename rules | [optional] +**import_payee_name_original** | **str** | If the transaction was imported, the original payee name as it appeared on the statement | [optional] +**debt_transaction_type** | **str** | If the transaction is a debt/loan account transaction, the type of transaction | [optional] +**deleted** | **bool** | Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. | + +## Example + +```python +from ynab.models.transaction_summary_base import TransactionSummaryBase + +# TODO update the JSON string below +json = "{}" +# create an instance of TransactionSummaryBase from a JSON string +transaction_summary_base_instance = TransactionSummaryBase.from_json(json) +# print the JSON string representation of the object +print(TransactionSummaryBase.to_json()) + +# convert the object into a dict +transaction_summary_base_dict = transaction_summary_base_instance.to_dict() +# create an instance of TransactionSummaryBase from a dict +transaction_summary_base_from_dict = TransactionSummaryBase.from_dict(transaction_summary_base_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/open_api_spec.yaml b/open_api_spec.yaml index 3da6a84..c054223 100644 --- a/open_api_spec.yaml +++ b/open_api_spec.yaml @@ -5,7 +5,7 @@ info: and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - version: 1.79.0 + version: 1.83.0 servers: - url: https://api.ynab.com/v1 security: @@ -622,6 +622,43 @@ paths: application/json: schema: $ref: "#/components/schemas/ErrorResponse" + post: + tags: + - Payees + summary: Create a payee + description: Creates a new payee + operationId: createPayee + parameters: + - name: plan_id + in: path + description: 'The id of the plan. "last-used" can be used to specify the last + used plan and "default" can be used if default plan selection is + enabled (see: https://api.ynab.com/#oauth-default-plan).' + required: true + schema: + type: string + requestBody: + description: The payee to create + content: + application/json: + schema: + $ref: "#/components/schemas/PostPayeeWrapper" + required: true + responses: + "201": + description: The payee was successfully created + content: + application/json: + schema: + $ref: "#/components/schemas/SavePayeeResponse" + "400": + description: The request could not be understood due to malformed syntax or + validation error(s) + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + x-codegen-request-body-name: data /plans/{plan_id}/payees/{payee_id}: get: tags: @@ -1897,7 +1934,7 @@ components: accounts: type: array items: - $ref: "#/components/schemas/Account" + $ref: "#/components/schemas/AccountBase" payees: type: array items: @@ -1913,27 +1950,27 @@ components: categories: type: array items: - $ref: "#/components/schemas/Category" + $ref: "#/components/schemas/CategoryBase" months: type: array items: - $ref: "#/components/schemas/MonthDetail" + $ref: "#/components/schemas/MonthDetailBase" transactions: type: array items: - $ref: "#/components/schemas/TransactionSummary" + $ref: "#/components/schemas/TransactionSummaryBase" subtransactions: type: array items: - $ref: "#/components/schemas/SubTransaction" + $ref: "#/components/schemas/SubTransactionBase" scheduled_transactions: type: array items: - $ref: "#/components/schemas/ScheduledTransactionSummary" + $ref: "#/components/schemas/ScheduledTransactionSummaryBase" scheduled_subtransactions: type: array items: - $ref: "#/components/schemas/ScheduledSubTransaction" + $ref: "#/components/schemas/ScheduledSubTransactionBase" PlanSettingsResponse: required: - data @@ -1987,7 +2024,7 @@ components: properties: account: $ref: "#/components/schemas/Account" - Account: + AccountBase: required: - balance - cleared_balance @@ -2067,6 +2104,32 @@ components: type: boolean description: Whether or not the account has been deleted. Deleted accounts will only be included in delta requests. + Account: + allOf: + - $ref: "#/components/schemas/AccountBase" + - type: object + properties: + balance_formatted: + type: string + description: The current available balance of the account formatted in the plan's currency format + balance_currency: + type: number + format: double + description: The current available balance of the account as a decimal currency amount + cleared_balance_formatted: + type: string + description: The current cleared balance of the account formatted in the plan's currency format + cleared_balance_currency: + type: number + format: double + description: The current cleared balance of the account as a decimal currency amount + uncleared_balance_formatted: + type: string + description: The current uncleared balance of the account formatted in the plan's currency format + uncleared_balance_currency: + type: number + format: double + description: The current uncleared balance of the account as a decimal currency amount PostAccountWrapper: required: - account @@ -2085,7 +2148,7 @@ components: type: string description: The name of the account type: - $ref: "#/components/schemas/AccountType" + $ref: "#/components/schemas/SaveAccountType" balance: type: integer description: The current balance of the account in milliunits format @@ -2097,6 +2160,16 @@ components: additionalProperties: type: integer format: int64 + SaveAccountType: + type: string + description: The type of account to create or update + enum: + - checking + - savings + - cash + - creditCard + - otherAsset + - otherLiability AccountType: type: string description: The type of account @@ -2178,7 +2251,7 @@ components: type: boolean description: Whether or not the category group has been deleted. Deleted category groups will only be included in delta requests. - Category: + CategoryBase: required: - activity - balance @@ -2357,6 +2430,76 @@ components: type: boolean description: Whether or not the category has been deleted. Deleted categories will only be included in delta requests. + Category: + allOf: + - $ref: "#/components/schemas/CategoryBase" + - type: object + properties: + balance_formatted: + type: string + description: Available balance of the category formatted in the plan's currency format + balance_currency: + type: number + format: double + description: Available balance of the category as a decimal currency amount + activity_formatted: + type: string + description: Activity of the category formatted in the plan's currency format + activity_currency: + type: number + format: double + description: Activity of the category as a decimal currency amount + budgeted_formatted: + type: string + description: Assigned (budgeted) amount of the category formatted in the plan's currency format + budgeted_currency: + type: number + format: double + description: Assigned (budgeted) amount of the category as a decimal currency amount + goal_target_formatted: + type: + - string + - "null" + description: The goal target amount formatted in the plan's currency format + goal_target_currency: + type: + - number + - "null" + format: double + description: The goal target amount as a decimal currency amount + goal_under_funded_formatted: + type: + - string + - "null" + description: The goal underfunded amount formatted in the plan's currency format + goal_under_funded_currency: + type: + - number + - "null" + format: double + description: The goal underfunded amount as a decimal currency amount + goal_overall_funded_formatted: + type: + - string + - "null" + description: The total amount funded towards the goal formatted in the plan's currency format + goal_overall_funded_currency: + type: + - number + - "null" + format: double + description: The total amount funded towards the goal as a decimal currency amount + goal_overall_left_formatted: + type: + - string + - "null" + description: The amount of funding still needed to complete the goal formatted in the plan's currency format + goal_overall_left_currency: + type: + - number + - "null" + format: double + description: The amount of funding still needed to complete the goal as a decimal currency amount SaveCategoryResponse: required: - data @@ -2784,7 +2927,7 @@ components: type: integer description: The knowledge of the server format: int64 - TransactionSummary: + TransactionSummaryBase: required: - account_id - amount @@ -2894,6 +3037,19 @@ components: type: boolean description: Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. + TransactionSummary: + allOf: + - $ref: "#/components/schemas/TransactionSummaryBase" + - type: object + properties: + amount_formatted: + type: string + description: The transaction amount formatted in the plan's currency format + amount_currency: + type: number + format: double + description: The transaction amount as a decimal currency amount + TransactionDetail: allOf: - $ref: "#/components/schemas/TransactionSummary" @@ -2951,6 +3107,23 @@ components: type: string description: The name of the category. If a split transaction, this will be 'Split'. + PostPayeeWrapper: + required: + - payee + type: object + properties: + payee: + $ref: "#/components/schemas/PostPayee" + PostPayee: + required: + - name + type: object + properties: + name: + type: string + nullable: false + maxLength: 500 + description: The name of the payee. PatchPayeeWrapper: required: - payee @@ -2965,7 +3138,7 @@ components: type: string nullable: false maxLength: 500 - description: The name of the payee. The name must be a maximum of 500 characters. + description: The name of the payee. PostCategoryGroupWrapper: required: - category_group @@ -3023,9 +3196,9 @@ components: - integer - "null" description: The goal target amount in milliunits format. If value is specified - and goal has not already been configured for category, a monthly - 'Needed for Spending' goal will be created for the category with - this target amount. + and goal has not already been configured for category, a monthly goal + will be created for the category with this target amount. If goal_type is + not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories. format: int64 goal_target_date: type: @@ -3033,6 +3206,13 @@ components: - "null" description: The goal target date in ISO format (e.g. 2016-12-01). format: date + goal_needs_whole_amount: + type: + - boolean + - "null" + description: Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. + When true, the goal is configured as 'Set aside another...'. + When false, the goal is configured as 'Refill up to...'. ExistingCategory: allOf: - $ref: "#/components/schemas/SaveCategory" @@ -3112,7 +3292,7 @@ components: type: array items: $ref: "#/components/schemas/SaveTransactionWithOptionalFields" - SubTransaction: + SubTransactionBase: required: - amount - deleted @@ -3166,6 +3346,18 @@ components: type: boolean description: Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests. + SubTransaction: + allOf: + - $ref: "#/components/schemas/SubTransactionBase" + - type: object + properties: + amount_formatted: + type: string + description: The subtransaction amount formatted in the plan's currency format + amount_currency: + type: number + format: double + description: The subtransaction amount as a decimal currency amount ScheduledTransactionsResponse: required: - data @@ -3265,7 +3457,7 @@ components: $ref: "#/components/schemas/TransactionFlagColor" frequency: $ref: "#/components/schemas/ScheduledTransactionFrequency" - ScheduledTransactionSummary: + ScheduledTransactionSummaryBase: required: - account_id - amount @@ -3339,6 +3531,18 @@ components: type: boolean description: Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests. + ScheduledTransactionSummary: + allOf: + - $ref: "#/components/schemas/ScheduledTransactionSummaryBase" + - type: object + properties: + amount_formatted: + type: string + description: The scheduled transaction amount formatted in the plan's currency format + amount_currency: + type: number + format: double + description: The scheduled transaction amount as a decimal currency amount ScheduledTransactionDetail: allOf: - $ref: "#/components/schemas/ScheduledTransactionSummary" @@ -3364,7 +3568,7 @@ components: description: If a split scheduled transaction, the subtransactions. items: $ref: "#/components/schemas/ScheduledSubTransaction" - ScheduledSubTransaction: + ScheduledSubTransactionBase: required: - amount - deleted @@ -3416,6 +3620,18 @@ components: description: Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests. + ScheduledSubTransaction: + allOf: + - $ref: "#/components/schemas/ScheduledSubTransactionBase" + - type: object + properties: + amount_formatted: + type: string + description: The scheduled subtransaction amount formatted in the plan's currency format + amount_currency: + type: number + format: double + description: The scheduled subtransaction amount as a decimal currency amount MonthSummariesResponse: required: - data @@ -3447,7 +3663,7 @@ components: properties: month: $ref: "#/components/schemas/MonthDetail" - MonthSummary: + MonthSummaryBase: required: - activity - budgeted @@ -3492,6 +3708,52 @@ components: type: boolean description: Whether or not the month has been deleted. Deleted months will only be included in delta requests. + MonthSummary: + allOf: + - $ref: "#/components/schemas/MonthSummaryBase" + - type: object + properties: + income_formatted: + type: string + description: The total income formatted in the plan's currency format + income_currency: + type: number + format: double + description: The total income as a decimal currency amount + budgeted_formatted: + type: string + description: The total amount assigned formatted in the plan's currency format + budgeted_currency: + type: number + format: double + description: The total amount assigned as a decimal currency amount + activity_formatted: + type: string + description: The total activity amount formatted in the plan's currency format + activity_currency: + type: number + format: double + description: The total activity amount as a decimal currency amount + to_be_budgeted_formatted: + type: string + description: The available amount for 'Ready to Assign' formatted in the plan's currency format + to_be_budgeted_currency: + type: number + format: double + description: The available amount for 'Ready to Assign' as a decimal currency amount + MonthDetailBase: + allOf: + - $ref: "#/components/schemas/MonthSummaryBase" + - required: + - categories + type: object + properties: + categories: + type: array + description: The plan month categories. Amounts (budgeted, activity, balance, + etc.) are specific to the {month} parameter specified. + items: + $ref: "#/components/schemas/CategoryBase" MonthDetail: allOf: - $ref: "#/components/schemas/MonthSummary" @@ -3567,7 +3829,7 @@ components: type: integer description: The knowledge of the server format: int64 - MoneyMovement: + MoneyMovementBase: required: - id - amount @@ -3621,6 +3883,18 @@ components: type: integer description: The amount of the money movement in milliunits format format: int64 + MoneyMovement: + allOf: + - $ref: "#/components/schemas/MoneyMovementBase" + - type: object + properties: + amount_formatted: + type: string + description: The money movement amount formatted in the plan's currency format + amount_currency: + type: number + format: double + description: The money movement amount as a decimal currency amount MoneyMovementGroupsResponse: required: - data diff --git a/pyproject.toml b/pyproject.toml index 02e5523..8d1f2e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "ynab" version = "4.0.0" -description = "Official Python client for the YNAB API. API documentation available at https://api.ynab.com. Generated from server specification version 1.79.0" +description = "Official Python client for the YNAB API. API documentation available at https://api.ynab.com. Generated from server specification version 1.83.0" authors = ["YNAB"] license = "Apache-2.0" readme = "README.md" diff --git a/requirements.txt b/requirements.txt index 6cbb2b9..9e2d67a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ urllib3 >= 2.1.0, < 3.0.0 python_dateutil >= 2.8.2 -pydantic >= 2 +pydantic >= 2.11 typing-extensions >= 4.7.1 diff --git a/test/test_account_base.py b/test/test_account_base.py new file mode 100644 index 0000000..17c359b --- /dev/null +++ b/test/test_account_base.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.account_base import AccountBase + +class TestAccountBase(unittest.TestCase): + """AccountBase unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AccountBase: + """Test AccountBase + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `AccountBase` + """ + model = AccountBase() + if include_optional: + return AccountBase( + id = '', + name = '', + type = 'checking', + on_budget = True, + closed = True, + note = '', + balance = 56, + cleared_balance = 56, + uncleared_balance = 56, + transfer_payee_id = '', + direct_import_linked = True, + direct_import_in_error = True, + last_reconciled_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + debt_original_balance = 56, + debt_interest_rates = { + 'key' : 56 + }, + debt_minimum_payments = { + 'key' : 56 + }, + debt_escrow_amounts = { + 'key' : 56 + }, + deleted = True + ) + else: + return AccountBase( + id = '', + name = '', + type = 'checking', + on_budget = True, + closed = True, + balance = 56, + cleared_balance = 56, + uncleared_balance = 56, + transfer_payee_id = '', + deleted = True, + ) + """ + + def testAccountBase(self): + """Test AccountBase""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_category_base.py b/test/test_category_base.py new file mode 100644 index 0000000..148e685 --- /dev/null +++ b/test/test_category_base.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.category_base import CategoryBase + +class TestCategoryBase(unittest.TestCase): + """CategoryBase unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CategoryBase: + """Test CategoryBase + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `CategoryBase` + """ + model = CategoryBase() + if include_optional: + return CategoryBase( + id = '', + category_group_id = '', + category_group_name = '', + name = '', + hidden = True, + original_category_group_id = '', + note = '', + budgeted = 56, + activity = 56, + balance = 56, + goal_type = 'TB', + goal_needs_whole_amount = True, + goal_day = 56, + goal_cadence = 56, + goal_cadence_frequency = 56, + goal_creation_month = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + goal_target = 56, + goal_target_month = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + goal_target_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + goal_percentage_complete = 56, + goal_months_to_budget = 56, + goal_under_funded = 56, + goal_overall_funded = 56, + goal_overall_left = 56, + goal_snoozed_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + deleted = True + ) + else: + return CategoryBase( + id = '', + category_group_id = '', + name = '', + hidden = True, + budgeted = 56, + activity = 56, + balance = 56, + deleted = True, + ) + """ + + def testCategoryBase(self): + """Test CategoryBase""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_money_movement_base.py b/test/test_money_movement_base.py new file mode 100644 index 0000000..1d908f6 --- /dev/null +++ b/test/test_money_movement_base.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.money_movement_base import MoneyMovementBase + +class TestMoneyMovementBase(unittest.TestCase): + """MoneyMovementBase unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MoneyMovementBase: + """Test MoneyMovementBase + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `MoneyMovementBase` + """ + model = MoneyMovementBase() + if include_optional: + return MoneyMovementBase( + id = '', + month = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + moved_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + note = '', + money_movement_group_id = '', + performed_by_user_id = '', + from_category_id = '', + to_category_id = '', + amount = 56 + ) + else: + return MoneyMovementBase( + id = '', + amount = 56, + ) + """ + + def testMoneyMovementBase(self): + """Test MoneyMovementBase""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_month_detail_base.py b/test/test_month_detail_base.py new file mode 100644 index 0000000..11cc897 --- /dev/null +++ b/test/test_month_detail_base.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.month_detail_base import MonthDetailBase + +class TestMonthDetailBase(unittest.TestCase): + """MonthDetailBase unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MonthDetailBase: + """Test MonthDetailBase + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `MonthDetailBase` + """ + model = MonthDetailBase() + if include_optional: + return MonthDetailBase( + month = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + note = '', + income = 56, + budgeted = 56, + activity = 56, + to_be_budgeted = 56, + age_of_money = 56, + deleted = True, + categories = [ + ynab.models.category_base.CategoryBase( + id = '', + category_group_id = '', + category_group_name = '', + name = '', + hidden = True, + original_category_group_id = '', + note = '', + budgeted = 56, + activity = 56, + balance = 56, + goal_type = 'TB', + goal_needs_whole_amount = True, + goal_day = 56, + goal_cadence = 56, + goal_cadence_frequency = 56, + goal_creation_month = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + goal_target = 56, + goal_target_month = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + goal_target_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + goal_percentage_complete = 56, + goal_months_to_budget = 56, + goal_under_funded = 56, + goal_overall_funded = 56, + goal_overall_left = 56, + goal_snoozed_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + deleted = True, ) + ] + ) + else: + return MonthDetailBase( + month = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + income = 56, + budgeted = 56, + activity = 56, + to_be_budgeted = 56, + deleted = True, + categories = [ + ynab.models.category_base.CategoryBase( + id = '', + category_group_id = '', + category_group_name = '', + name = '', + hidden = True, + original_category_group_id = '', + note = '', + budgeted = 56, + activity = 56, + balance = 56, + goal_type = 'TB', + goal_needs_whole_amount = True, + goal_day = 56, + goal_cadence = 56, + goal_cadence_frequency = 56, + goal_creation_month = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + goal_target = 56, + goal_target_month = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + goal_target_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + goal_percentage_complete = 56, + goal_months_to_budget = 56, + goal_under_funded = 56, + goal_overall_funded = 56, + goal_overall_left = 56, + goal_snoozed_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + deleted = True, ) + ], + ) + """ + + def testMonthDetailBase(self): + """Test MonthDetailBase""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_month_summary_base.py b/test/test_month_summary_base.py new file mode 100644 index 0000000..e1c913c --- /dev/null +++ b/test/test_month_summary_base.py @@ -0,0 +1,64 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.month_summary_base import MonthSummaryBase + +class TestMonthSummaryBase(unittest.TestCase): + """MonthSummaryBase unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MonthSummaryBase: + """Test MonthSummaryBase + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `MonthSummaryBase` + """ + model = MonthSummaryBase() + if include_optional: + return MonthSummaryBase( + month = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + note = '', + income = 56, + budgeted = 56, + activity = 56, + to_be_budgeted = 56, + age_of_money = 56, + deleted = True + ) + else: + return MonthSummaryBase( + month = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + income = 56, + budgeted = 56, + activity = 56, + to_be_budgeted = 56, + deleted = True, + ) + """ + + def testMonthSummaryBase(self): + """Test MonthSummaryBase""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_post_payee.py b/test/test_post_payee.py new file mode 100644 index 0000000..dbcce4b --- /dev/null +++ b/test/test_post_payee.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.post_payee import PostPayee + +class TestPostPayee(unittest.TestCase): + """PostPayee unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PostPayee: + """Test PostPayee + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `PostPayee` + """ + model = PostPayee() + if include_optional: + return PostPayee( + name = '' + ) + else: + return PostPayee( + name = '', + ) + """ + + def testPostPayee(self): + """Test PostPayee""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_post_payee_wrapper.py b/test/test_post_payee_wrapper.py new file mode 100644 index 0000000..0890cdd --- /dev/null +++ b/test/test_post_payee_wrapper.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.post_payee_wrapper import PostPayeeWrapper + +class TestPostPayeeWrapper(unittest.TestCase): + """PostPayeeWrapper unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PostPayeeWrapper: + """Test PostPayeeWrapper + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `PostPayeeWrapper` + """ + model = PostPayeeWrapper() + if include_optional: + return PostPayeeWrapper( + payee = ynab.models.post_payee.PostPayee( + name = '', ) + ) + else: + return PostPayeeWrapper( + payee = ynab.models.post_payee.PostPayee( + name = '', ), + ) + """ + + def testPostPayeeWrapper(self): + """Test PostPayeeWrapper""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_save_account_type.py b/test/test_save_account_type.py new file mode 100644 index 0000000..80e6cd0 --- /dev/null +++ b/test/test_save_account_type.py @@ -0,0 +1,33 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.save_account_type import SaveAccountType + +class TestSaveAccountType(unittest.TestCase): + """SaveAccountType unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSaveAccountType(self): + """Test SaveAccountType""" + # inst = SaveAccountType() + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_scheduled_sub_transaction_base.py b/test/test_scheduled_sub_transaction_base.py new file mode 100644 index 0000000..4866448 --- /dev/null +++ b/test/test_scheduled_sub_transaction_base.py @@ -0,0 +1,64 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.scheduled_sub_transaction_base import ScheduledSubTransactionBase + +class TestScheduledSubTransactionBase(unittest.TestCase): + """ScheduledSubTransactionBase unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ScheduledSubTransactionBase: + """Test ScheduledSubTransactionBase + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `ScheduledSubTransactionBase` + """ + model = ScheduledSubTransactionBase() + if include_optional: + return ScheduledSubTransactionBase( + id = '', + scheduled_transaction_id = '', + amount = 56, + memo = '', + payee_id = '', + payee_name = '', + category_id = '', + category_name = '', + transfer_account_id = '', + deleted = True + ) + else: + return ScheduledSubTransactionBase( + id = '', + scheduled_transaction_id = '', + amount = 56, + deleted = True, + ) + """ + + def testScheduledSubTransactionBase(self): + """Test ScheduledSubTransactionBase""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_scheduled_transaction_summary_base.py b/test/test_scheduled_transaction_summary_base.py new file mode 100644 index 0000000..f0e386e --- /dev/null +++ b/test/test_scheduled_transaction_summary_base.py @@ -0,0 +1,70 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.scheduled_transaction_summary_base import ScheduledTransactionSummaryBase + +class TestScheduledTransactionSummaryBase(unittest.TestCase): + """ScheduledTransactionSummaryBase unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ScheduledTransactionSummaryBase: + """Test ScheduledTransactionSummaryBase + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `ScheduledTransactionSummaryBase` + """ + model = ScheduledTransactionSummaryBase() + if include_optional: + return ScheduledTransactionSummaryBase( + id = '', + date_first = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + date_next = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + frequency = 'never', + amount = 56, + memo = '', + flag_color = 'red', + flag_name = '', + account_id = '', + payee_id = '', + category_id = '', + transfer_account_id = '', + deleted = True + ) + else: + return ScheduledTransactionSummaryBase( + id = '', + date_first = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + date_next = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + frequency = 'never', + amount = 56, + account_id = '', + deleted = True, + ) + """ + + def testScheduledTransactionSummaryBase(self): + """Test ScheduledTransactionSummaryBase""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_sub_transaction_base.py b/test/test_sub_transaction_base.py new file mode 100644 index 0000000..cb231a0 --- /dev/null +++ b/test/test_sub_transaction_base.py @@ -0,0 +1,65 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.sub_transaction_base import SubTransactionBase + +class TestSubTransactionBase(unittest.TestCase): + """SubTransactionBase unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SubTransactionBase: + """Test SubTransactionBase + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `SubTransactionBase` + """ + model = SubTransactionBase() + if include_optional: + return SubTransactionBase( + id = '', + transaction_id = '', + amount = 56, + memo = '', + payee_id = '', + payee_name = '', + category_id = '', + category_name = '', + transfer_account_id = '', + transfer_transaction_id = '', + deleted = True + ) + else: + return SubTransactionBase( + id = '', + transaction_id = '', + amount = 56, + deleted = True, + ) + """ + + def testSubTransactionBase(self): + """Test SubTransactionBase""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_transaction_summary_base.py b/test/test_transaction_summary_base.py new file mode 100644 index 0000000..e4e622f --- /dev/null +++ b/test/test_transaction_summary_base.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from ynab.models.transaction_summary_base import TransactionSummaryBase + +class TestTransactionSummaryBase(unittest.TestCase): + """TransactionSummaryBase unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TransactionSummaryBase: + """Test TransactionSummaryBase + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `TransactionSummaryBase` + """ + model = TransactionSummaryBase() + if include_optional: + return TransactionSummaryBase( + id = '', + var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + amount = 56, + memo = '', + cleared = 'cleared', + approved = True, + flag_color = 'red', + flag_name = '', + account_id = '', + payee_id = '', + category_id = '', + transfer_account_id = '', + transfer_transaction_id = '', + matched_transaction_id = '', + import_id = '', + import_payee_name = '', + import_payee_name_original = '', + debt_transaction_type = 'payment', + deleted = True + ) + else: + return TransactionSummaryBase( + id = '', + var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + amount = 56, + cleared = 'cleared', + approved = True, + account_id = '', + deleted = True, + ) + """ + + def testTransactionSummaryBase(self): + """Test TransactionSummaryBase""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/ynab/__init__.py b/ynab/__init__.py index 45fb1af..af03f3b 100644 --- a/ynab/__init__.py +++ b/ynab/__init__.py @@ -7,14 +7,14 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. """ # noqa: E501 -__version__ = "2.1.0" +__version__ = "4.0.0" # Define package exports __all__ = [ @@ -38,6 +38,7 @@ "ApiAttributeError", "ApiException", "Account", + "AccountBase", "AccountResponse", "AccountResponseData", "AccountType", @@ -50,6 +51,7 @@ "CategoriesResponse", "CategoriesResponseData", "Category", + "CategoryBase", "CategoryGroup", "CategoryGroupWithCategories", "CategoryResponse", @@ -64,17 +66,20 @@ "HybridTransactionsResponse", "HybridTransactionsResponseData", "MoneyMovement", + "MoneyMovementBase", "MoneyMovementGroup", "MoneyMovementGroupsResponse", "MoneyMovementGroupsResponseData", "MoneyMovementsResponse", "MoneyMovementsResponseData", "MonthDetail", + "MonthDetailBase", "MonthDetailResponse", "MonthDetailResponseData", "MonthSummariesResponse", "MonthSummariesResponseData", "MonthSummary", + "MonthSummaryBase", "NewCategory", "NewTransaction", "PatchCategoryGroupWrapper", @@ -104,11 +109,14 @@ "PostAccountWrapper", "PostCategoryGroupWrapper", "PostCategoryWrapper", + "PostPayee", + "PostPayeeWrapper", "PostScheduledTransactionWrapper", "PostTransactionsWrapper", "PutScheduledTransactionWrapper", "PutTransactionWrapper", "SaveAccount", + "SaveAccountType", "SaveCategory", "SaveCategoryGroup", "SaveCategoryGroupResponse", @@ -126,20 +134,24 @@ "SaveTransactionsResponse", "SaveTransactionsResponseData", "ScheduledSubTransaction", + "ScheduledSubTransactionBase", "ScheduledTransactionDetail", "ScheduledTransactionFrequency", "ScheduledTransactionResponse", "ScheduledTransactionResponseData", "ScheduledTransactionSummary", + "ScheduledTransactionSummaryBase", "ScheduledTransactionsResponse", "ScheduledTransactionsResponseData", "SubTransaction", + "SubTransactionBase", "TransactionClearedStatus", "TransactionDetail", "TransactionFlagColor", "TransactionResponse", "TransactionResponseData", "TransactionSummary", + "TransactionSummaryBase", "TransactionsImportResponse", "TransactionsImportResponseData", "TransactionsResponse", @@ -174,6 +186,7 @@ # import models into sdk package from ynab.models.account import Account as Account +from ynab.models.account_base import AccountBase as AccountBase from ynab.models.account_response import AccountResponse as AccountResponse from ynab.models.account_response_data import AccountResponseData as AccountResponseData from ynab.models.account_type import AccountType as AccountType @@ -186,6 +199,7 @@ from ynab.models.categories_response import CategoriesResponse as CategoriesResponse from ynab.models.categories_response_data import CategoriesResponseData as CategoriesResponseData from ynab.models.category import Category as Category +from ynab.models.category_base import CategoryBase as CategoryBase from ynab.models.category_group import CategoryGroup as CategoryGroup from ynab.models.category_group_with_categories import CategoryGroupWithCategories as CategoryGroupWithCategories from ynab.models.category_response import CategoryResponse as CategoryResponse @@ -200,17 +214,20 @@ from ynab.models.hybrid_transactions_response import HybridTransactionsResponse as HybridTransactionsResponse from ynab.models.hybrid_transactions_response_data import HybridTransactionsResponseData as HybridTransactionsResponseData from ynab.models.money_movement import MoneyMovement as MoneyMovement +from ynab.models.money_movement_base import MoneyMovementBase as MoneyMovementBase from ynab.models.money_movement_group import MoneyMovementGroup as MoneyMovementGroup from ynab.models.money_movement_groups_response import MoneyMovementGroupsResponse as MoneyMovementGroupsResponse from ynab.models.money_movement_groups_response_data import MoneyMovementGroupsResponseData as MoneyMovementGroupsResponseData from ynab.models.money_movements_response import MoneyMovementsResponse as MoneyMovementsResponse from ynab.models.money_movements_response_data import MoneyMovementsResponseData as MoneyMovementsResponseData from ynab.models.month_detail import MonthDetail as MonthDetail +from ynab.models.month_detail_base import MonthDetailBase as MonthDetailBase from ynab.models.month_detail_response import MonthDetailResponse as MonthDetailResponse from ynab.models.month_detail_response_data import MonthDetailResponseData as MonthDetailResponseData from ynab.models.month_summaries_response import MonthSummariesResponse as MonthSummariesResponse from ynab.models.month_summaries_response_data import MonthSummariesResponseData as MonthSummariesResponseData from ynab.models.month_summary import MonthSummary as MonthSummary +from ynab.models.month_summary_base import MonthSummaryBase as MonthSummaryBase from ynab.models.new_category import NewCategory as NewCategory from ynab.models.new_transaction import NewTransaction as NewTransaction from ynab.models.patch_category_group_wrapper import PatchCategoryGroupWrapper as PatchCategoryGroupWrapper @@ -240,11 +257,14 @@ from ynab.models.post_account_wrapper import PostAccountWrapper as PostAccountWrapper from ynab.models.post_category_group_wrapper import PostCategoryGroupWrapper as PostCategoryGroupWrapper from ynab.models.post_category_wrapper import PostCategoryWrapper as PostCategoryWrapper +from ynab.models.post_payee import PostPayee as PostPayee +from ynab.models.post_payee_wrapper import PostPayeeWrapper as PostPayeeWrapper from ynab.models.post_scheduled_transaction_wrapper import PostScheduledTransactionWrapper as PostScheduledTransactionWrapper from ynab.models.post_transactions_wrapper import PostTransactionsWrapper as PostTransactionsWrapper from ynab.models.put_scheduled_transaction_wrapper import PutScheduledTransactionWrapper as PutScheduledTransactionWrapper from ynab.models.put_transaction_wrapper import PutTransactionWrapper as PutTransactionWrapper from ynab.models.save_account import SaveAccount as SaveAccount +from ynab.models.save_account_type import SaveAccountType as SaveAccountType from ynab.models.save_category import SaveCategory as SaveCategory from ynab.models.save_category_group import SaveCategoryGroup as SaveCategoryGroup from ynab.models.save_category_group_response import SaveCategoryGroupResponse as SaveCategoryGroupResponse @@ -262,20 +282,24 @@ from ynab.models.save_transactions_response import SaveTransactionsResponse as SaveTransactionsResponse from ynab.models.save_transactions_response_data import SaveTransactionsResponseData as SaveTransactionsResponseData from ynab.models.scheduled_sub_transaction import ScheduledSubTransaction as ScheduledSubTransaction +from ynab.models.scheduled_sub_transaction_base import ScheduledSubTransactionBase as ScheduledSubTransactionBase from ynab.models.scheduled_transaction_detail import ScheduledTransactionDetail as ScheduledTransactionDetail from ynab.models.scheduled_transaction_frequency import ScheduledTransactionFrequency as ScheduledTransactionFrequency from ynab.models.scheduled_transaction_response import ScheduledTransactionResponse as ScheduledTransactionResponse from ynab.models.scheduled_transaction_response_data import ScheduledTransactionResponseData as ScheduledTransactionResponseData from ynab.models.scheduled_transaction_summary import ScheduledTransactionSummary as ScheduledTransactionSummary +from ynab.models.scheduled_transaction_summary_base import ScheduledTransactionSummaryBase as ScheduledTransactionSummaryBase from ynab.models.scheduled_transactions_response import ScheduledTransactionsResponse as ScheduledTransactionsResponse from ynab.models.scheduled_transactions_response_data import ScheduledTransactionsResponseData as ScheduledTransactionsResponseData from ynab.models.sub_transaction import SubTransaction as SubTransaction +from ynab.models.sub_transaction_base import SubTransactionBase as SubTransactionBase from ynab.models.transaction_cleared_status import TransactionClearedStatus as TransactionClearedStatus from ynab.models.transaction_detail import TransactionDetail as TransactionDetail from ynab.models.transaction_flag_color import TransactionFlagColor as TransactionFlagColor from ynab.models.transaction_response import TransactionResponse as TransactionResponse from ynab.models.transaction_response_data import TransactionResponseData as TransactionResponseData from ynab.models.transaction_summary import TransactionSummary as TransactionSummary +from ynab.models.transaction_summary_base import TransactionSummaryBase as TransactionSummaryBase from ynab.models.transactions_import_response import TransactionsImportResponse as TransactionsImportResponse from ynab.models.transactions_import_response_data import TransactionsImportResponseData as TransactionsImportResponseData from ynab.models.transactions_response import TransactionsResponse as TransactionsResponse diff --git a/ynab/api/accounts_api.py b/ynab/api/accounts_api.py index dee5ec2..a16ba40 100644 --- a/ynab/api/accounts_api.py +++ b/ynab/api/accounts_api.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/api/categories_api.py b/ynab/api/categories_api.py index b34eb02..55e50d8 100644 --- a/ynab/api/categories_api.py +++ b/ynab/api/categories_api.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/api/money_movements_api.py b/ynab/api/money_movements_api.py index d13d0d4..4c70671 100644 --- a/ynab/api/money_movements_api.py +++ b/ynab/api/money_movements_api.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/api/months_api.py b/ynab/api/months_api.py index f9cdf0c..fe888a2 100644 --- a/ynab/api/months_api.py +++ b/ynab/api/months_api.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/api/payee_locations_api.py b/ynab/api/payee_locations_api.py index 3b6e454..19e3d95 100644 --- a/ynab/api/payee_locations_api.py +++ b/ynab/api/payee_locations_api.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/api/payees_api.py b/ynab/api/payees_api.py index 3980856..a73eac0 100644 --- a/ynab/api/payees_api.py +++ b/ynab/api/payees_api.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -21,6 +21,7 @@ from ynab.models.patch_payee_wrapper import PatchPayeeWrapper from ynab.models.payee_response import PayeeResponse from ynab.models.payees_response import PayeesResponse +from ynab.models.post_payee_wrapper import PostPayeeWrapper from ynab.models.save_payee_response import SavePayeeResponse from ynab.api_client import ApiClient, RequestSerialized @@ -41,6 +42,298 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call + def create_payee( + self, + plan_id: Annotated[StrictStr, Field(description="The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).")], + data: Annotated[PostPayeeWrapper, Field(description="The payee to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SavePayeeResponse: + """Create a payee + + Creates a new payee + + :param plan_id: The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (required) + :type plan_id: str + :param data: The payee to create (required) + :type data: PostPayeeWrapper + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_payee_serialize( + plan_id=plan_id, + data=data, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "SavePayeeResponse", + '400': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_payee_with_http_info( + self, + plan_id: Annotated[StrictStr, Field(description="The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).")], + data: Annotated[PostPayeeWrapper, Field(description="The payee to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SavePayeeResponse]: + """Create a payee + + Creates a new payee + + :param plan_id: The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (required) + :type plan_id: str + :param data: The payee to create (required) + :type data: PostPayeeWrapper + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_payee_serialize( + plan_id=plan_id, + data=data, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "SavePayeeResponse", + '400': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_payee_without_preload_content( + self, + plan_id: Annotated[StrictStr, Field(description="The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan).")], + data: Annotated[PostPayeeWrapper, Field(description="The payee to create")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create a payee + + Creates a new payee + + :param plan_id: The id of the plan. \"last-used\" can be used to specify the last used plan and \"default\" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (required) + :type plan_id: str + :param data: The payee to create (required) + :type data: PostPayeeWrapper + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_payee_serialize( + plan_id=plan_id, + data=data, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "SavePayeeResponse", + '400': "ErrorResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_payee_serialize( + self, + plan_id, + data, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if plan_id is not None: + _path_params['plan_id'] = plan_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if data is not None: + _body_params = data + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'bearer' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/plans/{plan_id}/payees', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def get_payee_by_id( self, diff --git a/ynab/api/plans_api.py b/ynab/api/plans_api.py index cc40465..c5bbf83 100644 --- a/ynab/api/plans_api.py +++ b/ynab/api/plans_api.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/api/scheduled_transactions_api.py b/ynab/api/scheduled_transactions_api.py index c5b65fa..9587451 100644 --- a/ynab/api/scheduled_transactions_api.py +++ b/ynab/api/scheduled_transactions_api.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/api/transactions_api.py b/ynab/api/transactions_api.py index e448574..9f2ea3d 100644 --- a/ynab/api/transactions_api.py +++ b/ynab/api/transactions_api.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/api/user_api.py b/ynab/api/user_api.py index c57f03f..9ae6f59 100644 --- a/ynab/api/user_api.py +++ b/ynab/api/user_api.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/api_client.py b/ynab/api_client.py index e4b3fd9..755afd5 100644 --- a/ynab/api_client.py +++ b/ynab/api_client.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -68,6 +68,7 @@ class ApiClient: 'date': datetime.date, 'datetime': datetime.datetime, 'decimal': decimal.Decimal, + 'UUID': uuid.UUID, 'object': object, } _pool = None @@ -90,7 +91,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/2.1.0/python' + self.user_agent = 'OpenAPI-Generator/4.0.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): @@ -305,7 +306,7 @@ def response_deserialize( response_text = None return_data = None try: - if response_type == "bytearray": + if response_type in ("bytearray", "bytes"): return_data = response_data.data elif response_type == "file": return_data = self.__deserialize_file(response_data) @@ -467,6 +468,8 @@ def __deserialize(self, data, klass): return self.__deserialize_datetime(data) elif klass is decimal.Decimal: return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) else: diff --git a/ynab/configuration.py b/ynab/configuration.py index e8221e9..b8ab8c2 100644 --- a/ynab/configuration.py +++ b/ynab/configuration.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -504,8 +504,8 @@ def to_debug_report(self) -> str: return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: 1.79.0\n"\ - "SDK Package Version: 2.1.0".\ + "Version of the API: 1.83.0\n"\ + "SDK Package Version: 4.0.0".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self) -> List[HostSetting]: diff --git a/ynab/exceptions.py b/ynab/exceptions.py index 36476f4..2e88a0e 100644 --- a/ynab/exceptions.py +++ b/ynab/exceptions.py @@ -3,7 +3,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/models/__init__.py b/ynab/models/__init__.py index 3fc5ddf..3046342 100644 --- a/ynab/models/__init__.py +++ b/ynab/models/__init__.py @@ -6,7 +6,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -14,6 +14,7 @@ # import models into model package from ynab.models.account import Account +from ynab.models.account_base import AccountBase from ynab.models.account_response import AccountResponse from ynab.models.account_response_data import AccountResponseData from ynab.models.account_type import AccountType @@ -26,6 +27,7 @@ from ynab.models.categories_response import CategoriesResponse from ynab.models.categories_response_data import CategoriesResponseData from ynab.models.category import Category +from ynab.models.category_base import CategoryBase from ynab.models.category_group import CategoryGroup from ynab.models.category_group_with_categories import CategoryGroupWithCategories from ynab.models.category_response import CategoryResponse @@ -40,17 +42,20 @@ from ynab.models.hybrid_transactions_response import HybridTransactionsResponse from ynab.models.hybrid_transactions_response_data import HybridTransactionsResponseData from ynab.models.money_movement import MoneyMovement +from ynab.models.money_movement_base import MoneyMovementBase from ynab.models.money_movement_group import MoneyMovementGroup from ynab.models.money_movement_groups_response import MoneyMovementGroupsResponse from ynab.models.money_movement_groups_response_data import MoneyMovementGroupsResponseData from ynab.models.money_movements_response import MoneyMovementsResponse from ynab.models.money_movements_response_data import MoneyMovementsResponseData from ynab.models.month_detail import MonthDetail +from ynab.models.month_detail_base import MonthDetailBase from ynab.models.month_detail_response import MonthDetailResponse from ynab.models.month_detail_response_data import MonthDetailResponseData from ynab.models.month_summaries_response import MonthSummariesResponse from ynab.models.month_summaries_response_data import MonthSummariesResponseData from ynab.models.month_summary import MonthSummary +from ynab.models.month_summary_base import MonthSummaryBase from ynab.models.new_category import NewCategory from ynab.models.new_transaction import NewTransaction from ynab.models.patch_category_group_wrapper import PatchCategoryGroupWrapper @@ -80,11 +85,14 @@ from ynab.models.post_account_wrapper import PostAccountWrapper from ynab.models.post_category_group_wrapper import PostCategoryGroupWrapper from ynab.models.post_category_wrapper import PostCategoryWrapper +from ynab.models.post_payee import PostPayee +from ynab.models.post_payee_wrapper import PostPayeeWrapper from ynab.models.post_scheduled_transaction_wrapper import PostScheduledTransactionWrapper from ynab.models.post_transactions_wrapper import PostTransactionsWrapper from ynab.models.put_scheduled_transaction_wrapper import PutScheduledTransactionWrapper from ynab.models.put_transaction_wrapper import PutTransactionWrapper from ynab.models.save_account import SaveAccount +from ynab.models.save_account_type import SaveAccountType from ynab.models.save_category import SaveCategory from ynab.models.save_category_group import SaveCategoryGroup from ynab.models.save_category_group_response import SaveCategoryGroupResponse @@ -102,20 +110,24 @@ from ynab.models.save_transactions_response import SaveTransactionsResponse from ynab.models.save_transactions_response_data import SaveTransactionsResponseData from ynab.models.scheduled_sub_transaction import ScheduledSubTransaction +from ynab.models.scheduled_sub_transaction_base import ScheduledSubTransactionBase from ynab.models.scheduled_transaction_detail import ScheduledTransactionDetail from ynab.models.scheduled_transaction_frequency import ScheduledTransactionFrequency from ynab.models.scheduled_transaction_response import ScheduledTransactionResponse from ynab.models.scheduled_transaction_response_data import ScheduledTransactionResponseData from ynab.models.scheduled_transaction_summary import ScheduledTransactionSummary +from ynab.models.scheduled_transaction_summary_base import ScheduledTransactionSummaryBase from ynab.models.scheduled_transactions_response import ScheduledTransactionsResponse from ynab.models.scheduled_transactions_response_data import ScheduledTransactionsResponseData from ynab.models.sub_transaction import SubTransaction +from ynab.models.sub_transaction_base import SubTransactionBase from ynab.models.transaction_cleared_status import TransactionClearedStatus from ynab.models.transaction_detail import TransactionDetail from ynab.models.transaction_flag_color import TransactionFlagColor from ynab.models.transaction_response import TransactionResponse from ynab.models.transaction_response_data import TransactionResponseData from ynab.models.transaction_summary import TransactionSummary +from ynab.models.transaction_summary_base import TransactionSummaryBase from ynab.models.transactions_import_response import TransactionsImportResponse from ynab.models.transactions_import_response_data import TransactionsImportResponseData from ynab.models.transactions_response import TransactionsResponse diff --git a/ynab/models/account.py b/ynab/models/account.py index 7f1da12..a6639ad 100644 --- a/ynab/models/account.py +++ b/ynab/models/account.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,12 +18,13 @@ import json from datetime import datetime -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from uuid import UUID from ynab.models.account_type import AccountType from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Account(BaseModel): """ @@ -38,7 +39,7 @@ class Account(BaseModel): balance: StrictInt = Field(description="The current available balance of the account in milliunits format") cleared_balance: StrictInt = Field(description="The current cleared balance of the account in milliunits format") uncleared_balance: StrictInt = Field(description="The current uncleared balance of the account in milliunits format") - transfer_payee_id: Optional[UUID] = Field(description="The payee id which should be used when transferring to this account") + transfer_payee_id: UUID = Field(description="The payee id which should be used when transferring to this account") direct_import_linked: Optional[StrictBool] = Field(default=None, description="Whether or not the account is linked to a financial institution for automatic transaction import.") direct_import_in_error: Optional[StrictBool] = Field(default=None, description="If an account linked to a financial institution (direct_import_linked=true) and the linked connection is not in a healthy state, this will be true.") last_reconciled_at: Optional[datetime] = Field(default=None, description="A date/time specifying when the account was last reconciled.") @@ -47,10 +48,17 @@ class Account(BaseModel): debt_minimum_payments: Optional[Dict[str, StrictInt]] = None debt_escrow_amounts: Optional[Dict[str, StrictInt]] = None deleted: StrictBool = Field(description="Whether or not the account has been deleted. Deleted accounts will only be included in delta requests.") - __properties: ClassVar[List[str]] = ["id", "name", "type", "on_budget", "closed", "note", "balance", "cleared_balance", "uncleared_balance", "transfer_payee_id", "direct_import_linked", "direct_import_in_error", "last_reconciled_at", "debt_original_balance", "debt_interest_rates", "debt_minimum_payments", "debt_escrow_amounts", "deleted"] + balance_formatted: Optional[StrictStr] = Field(default=None, description="The current available balance of the account formatted in the plan's currency format") + balance_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The current available balance of the account as a decimal currency amount") + cleared_balance_formatted: Optional[StrictStr] = Field(default=None, description="The current cleared balance of the account formatted in the plan's currency format") + cleared_balance_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The current cleared balance of the account as a decimal currency amount") + uncleared_balance_formatted: Optional[StrictStr] = Field(default=None, description="The current uncleared balance of the account formatted in the plan's currency format") + uncleared_balance_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The current uncleared balance of the account as a decimal currency amount") + __properties: ClassVar[List[str]] = ["id", "name", "type", "on_budget", "closed", "note", "balance", "cleared_balance", "uncleared_balance", "transfer_payee_id", "direct_import_linked", "direct_import_in_error", "last_reconciled_at", "debt_original_balance", "debt_interest_rates", "debt_minimum_payments", "debt_escrow_amounts", "deleted", "balance_formatted", "balance_currency", "cleared_balance_formatted", "cleared_balance_currency", "uncleared_balance_formatted", "uncleared_balance_currency"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -62,8 +70,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,26 +95,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if note (nullable) is None - # and model_fields_set contains the field - if self.note is None and "note" in self.model_fields_set: - _dict['note'] = None - - # set to None if transfer_payee_id (nullable) is None - # and model_fields_set contains the field - if self.transfer_payee_id is None and "transfer_payee_id" in self.model_fields_set: - _dict['transfer_payee_id'] = None - - # set to None if last_reconciled_at (nullable) is None - # and model_fields_set contains the field - if self.last_reconciled_at is None and "last_reconciled_at" in self.model_fields_set: - _dict['last_reconciled_at'] = None - - # set to None if debt_original_balance (nullable) is None - # and model_fields_set contains the field - if self.debt_original_balance is None and "debt_original_balance" in self.model_fields_set: - _dict['debt_original_balance'] = None - return _dict @classmethod @@ -137,7 +124,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "debt_interest_rates": obj.get("debt_interest_rates"), "debt_minimum_payments": obj.get("debt_minimum_payments"), "debt_escrow_amounts": obj.get("debt_escrow_amounts"), - "deleted": obj.get("deleted") + "deleted": obj.get("deleted"), + "balance_formatted": obj.get("balance_formatted"), + "balance_currency": obj.get("balance_currency"), + "cleared_balance_formatted": obj.get("cleared_balance_formatted"), + "cleared_balance_currency": obj.get("cleared_balance_currency"), + "uncleared_balance_formatted": obj.get("uncleared_balance_formatted"), + "uncleared_balance_currency": obj.get("uncleared_balance_currency") }) return _obj diff --git a/ynab/models/account_base.py b/ynab/models/account_base.py new file mode 100644 index 0000000..00b8a8c --- /dev/null +++ b/ynab/models/account_base.py @@ -0,0 +1,145 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from ynab.models.account_type import AccountType +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class AccountBase(BaseModel): + """ + AccountBase + """ # noqa: E501 + id: UUID + name: StrictStr + type: AccountType + on_budget: StrictBool = Field(description="Whether this account is \"on budget\" or not") + closed: StrictBool = Field(description="Whether this account is closed or not") + note: Optional[StrictStr] = None + balance: StrictInt = Field(description="The current available balance of the account in milliunits format") + cleared_balance: StrictInt = Field(description="The current cleared balance of the account in milliunits format") + uncleared_balance: StrictInt = Field(description="The current uncleared balance of the account in milliunits format") + transfer_payee_id: Optional[UUID] = Field(description="The payee id which should be used when transferring to this account") + direct_import_linked: Optional[StrictBool] = Field(default=None, description="Whether or not the account is linked to a financial institution for automatic transaction import.") + direct_import_in_error: Optional[StrictBool] = Field(default=None, description="If an account linked to a financial institution (direct_import_linked=true) and the linked connection is not in a healthy state, this will be true.") + last_reconciled_at: Optional[datetime] = Field(default=None, description="A date/time specifying when the account was last reconciled.") + debt_original_balance: Optional[StrictInt] = Field(default=None, description="This field is deprecated and will always be null.") + debt_interest_rates: Optional[Dict[str, StrictInt]] = None + debt_minimum_payments: Optional[Dict[str, StrictInt]] = None + debt_escrow_amounts: Optional[Dict[str, StrictInt]] = None + deleted: StrictBool = Field(description="Whether or not the account has been deleted. Deleted accounts will only be included in delta requests.") + __properties: ClassVar[List[str]] = ["id", "name", "type", "on_budget", "closed", "note", "balance", "cleared_balance", "uncleared_balance", "transfer_payee_id", "direct_import_linked", "direct_import_in_error", "last_reconciled_at", "debt_original_balance", "debt_interest_rates", "debt_minimum_payments", "debt_escrow_amounts", "deleted"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if note (nullable) is None + # and model_fields_set contains the field + if self.note is None and "note" in self.model_fields_set: + _dict['note'] = None + + # set to None if transfer_payee_id (nullable) is None + # and model_fields_set contains the field + if self.transfer_payee_id is None and "transfer_payee_id" in self.model_fields_set: + _dict['transfer_payee_id'] = None + + # set to None if last_reconciled_at (nullable) is None + # and model_fields_set contains the field + if self.last_reconciled_at is None and "last_reconciled_at" in self.model_fields_set: + _dict['last_reconciled_at'] = None + + # set to None if debt_original_balance (nullable) is None + # and model_fields_set contains the field + if self.debt_original_balance is None and "debt_original_balance" in self.model_fields_set: + _dict['debt_original_balance'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "name": obj.get("name"), + "type": obj.get("type"), + "on_budget": obj.get("on_budget"), + "closed": obj.get("closed"), + "note": obj.get("note"), + "balance": obj.get("balance"), + "cleared_balance": obj.get("cleared_balance"), + "uncleared_balance": obj.get("uncleared_balance"), + "transfer_payee_id": obj.get("transfer_payee_id"), + "direct_import_linked": obj.get("direct_import_linked"), + "direct_import_in_error": obj.get("direct_import_in_error"), + "last_reconciled_at": obj.get("last_reconciled_at"), + "debt_original_balance": obj.get("debt_original_balance"), + "debt_interest_rates": obj.get("debt_interest_rates"), + "debt_minimum_payments": obj.get("debt_minimum_payments"), + "debt_escrow_amounts": obj.get("debt_escrow_amounts"), + "deleted": obj.get("deleted") + }) + return _obj + + diff --git a/ynab/models/account_response.py b/ynab/models/account_response.py index 6e78081..a5d4377 100644 --- a/ynab/models/account_response.py +++ b/ynab/models/account_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.account_response_data import AccountResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountResponse(BaseModel): """ @@ -31,7 +32,8 @@ class AccountResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/account_response_data.py b/ynab/models/account_response_data.py index b06ca21..7a22ddc 100644 --- a/ynab/models/account_response_data.py +++ b/ynab/models/account_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.account import Account from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountResponseData(BaseModel): """ @@ -31,7 +32,8 @@ class AccountResponseData(BaseModel): __properties: ClassVar[List[str]] = ["account"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/account_type.py b/ynab/models/account_type.py index 6951a40..172f863 100644 --- a/ynab/models/account_type.py +++ b/ynab/models/account_type.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/models/accounts_response.py b/ynab/models/accounts_response.py index 84e8090..95f03c3 100644 --- a/ynab/models/accounts_response.py +++ b/ynab/models/accounts_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.accounts_response_data import AccountsResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountsResponse(BaseModel): """ @@ -31,7 +32,8 @@ class AccountsResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/accounts_response_data.py b/ynab/models/accounts_response_data.py index e29e815..23fbd59 100644 --- a/ynab/models/accounts_response_data.py +++ b/ynab/models/accounts_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.account import Account from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountsResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class AccountsResponseData(BaseModel): __properties: ClassVar[List[str]] = ["accounts", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/bulk_response.py b/ynab/models/bulk_response.py index d80af92..5bd8c7c 100644 --- a/ynab/models/bulk_response.py +++ b/ynab/models/bulk_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.bulk_response_data import BulkResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class BulkResponse(BaseModel): """ @@ -31,7 +32,8 @@ class BulkResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/bulk_response_data.py b/ynab/models/bulk_response_data.py index c477ea4..34b75cc 100644 --- a/ynab/models/bulk_response_data.py +++ b/ynab/models/bulk_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.bulk_response_data_bulk import BulkResponseDataBulk from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class BulkResponseData(BaseModel): """ @@ -31,7 +32,8 @@ class BulkResponseData(BaseModel): __properties: ClassVar[List[str]] = ["bulk"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/bulk_response_data_bulk.py b/ynab/models/bulk_response_data_bulk.py index d16aab0..66a6163 100644 --- a/ynab/models/bulk_response_data_bulk.py +++ b/ynab/models/bulk_response_data_bulk.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class BulkResponseDataBulk(BaseModel): """ @@ -31,7 +32,8 @@ class BulkResponseDataBulk(BaseModel): __properties: ClassVar[List[str]] = ["transaction_ids", "duplicate_import_ids"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/bulk_transactions.py b/ynab/models/bulk_transactions.py index 9085b91..26cac35 100644 --- a/ynab/models/bulk_transactions.py +++ b/ynab/models/bulk_transactions.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_transaction_with_optional_fields import SaveTransactionWithOptionalFields from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class BulkTransactions(BaseModel): """ @@ -31,7 +32,8 @@ class BulkTransactions(BaseModel): __properties: ClassVar[List[str]] = ["transactions"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/categories_response.py b/ynab/models/categories_response.py index d98813b..f3cf430 100644 --- a/ynab/models/categories_response.py +++ b/ynab/models/categories_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.categories_response_data import CategoriesResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CategoriesResponse(BaseModel): """ @@ -31,7 +32,8 @@ class CategoriesResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/categories_response_data.py b/ynab/models/categories_response_data.py index f5591a3..3072436 100644 --- a/ynab/models/categories_response_data.py +++ b/ynab/models/categories_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.category_group_with_categories import CategoryGroupWithCategories from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CategoriesResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class CategoriesResponseData(BaseModel): __properties: ClassVar[List[str]] = ["category_groups", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/category.py b/ynab/models/category.py index 14acc01..f95d36d 100644 --- a/ynab/models/category.py +++ b/ynab/models/category.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,11 +18,12 @@ import json from datetime import date, datetime -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Category(BaseModel): """ @@ -54,7 +55,21 @@ class Category(BaseModel): goal_overall_left: Optional[StrictInt] = Field(default=None, description="The amount of funding still needed to complete the goal within the current goal period.") goal_snoozed_at: Optional[datetime] = Field(default=None, description="The date/time the goal was snoozed. If the goal is not snoozed, this will be null.") deleted: StrictBool = Field(description="Whether or not the category has been deleted. Deleted categories will only be included in delta requests.") - __properties: ClassVar[List[str]] = ["id", "category_group_id", "category_group_name", "name", "hidden", "original_category_group_id", "note", "budgeted", "activity", "balance", "goal_type", "goal_needs_whole_amount", "goal_day", "goal_cadence", "goal_cadence_frequency", "goal_creation_month", "goal_target", "goal_target_month", "goal_target_date", "goal_percentage_complete", "goal_months_to_budget", "goal_under_funded", "goal_overall_funded", "goal_overall_left", "goal_snoozed_at", "deleted"] + balance_formatted: Optional[StrictStr] = Field(default=None, description="Available balance of the category formatted in the plan's currency format") + balance_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Available balance of the category as a decimal currency amount") + activity_formatted: Optional[StrictStr] = Field(default=None, description="Activity of the category formatted in the plan's currency format") + activity_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Activity of the category as a decimal currency amount") + budgeted_formatted: Optional[StrictStr] = Field(default=None, description="Assigned (budgeted) amount of the category formatted in the plan's currency format") + budgeted_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Assigned (budgeted) amount of the category as a decimal currency amount") + goal_target_formatted: Optional[StrictStr] = Field(default=None, description="The goal target amount formatted in the plan's currency format") + goal_target_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The goal target amount as a decimal currency amount") + goal_under_funded_formatted: Optional[StrictStr] = Field(default=None, description="The goal underfunded amount formatted in the plan's currency format") + goal_under_funded_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The goal underfunded amount as a decimal currency amount") + goal_overall_funded_formatted: Optional[StrictStr] = Field(default=None, description="The total amount funded towards the goal formatted in the plan's currency format") + goal_overall_funded_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total amount funded towards the goal as a decimal currency amount") + goal_overall_left_formatted: Optional[StrictStr] = Field(default=None, description="The amount of funding still needed to complete the goal formatted in the plan's currency format") + goal_overall_left_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The amount of funding still needed to complete the goal as a decimal currency amount") + __properties: ClassVar[List[str]] = ["id", "category_group_id", "category_group_name", "name", "hidden", "original_category_group_id", "note", "budgeted", "activity", "balance", "goal_type", "goal_needs_whole_amount", "goal_day", "goal_cadence", "goal_cadence_frequency", "goal_creation_month", "goal_target", "goal_target_month", "goal_target_date", "goal_percentage_complete", "goal_months_to_budget", "goal_under_funded", "goal_overall_funded", "goal_overall_left", "goal_snoozed_at", "deleted", "balance_formatted", "balance_currency", "activity_formatted", "activity_currency", "budgeted_formatted", "budgeted_currency", "goal_target_formatted", "goal_target_currency", "goal_under_funded_formatted", "goal_under_funded_currency", "goal_overall_funded_formatted", "goal_overall_funded_currency", "goal_overall_left_formatted", "goal_overall_left_currency"] @field_validator('goal_type') def goal_type_validate_enum(cls, value): @@ -67,7 +82,8 @@ def goal_type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -79,8 +95,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -105,90 +120,50 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if original_category_group_id (nullable) is None - # and model_fields_set contains the field - if self.original_category_group_id is None and "original_category_group_id" in self.model_fields_set: - _dict['original_category_group_id'] = None - - # set to None if note (nullable) is None - # and model_fields_set contains the field - if self.note is None and "note" in self.model_fields_set: - _dict['note'] = None - # set to None if goal_type (nullable) is None # and model_fields_set contains the field if self.goal_type is None and "goal_type" in self.model_fields_set: _dict['goal_type'] = None - # set to None if goal_needs_whole_amount (nullable) is None - # and model_fields_set contains the field - if self.goal_needs_whole_amount is None and "goal_needs_whole_amount" in self.model_fields_set: - _dict['goal_needs_whole_amount'] = None - - # set to None if goal_day (nullable) is None - # and model_fields_set contains the field - if self.goal_day is None and "goal_day" in self.model_fields_set: - _dict['goal_day'] = None - - # set to None if goal_cadence (nullable) is None - # and model_fields_set contains the field - if self.goal_cadence is None and "goal_cadence" in self.model_fields_set: - _dict['goal_cadence'] = None - - # set to None if goal_cadence_frequency (nullable) is None - # and model_fields_set contains the field - if self.goal_cadence_frequency is None and "goal_cadence_frequency" in self.model_fields_set: - _dict['goal_cadence_frequency'] = None - - # set to None if goal_creation_month (nullable) is None - # and model_fields_set contains the field - if self.goal_creation_month is None and "goal_creation_month" in self.model_fields_set: - _dict['goal_creation_month'] = None - - # set to None if goal_target (nullable) is None - # and model_fields_set contains the field - if self.goal_target is None and "goal_target" in self.model_fields_set: - _dict['goal_target'] = None - - # set to None if goal_target_month (nullable) is None + # set to None if goal_target_formatted (nullable) is None # and model_fields_set contains the field - if self.goal_target_month is None and "goal_target_month" in self.model_fields_set: - _dict['goal_target_month'] = None + if self.goal_target_formatted is None and "goal_target_formatted" in self.model_fields_set: + _dict['goal_target_formatted'] = None - # set to None if goal_target_date (nullable) is None + # set to None if goal_target_currency (nullable) is None # and model_fields_set contains the field - if self.goal_target_date is None and "goal_target_date" in self.model_fields_set: - _dict['goal_target_date'] = None + if self.goal_target_currency is None and "goal_target_currency" in self.model_fields_set: + _dict['goal_target_currency'] = None - # set to None if goal_percentage_complete (nullable) is None + # set to None if goal_under_funded_formatted (nullable) is None # and model_fields_set contains the field - if self.goal_percentage_complete is None and "goal_percentage_complete" in self.model_fields_set: - _dict['goal_percentage_complete'] = None + if self.goal_under_funded_formatted is None and "goal_under_funded_formatted" in self.model_fields_set: + _dict['goal_under_funded_formatted'] = None - # set to None if goal_months_to_budget (nullable) is None + # set to None if goal_under_funded_currency (nullable) is None # and model_fields_set contains the field - if self.goal_months_to_budget is None and "goal_months_to_budget" in self.model_fields_set: - _dict['goal_months_to_budget'] = None + if self.goal_under_funded_currency is None and "goal_under_funded_currency" in self.model_fields_set: + _dict['goal_under_funded_currency'] = None - # set to None if goal_under_funded (nullable) is None + # set to None if goal_overall_funded_formatted (nullable) is None # and model_fields_set contains the field - if self.goal_under_funded is None and "goal_under_funded" in self.model_fields_set: - _dict['goal_under_funded'] = None + if self.goal_overall_funded_formatted is None and "goal_overall_funded_formatted" in self.model_fields_set: + _dict['goal_overall_funded_formatted'] = None - # set to None if goal_overall_funded (nullable) is None + # set to None if goal_overall_funded_currency (nullable) is None # and model_fields_set contains the field - if self.goal_overall_funded is None and "goal_overall_funded" in self.model_fields_set: - _dict['goal_overall_funded'] = None + if self.goal_overall_funded_currency is None and "goal_overall_funded_currency" in self.model_fields_set: + _dict['goal_overall_funded_currency'] = None - # set to None if goal_overall_left (nullable) is None + # set to None if goal_overall_left_formatted (nullable) is None # and model_fields_set contains the field - if self.goal_overall_left is None and "goal_overall_left" in self.model_fields_set: - _dict['goal_overall_left'] = None + if self.goal_overall_left_formatted is None and "goal_overall_left_formatted" in self.model_fields_set: + _dict['goal_overall_left_formatted'] = None - # set to None if goal_snoozed_at (nullable) is None + # set to None if goal_overall_left_currency (nullable) is None # and model_fields_set contains the field - if self.goal_snoozed_at is None and "goal_snoozed_at" in self.model_fields_set: - _dict['goal_snoozed_at'] = None + if self.goal_overall_left_currency is None and "goal_overall_left_currency" in self.model_fields_set: + _dict['goal_overall_left_currency'] = None return _dict @@ -227,7 +202,21 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "goal_overall_funded": obj.get("goal_overall_funded"), "goal_overall_left": obj.get("goal_overall_left"), "goal_snoozed_at": obj.get("goal_snoozed_at"), - "deleted": obj.get("deleted") + "deleted": obj.get("deleted"), + "balance_formatted": obj.get("balance_formatted"), + "balance_currency": obj.get("balance_currency"), + "activity_formatted": obj.get("activity_formatted"), + "activity_currency": obj.get("activity_currency"), + "budgeted_formatted": obj.get("budgeted_formatted"), + "budgeted_currency": obj.get("budgeted_currency"), + "goal_target_formatted": obj.get("goal_target_formatted"), + "goal_target_currency": obj.get("goal_target_currency"), + "goal_under_funded_formatted": obj.get("goal_under_funded_formatted"), + "goal_under_funded_currency": obj.get("goal_under_funded_currency"), + "goal_overall_funded_formatted": obj.get("goal_overall_funded_formatted"), + "goal_overall_funded_currency": obj.get("goal_overall_funded_currency"), + "goal_overall_left_formatted": obj.get("goal_overall_left_formatted"), + "goal_overall_left_currency": obj.get("goal_overall_left_currency") }) return _obj diff --git a/ynab/models/category_base.py b/ynab/models/category_base.py new file mode 100644 index 0000000..26e5029 --- /dev/null +++ b/ynab/models/category_base.py @@ -0,0 +1,235 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CategoryBase(BaseModel): + """ + CategoryBase + """ # noqa: E501 + id: UUID + category_group_id: UUID + category_group_name: Optional[StrictStr] = None + name: StrictStr + hidden: StrictBool = Field(description="Whether or not the category is hidden") + original_category_group_id: Optional[UUID] = Field(default=None, description="DEPRECATED: No longer used. Value will always be null.") + note: Optional[StrictStr] = None + budgeted: StrictInt = Field(description="Assigned (budgeted) amount in milliunits format") + activity: StrictInt = Field(description="Activity amount in milliunits format") + balance: StrictInt = Field(description="Available balance in milliunits format") + goal_type: Optional[StrictStr] = Field(default=None, description="The type of goal, if the category has a goal (TB='Target Category Balance', TBD='Target Category Balance by Date', MF='Monthly Funding', NEED='Plan Your Spending')") + goal_needs_whole_amount: Optional[StrictBool] = Field(default=None, description="Indicates the monthly rollover behavior for \"NEED\"-type goals. When \"true\", the goal will always ask for the target amount in the new month (\"Set Aside\"). When \"false\", previous month category funding is used (\"Refill\"). For other goal types, this field will be null.") + goal_day: Optional[StrictInt] = Field(default=None, description="A day offset modifier for the goal's due date. When goal_cadence is 2 (Weekly), this value specifies which day of the week the goal is due (0 = Sunday, 6 = Saturday). Otherwise, this value specifies which day of the month the goal is due (1 = 1st, 31 = 31st, null = Last day of Month).") + goal_cadence: Optional[StrictInt] = Field(default=None, description="The goal cadence. Value in range 0-14. There are two subsets of these values which behave differently. For values 0, 1, 2, and 13, the goal's due date repeats every goal_cadence * goal_cadence_frequency, where 0 = None, 1 = Monthly, 2 = Weekly, and 13 = Yearly. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. For values 3-12 and 14, goal_cadence_frequency is ignored and the goal's due date repeats every goal_cadence, where 3 = Every 2 Months, 4 = Every 3 Months, ..., 12 = Every 11 Months, and 14 = Every 2 Years.") + goal_cadence_frequency: Optional[StrictInt] = Field(default=None, description="The goal cadence frequency. When goal_cadence is 0, 1, 2, or 13, a goal's due date repeats every goal_cadence * goal_cadence_frequency. For example, goal_cadence 1 with goal_cadence_frequency 2 means the goal is due every other month. When goal_cadence is 3-12 or 14, goal_cadence_frequency is ignored.") + goal_creation_month: Optional[date] = Field(default=None, description="The month a goal was created") + goal_target: Optional[StrictInt] = Field(default=None, description="The goal target amount in milliunits") + goal_target_month: Optional[date] = Field(default=None, description="DEPRECATED: No longer used. Use `goal_target_date` instead.") + goal_target_date: Optional[date] = Field(default=None, description="The target date for the goal to be completed. Only some goal types specify this date.") + goal_percentage_complete: Optional[StrictInt] = Field(default=None, description="The percentage completion of the goal") + goal_months_to_budget: Optional[StrictInt] = Field(default=None, description="The number of months, including the current month, left in the current goal period.") + goal_under_funded: Optional[StrictInt] = Field(default=None, description="The amount of funding still needed in the current month to stay on track towards completing the goal within the current goal period. This amount will generally correspond to the 'Underfunded' amount in the web and mobile clients except when viewing a category with a Needed for Spending Goal in a future month. The web and mobile clients will ignore any funding from a prior goal period when viewing category with a Needed for Spending Goal in a future month.") + goal_overall_funded: Optional[StrictInt] = Field(default=None, description="The total amount funded towards the goal within the current goal period.") + goal_overall_left: Optional[StrictInt] = Field(default=None, description="The amount of funding still needed to complete the goal within the current goal period.") + goal_snoozed_at: Optional[datetime] = Field(default=None, description="The date/time the goal was snoozed. If the goal is not snoozed, this will be null.") + deleted: StrictBool = Field(description="Whether or not the category has been deleted. Deleted categories will only be included in delta requests.") + __properties: ClassVar[List[str]] = ["id", "category_group_id", "category_group_name", "name", "hidden", "original_category_group_id", "note", "budgeted", "activity", "balance", "goal_type", "goal_needs_whole_amount", "goal_day", "goal_cadence", "goal_cadence_frequency", "goal_creation_month", "goal_target", "goal_target_month", "goal_target_date", "goal_percentage_complete", "goal_months_to_budget", "goal_under_funded", "goal_overall_funded", "goal_overall_left", "goal_snoozed_at", "deleted"] + + @field_validator('goal_type') + def goal_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['TB', 'TBD', 'MF', 'NEED', 'DEBT']): + raise ValueError("must be one of enum values ('TB', 'TBD', 'MF', 'NEED', 'DEBT')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CategoryBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if original_category_group_id (nullable) is None + # and model_fields_set contains the field + if self.original_category_group_id is None and "original_category_group_id" in self.model_fields_set: + _dict['original_category_group_id'] = None + + # set to None if note (nullable) is None + # and model_fields_set contains the field + if self.note is None and "note" in self.model_fields_set: + _dict['note'] = None + + # set to None if goal_type (nullable) is None + # and model_fields_set contains the field + if self.goal_type is None and "goal_type" in self.model_fields_set: + _dict['goal_type'] = None + + # set to None if goal_needs_whole_amount (nullable) is None + # and model_fields_set contains the field + if self.goal_needs_whole_amount is None and "goal_needs_whole_amount" in self.model_fields_set: + _dict['goal_needs_whole_amount'] = None + + # set to None if goal_day (nullable) is None + # and model_fields_set contains the field + if self.goal_day is None and "goal_day" in self.model_fields_set: + _dict['goal_day'] = None + + # set to None if goal_cadence (nullable) is None + # and model_fields_set contains the field + if self.goal_cadence is None and "goal_cadence" in self.model_fields_set: + _dict['goal_cadence'] = None + + # set to None if goal_cadence_frequency (nullable) is None + # and model_fields_set contains the field + if self.goal_cadence_frequency is None and "goal_cadence_frequency" in self.model_fields_set: + _dict['goal_cadence_frequency'] = None + + # set to None if goal_creation_month (nullable) is None + # and model_fields_set contains the field + if self.goal_creation_month is None and "goal_creation_month" in self.model_fields_set: + _dict['goal_creation_month'] = None + + # set to None if goal_target (nullable) is None + # and model_fields_set contains the field + if self.goal_target is None and "goal_target" in self.model_fields_set: + _dict['goal_target'] = None + + # set to None if goal_target_month (nullable) is None + # and model_fields_set contains the field + if self.goal_target_month is None and "goal_target_month" in self.model_fields_set: + _dict['goal_target_month'] = None + + # set to None if goal_target_date (nullable) is None + # and model_fields_set contains the field + if self.goal_target_date is None and "goal_target_date" in self.model_fields_set: + _dict['goal_target_date'] = None + + # set to None if goal_percentage_complete (nullable) is None + # and model_fields_set contains the field + if self.goal_percentage_complete is None and "goal_percentage_complete" in self.model_fields_set: + _dict['goal_percentage_complete'] = None + + # set to None if goal_months_to_budget (nullable) is None + # and model_fields_set contains the field + if self.goal_months_to_budget is None and "goal_months_to_budget" in self.model_fields_set: + _dict['goal_months_to_budget'] = None + + # set to None if goal_under_funded (nullable) is None + # and model_fields_set contains the field + if self.goal_under_funded is None and "goal_under_funded" in self.model_fields_set: + _dict['goal_under_funded'] = None + + # set to None if goal_overall_funded (nullable) is None + # and model_fields_set contains the field + if self.goal_overall_funded is None and "goal_overall_funded" in self.model_fields_set: + _dict['goal_overall_funded'] = None + + # set to None if goal_overall_left (nullable) is None + # and model_fields_set contains the field + if self.goal_overall_left is None and "goal_overall_left" in self.model_fields_set: + _dict['goal_overall_left'] = None + + # set to None if goal_snoozed_at (nullable) is None + # and model_fields_set contains the field + if self.goal_snoozed_at is None and "goal_snoozed_at" in self.model_fields_set: + _dict['goal_snoozed_at'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CategoryBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "category_group_id": obj.get("category_group_id"), + "category_group_name": obj.get("category_group_name"), + "name": obj.get("name"), + "hidden": obj.get("hidden"), + "original_category_group_id": obj.get("original_category_group_id"), + "note": obj.get("note"), + "budgeted": obj.get("budgeted"), + "activity": obj.get("activity"), + "balance": obj.get("balance"), + "goal_type": obj.get("goal_type"), + "goal_needs_whole_amount": obj.get("goal_needs_whole_amount"), + "goal_day": obj.get("goal_day"), + "goal_cadence": obj.get("goal_cadence"), + "goal_cadence_frequency": obj.get("goal_cadence_frequency"), + "goal_creation_month": obj.get("goal_creation_month"), + "goal_target": obj.get("goal_target"), + "goal_target_month": obj.get("goal_target_month"), + "goal_target_date": obj.get("goal_target_date"), + "goal_percentage_complete": obj.get("goal_percentage_complete"), + "goal_months_to_budget": obj.get("goal_months_to_budget"), + "goal_under_funded": obj.get("goal_under_funded"), + "goal_overall_funded": obj.get("goal_overall_funded"), + "goal_overall_left": obj.get("goal_overall_left"), + "goal_snoozed_at": obj.get("goal_snoozed_at"), + "deleted": obj.get("deleted") + }) + return _obj + + diff --git a/ynab/models/category_group.py b/ynab/models/category_group.py index 1690f58..1bb4c35 100644 --- a/ynab/models/category_group.py +++ b/ynab/models/category_group.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CategoryGroup(BaseModel): """ @@ -34,7 +35,8 @@ class CategoryGroup(BaseModel): __properties: ClassVar[List[str]] = ["id", "name", "hidden", "deleted"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/category_group_with_categories.py b/ynab/models/category_group_with_categories.py index 12875b2..9a8b417 100644 --- a/ynab/models/category_group_with_categories.py +++ b/ynab/models/category_group_with_categories.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -23,6 +23,7 @@ from ynab.models.category import Category from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CategoryGroupWithCategories(BaseModel): """ @@ -36,7 +37,8 @@ class CategoryGroupWithCategories(BaseModel): __properties: ClassVar[List[str]] = ["id", "name", "hidden", "deleted", "categories"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/category_response.py b/ynab/models/category_response.py index 5c7048a..c42da80 100644 --- a/ynab/models/category_response.py +++ b/ynab/models/category_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.category_response_data import CategoryResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CategoryResponse(BaseModel): """ @@ -31,7 +32,8 @@ class CategoryResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/category_response_data.py b/ynab/models/category_response_data.py index 5d3d0d8..f689cd7 100644 --- a/ynab/models/category_response_data.py +++ b/ynab/models/category_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.category import Category from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CategoryResponseData(BaseModel): """ @@ -31,7 +32,8 @@ class CategoryResponseData(BaseModel): __properties: ClassVar[List[str]] = ["category"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/currency_format.py b/ynab/models/currency_format.py index 6a2751d..139c5f4 100644 --- a/ynab/models/currency_format.py +++ b/ynab/models/currency_format.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CurrencyFormat(BaseModel): """ @@ -37,7 +38,8 @@ class CurrencyFormat(BaseModel): __properties: ClassVar[List[str]] = ["iso_code", "example_format", "decimal_digits", "decimal_separator", "symbol_first", "group_separator", "currency_symbol", "display_symbol"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/date_format.py b/ynab/models/date_format.py index 03e1338..16d1aae 100644 --- a/ynab/models/date_format.py +++ b/ynab/models/date_format.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DateFormat(BaseModel): """ @@ -30,7 +31,8 @@ class DateFormat(BaseModel): __properties: ClassVar[List[str]] = ["format"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/error_detail.py b/ynab/models/error_detail.py index 2b4e719..994eeab 100644 --- a/ynab/models/error_detail.py +++ b/ynab/models/error_detail.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ErrorDetail(BaseModel): """ @@ -32,7 +33,8 @@ class ErrorDetail(BaseModel): __properties: ClassVar[List[str]] = ["id", "name", "detail"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/error_response.py b/ynab/models/error_response.py index ba941cb..776266d 100644 --- a/ynab/models/error_response.py +++ b/ynab/models/error_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.error_detail import ErrorDetail from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ErrorResponse(BaseModel): """ @@ -31,7 +32,8 @@ class ErrorResponse(BaseModel): __properties: ClassVar[List[str]] = ["error"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/existing_category.py b/ynab/models/existing_category.py index 81ef0bb..3692e1d 100644 --- a/ynab/models/existing_category.py +++ b/ynab/models/existing_category.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,11 +18,12 @@ import json from datetime import date -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ExistingCategory(BaseModel): """ @@ -31,12 +32,14 @@ class ExistingCategory(BaseModel): name: Optional[StrictStr] = None note: Optional[StrictStr] = None category_group_id: Optional[UUID] = None - goal_target: Optional[StrictInt] = Field(default=None, description="The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount.") + goal_target: Optional[StrictInt] = Field(default=None, description="The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories.") goal_target_date: Optional[date] = Field(default=None, description="The goal target date in ISO format (e.g. 2016-12-01).") - __properties: ClassVar[List[str]] = ["name", "note", "category_group_id", "goal_target", "goal_target_date"] + goal_needs_whole_amount: Optional[StrictBool] = Field(default=None, description="Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'.") + __properties: ClassVar[List[str]] = ["name", "note", "category_group_id", "goal_target", "goal_target_date", "goal_needs_whole_amount"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -90,7 +92,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "note": obj.get("note"), "category_group_id": obj.get("category_group_id"), "goal_target": obj.get("goal_target"), - "goal_target_date": obj.get("goal_target_date") + "goal_target_date": obj.get("goal_target_date"), + "goal_needs_whole_amount": obj.get("goal_needs_whole_amount") }) return _obj diff --git a/ynab/models/existing_transaction.py b/ynab/models/existing_transaction.py index 174b944..39d6b27 100644 --- a/ynab/models/existing_transaction.py +++ b/ynab/models/existing_transaction.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -27,6 +27,7 @@ from ynab.models.transaction_flag_color import TransactionFlagColor from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ExistingTransaction(BaseModel): """ @@ -46,7 +47,8 @@ class ExistingTransaction(BaseModel): __properties: ClassVar[List[str]] = ["account_id", "date", "amount", "payee_id", "payee_name", "category_id", "memo", "cleared", "approved", "flag_color", "subtransactions"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -58,8 +60,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/hybrid_transaction.py b/ynab/models/hybrid_transaction.py index 3e2449b..68381fc 100644 --- a/ynab/models/hybrid_transaction.py +++ b/ynab/models/hybrid_transaction.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,13 +18,14 @@ import json from datetime import date -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from uuid import UUID from ynab.models.transaction_cleared_status import TransactionClearedStatus from ynab.models.transaction_flag_color import TransactionFlagColor from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class HybridTransaction(BaseModel): """ @@ -49,12 +50,14 @@ class HybridTransaction(BaseModel): import_payee_name_original: Optional[StrictStr] = Field(default=None, description="If the transaction was imported, the original payee name as it appeared on the statement") debt_transaction_type: Optional[StrictStr] = Field(default=None, description="If the transaction is a debt/loan account transaction, the type of transaction") deleted: StrictBool = Field(description="Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.") + amount_formatted: Optional[StrictStr] = Field(default=None, description="The transaction amount formatted in the plan's currency format") + amount_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The transaction amount as a decimal currency amount") type: StrictStr = Field(description="Whether the hybrid transaction represents a regular transaction or a subtransaction") parent_transaction_id: Optional[StrictStr] = Field(default=None, description="For subtransaction types, this is the id of the parent transaction. For transaction types, this id will be always be null.") account_name: StrictStr payee_name: Optional[StrictStr] = None category_name: Optional[StrictStr] = Field(default=None, description="The name of the category. If a split transaction, this will be 'Split'.") - __properties: ClassVar[List[str]] = ["id", "date", "amount", "memo", "cleared", "approved", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "transfer_transaction_id", "matched_transaction_id", "import_id", "import_payee_name", "import_payee_name_original", "debt_transaction_type", "deleted", "type", "parent_transaction_id", "account_name", "payee_name", "category_name"] + __properties: ClassVar[List[str]] = ["id", "date", "amount", "memo", "cleared", "approved", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "transfer_transaction_id", "matched_transaction_id", "import_id", "import_payee_name", "import_payee_name_original", "debt_transaction_type", "deleted", "amount_formatted", "amount_currency", "type", "parent_transaction_id", "account_name", "payee_name", "category_name"] @field_validator('debt_transaction_type') def debt_transaction_type_validate_enum(cls, value): @@ -74,7 +77,8 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -86,8 +90,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -163,6 +166,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "import_payee_name_original": obj.get("import_payee_name_original"), "debt_transaction_type": obj.get("debt_transaction_type"), "deleted": obj.get("deleted"), + "amount_formatted": obj.get("amount_formatted"), + "amount_currency": obj.get("amount_currency"), "type": obj.get("type"), "parent_transaction_id": obj.get("parent_transaction_id"), "account_name": obj.get("account_name"), diff --git a/ynab/models/hybrid_transactions_response.py b/ynab/models/hybrid_transactions_response.py index 4026e3d..33fafcf 100644 --- a/ynab/models/hybrid_transactions_response.py +++ b/ynab/models/hybrid_transactions_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.hybrid_transactions_response_data import HybridTransactionsResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class HybridTransactionsResponse(BaseModel): """ @@ -31,7 +32,8 @@ class HybridTransactionsResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/hybrid_transactions_response_data.py b/ynab/models/hybrid_transactions_response_data.py index 4990079..4bc2357 100644 --- a/ynab/models/hybrid_transactions_response_data.py +++ b/ynab/models/hybrid_transactions_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.hybrid_transaction import HybridTransaction from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class HybridTransactionsResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class HybridTransactionsResponseData(BaseModel): __properties: ClassVar[List[str]] = ["transactions", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/money_movement.py b/ynab/models/money_movement.py index e4f00dd..eadee34 100644 --- a/ynab/models/money_movement.py +++ b/ynab/models/money_movement.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,11 +18,12 @@ import json from datetime import date, datetime -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MoneyMovement(BaseModel): """ @@ -37,10 +38,13 @@ class MoneyMovement(BaseModel): from_category_id: Optional[UUID] = Field(default=None, description="The id of the category the money was moved from") to_category_id: Optional[UUID] = Field(default=None, description="The id of the category the money was moved to") amount: StrictInt = Field(description="The amount of the money movement in milliunits format") - __properties: ClassVar[List[str]] = ["id", "month", "moved_at", "note", "money_movement_group_id", "performed_by_user_id", "from_category_id", "to_category_id", "amount"] + amount_formatted: Optional[StrictStr] = Field(default=None, description="The money movement amount formatted in the plan's currency format") + amount_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The money movement amount as a decimal currency amount") + __properties: ClassVar[List[str]] = ["id", "month", "moved_at", "note", "money_movement_group_id", "performed_by_user_id", "from_category_id", "to_category_id", "amount", "amount_formatted", "amount_currency"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,41 +81,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if month (nullable) is None - # and model_fields_set contains the field - if self.month is None and "month" in self.model_fields_set: - _dict['month'] = None - - # set to None if moved_at (nullable) is None - # and model_fields_set contains the field - if self.moved_at is None and "moved_at" in self.model_fields_set: - _dict['moved_at'] = None - - # set to None if note (nullable) is None - # and model_fields_set contains the field - if self.note is None and "note" in self.model_fields_set: - _dict['note'] = None - - # set to None if money_movement_group_id (nullable) is None - # and model_fields_set contains the field - if self.money_movement_group_id is None and "money_movement_group_id" in self.model_fields_set: - _dict['money_movement_group_id'] = None - - # set to None if performed_by_user_id (nullable) is None - # and model_fields_set contains the field - if self.performed_by_user_id is None and "performed_by_user_id" in self.model_fields_set: - _dict['performed_by_user_id'] = None - - # set to None if from_category_id (nullable) is None - # and model_fields_set contains the field - if self.from_category_id is None and "from_category_id" in self.model_fields_set: - _dict['from_category_id'] = None - - # set to None if to_category_id (nullable) is None - # and model_fields_set contains the field - if self.to_category_id is None and "to_category_id" in self.model_fields_set: - _dict['to_category_id'] = None - return _dict @classmethod @@ -133,7 +101,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "performed_by_user_id": obj.get("performed_by_user_id"), "from_category_id": obj.get("from_category_id"), "to_category_id": obj.get("to_category_id"), - "amount": obj.get("amount") + "amount": obj.get("amount"), + "amount_formatted": obj.get("amount_formatted"), + "amount_currency": obj.get("amount_currency") }) return _obj diff --git a/ynab/models/money_movement_base.py b/ynab/models/money_movement_base.py new file mode 100644 index 0000000..dfd8f17 --- /dev/null +++ b/ynab/models/money_movement_base.py @@ -0,0 +1,141 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MoneyMovementBase(BaseModel): + """ + MoneyMovementBase + """ # noqa: E501 + id: UUID + month: Optional[date] = Field(default=None, description="The month of the money movement in ISO format (e.g. 2024-01-01)") + moved_at: Optional[datetime] = Field(default=None, description="The date/time the money movement was processed on the server in ISO format (e.g. 2024-01-01T12:00:00Z)") + note: Optional[StrictStr] = None + money_movement_group_id: Optional[UUID] = Field(default=None, description="The id of the money movement group this movement belongs to") + performed_by_user_id: Optional[UUID] = Field(default=None, description="The id of the user who performed the money movement") + from_category_id: Optional[UUID] = Field(default=None, description="The id of the category the money was moved from") + to_category_id: Optional[UUID] = Field(default=None, description="The id of the category the money was moved to") + amount: StrictInt = Field(description="The amount of the money movement in milliunits format") + __properties: ClassVar[List[str]] = ["id", "month", "moved_at", "note", "money_movement_group_id", "performed_by_user_id", "from_category_id", "to_category_id", "amount"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MoneyMovementBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if month (nullable) is None + # and model_fields_set contains the field + if self.month is None and "month" in self.model_fields_set: + _dict['month'] = None + + # set to None if moved_at (nullable) is None + # and model_fields_set contains the field + if self.moved_at is None and "moved_at" in self.model_fields_set: + _dict['moved_at'] = None + + # set to None if note (nullable) is None + # and model_fields_set contains the field + if self.note is None and "note" in self.model_fields_set: + _dict['note'] = None + + # set to None if money_movement_group_id (nullable) is None + # and model_fields_set contains the field + if self.money_movement_group_id is None and "money_movement_group_id" in self.model_fields_set: + _dict['money_movement_group_id'] = None + + # set to None if performed_by_user_id (nullable) is None + # and model_fields_set contains the field + if self.performed_by_user_id is None and "performed_by_user_id" in self.model_fields_set: + _dict['performed_by_user_id'] = None + + # set to None if from_category_id (nullable) is None + # and model_fields_set contains the field + if self.from_category_id is None and "from_category_id" in self.model_fields_set: + _dict['from_category_id'] = None + + # set to None if to_category_id (nullable) is None + # and model_fields_set contains the field + if self.to_category_id is None and "to_category_id" in self.model_fields_set: + _dict['to_category_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MoneyMovementBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "month": obj.get("month"), + "moved_at": obj.get("moved_at"), + "note": obj.get("note"), + "money_movement_group_id": obj.get("money_movement_group_id"), + "performed_by_user_id": obj.get("performed_by_user_id"), + "from_category_id": obj.get("from_category_id"), + "to_category_id": obj.get("to_category_id"), + "amount": obj.get("amount") + }) + return _obj + + diff --git a/ynab/models/money_movement_group.py b/ynab/models/money_movement_group.py index 2e43424..303f146 100644 --- a/ynab/models/money_movement_group.py +++ b/ynab/models/money_movement_group.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -23,6 +23,7 @@ from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MoneyMovementGroup(BaseModel): """ @@ -36,7 +37,8 @@ class MoneyMovementGroup(BaseModel): __properties: ClassVar[List[str]] = ["id", "group_created_at", "month", "note", "performed_by_user_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/money_movement_groups_response.py b/ynab/models/money_movement_groups_response.py index 2b8e291..d27c867 100644 --- a/ynab/models/money_movement_groups_response.py +++ b/ynab/models/money_movement_groups_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.money_movement_groups_response_data import MoneyMovementGroupsResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MoneyMovementGroupsResponse(BaseModel): """ @@ -31,7 +32,8 @@ class MoneyMovementGroupsResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/money_movement_groups_response_data.py b/ynab/models/money_movement_groups_response_data.py index a9f149c..0e230e9 100644 --- a/ynab/models/money_movement_groups_response_data.py +++ b/ynab/models/money_movement_groups_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.money_movement_group import MoneyMovementGroup from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MoneyMovementGroupsResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class MoneyMovementGroupsResponseData(BaseModel): __properties: ClassVar[List[str]] = ["money_movement_groups", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/money_movements_response.py b/ynab/models/money_movements_response.py index 778fa70..3f5a15e 100644 --- a/ynab/models/money_movements_response.py +++ b/ynab/models/money_movements_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.money_movements_response_data import MoneyMovementsResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MoneyMovementsResponse(BaseModel): """ @@ -31,7 +32,8 @@ class MoneyMovementsResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/money_movements_response_data.py b/ynab/models/money_movements_response_data.py index fc2a7dd..a142fb1 100644 --- a/ynab/models/money_movements_response_data.py +++ b/ynab/models/money_movements_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.money_movement import MoneyMovement from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MoneyMovementsResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class MoneyMovementsResponseData(BaseModel): __properties: ClassVar[List[str]] = ["money_movements", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/month_detail.py b/ynab/models/month_detail.py index 04bc61e..944a0bd 100644 --- a/ynab/models/month_detail.py +++ b/ynab/models/month_detail.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,11 +18,12 @@ import json from datetime import date -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from ynab.models.category import Category from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MonthDetail(BaseModel): """ @@ -36,11 +37,20 @@ class MonthDetail(BaseModel): to_be_budgeted: StrictInt = Field(description="The available amount for 'Ready to Assign'") age_of_money: Optional[StrictInt] = Field(default=None, description="The Age of Money as of the month") deleted: StrictBool = Field(description="Whether or not the month has been deleted. Deleted months will only be included in delta requests.") + income_formatted: Optional[StrictStr] = Field(default=None, description="The total income formatted in the plan's currency format") + income_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total income as a decimal currency amount") + budgeted_formatted: Optional[StrictStr] = Field(default=None, description="The total amount assigned formatted in the plan's currency format") + budgeted_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total amount assigned as a decimal currency amount") + activity_formatted: Optional[StrictStr] = Field(default=None, description="The total activity amount formatted in the plan's currency format") + activity_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total activity amount as a decimal currency amount") + to_be_budgeted_formatted: Optional[StrictStr] = Field(default=None, description="The available amount for 'Ready to Assign' formatted in the plan's currency format") + to_be_budgeted_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The available amount for 'Ready to Assign' as a decimal currency amount") categories: List[Category] = Field(description="The plan month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified.") - __properties: ClassVar[List[str]] = ["month", "note", "income", "budgeted", "activity", "to_be_budgeted", "age_of_money", "deleted", "categories"] + __properties: ClassVar[List[str]] = ["month", "note", "income", "budgeted", "activity", "to_be_budgeted", "age_of_money", "deleted", "income_formatted", "income_currency", "budgeted_formatted", "budgeted_currency", "activity_formatted", "activity_currency", "to_be_budgeted_formatted", "to_be_budgeted_currency", "categories"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +62,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -105,6 +114,14 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "to_be_budgeted": obj.get("to_be_budgeted"), "age_of_money": obj.get("age_of_money"), "deleted": obj.get("deleted"), + "income_formatted": obj.get("income_formatted"), + "income_currency": obj.get("income_currency"), + "budgeted_formatted": obj.get("budgeted_formatted"), + "budgeted_currency": obj.get("budgeted_currency"), + "activity_formatted": obj.get("activity_formatted"), + "activity_currency": obj.get("activity_currency"), + "to_be_budgeted_formatted": obj.get("to_be_budgeted_formatted"), + "to_be_budgeted_currency": obj.get("to_be_budgeted_currency"), "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None }) return _obj diff --git a/ynab/models/month_detail_base.py b/ynab/models/month_detail_base.py new file mode 100644 index 0000000..5e729d7 --- /dev/null +++ b/ynab/models/month_detail_base.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from ynab.models.category_base import CategoryBase +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MonthDetailBase(BaseModel): + """ + MonthDetailBase + """ # noqa: E501 + month: date + note: Optional[StrictStr] = None + income: StrictInt = Field(description="The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month") + budgeted: StrictInt = Field(description="The total amount assigned (budgeted) in the month") + activity: StrictInt = Field(description="The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign'") + to_be_budgeted: StrictInt = Field(description="The available amount for 'Ready to Assign'") + age_of_money: Optional[StrictInt] = Field(default=None, description="The Age of Money as of the month") + deleted: StrictBool = Field(description="Whether or not the month has been deleted. Deleted months will only be included in delta requests.") + categories: List[CategoryBase] = Field(description="The plan month categories. Amounts (budgeted, activity, balance, etc.) are specific to the {month} parameter specified.") + __properties: ClassVar[List[str]] = ["month", "note", "income", "budgeted", "activity", "to_be_budgeted", "age_of_money", "deleted", "categories"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MonthDetailBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in categories (list) + _items = [] + if self.categories: + for _item_categories in self.categories: + if _item_categories: + _items.append(_item_categories.to_dict()) + _dict['categories'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MonthDetailBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "month": obj.get("month"), + "note": obj.get("note"), + "income": obj.get("income"), + "budgeted": obj.get("budgeted"), + "activity": obj.get("activity"), + "to_be_budgeted": obj.get("to_be_budgeted"), + "age_of_money": obj.get("age_of_money"), + "deleted": obj.get("deleted"), + "categories": [CategoryBase.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None + }) + return _obj + + diff --git a/ynab/models/month_detail_response.py b/ynab/models/month_detail_response.py index bb6cdf1..dd4bea3 100644 --- a/ynab/models/month_detail_response.py +++ b/ynab/models/month_detail_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.month_detail_response_data import MonthDetailResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MonthDetailResponse(BaseModel): """ @@ -31,7 +32,8 @@ class MonthDetailResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/month_detail_response_data.py b/ynab/models/month_detail_response_data.py index 30d82da..9ec1c04 100644 --- a/ynab/models/month_detail_response_data.py +++ b/ynab/models/month_detail_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.month_detail import MonthDetail from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MonthDetailResponseData(BaseModel): """ @@ -31,7 +32,8 @@ class MonthDetailResponseData(BaseModel): __properties: ClassVar[List[str]] = ["month"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/month_summaries_response.py b/ynab/models/month_summaries_response.py index 3eda45a..0a6472c 100644 --- a/ynab/models/month_summaries_response.py +++ b/ynab/models/month_summaries_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.month_summaries_response_data import MonthSummariesResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MonthSummariesResponse(BaseModel): """ @@ -31,7 +32,8 @@ class MonthSummariesResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/month_summaries_response_data.py b/ynab/models/month_summaries_response_data.py index 152d0c9..0b6bc2c 100644 --- a/ynab/models/month_summaries_response_data.py +++ b/ynab/models/month_summaries_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.month_summary import MonthSummary from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MonthSummariesResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class MonthSummariesResponseData(BaseModel): __properties: ClassVar[List[str]] = ["months", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/month_summary.py b/ynab/models/month_summary.py index 664e376..05d66bc 100644 --- a/ynab/models/month_summary.py +++ b/ynab/models/month_summary.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,10 +18,11 @@ import json from datetime import date -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MonthSummary(BaseModel): """ @@ -35,10 +36,19 @@ class MonthSummary(BaseModel): to_be_budgeted: StrictInt = Field(description="The available amount for 'Ready to Assign'") age_of_money: Optional[StrictInt] = Field(default=None, description="The Age of Money as of the month") deleted: StrictBool = Field(description="Whether or not the month has been deleted. Deleted months will only be included in delta requests.") - __properties: ClassVar[List[str]] = ["month", "note", "income", "budgeted", "activity", "to_be_budgeted", "age_of_money", "deleted"] + income_formatted: Optional[StrictStr] = Field(default=None, description="The total income formatted in the plan's currency format") + income_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total income as a decimal currency amount") + budgeted_formatted: Optional[StrictStr] = Field(default=None, description="The total amount assigned formatted in the plan's currency format") + budgeted_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total amount assigned as a decimal currency amount") + activity_formatted: Optional[StrictStr] = Field(default=None, description="The total activity amount formatted in the plan's currency format") + activity_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The total activity amount as a decimal currency amount") + to_be_budgeted_formatted: Optional[StrictStr] = Field(default=None, description="The available amount for 'Ready to Assign' formatted in the plan's currency format") + to_be_budgeted_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The available amount for 'Ready to Assign' as a decimal currency amount") + __properties: ClassVar[List[str]] = ["month", "note", "income", "budgeted", "activity", "to_be_budgeted", "age_of_money", "deleted", "income_formatted", "income_currency", "budgeted_formatted", "budgeted_currency", "activity_formatted", "activity_currency", "to_be_budgeted_formatted", "to_be_budgeted_currency"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +60,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -76,16 +85,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if note (nullable) is None - # and model_fields_set contains the field - if self.note is None and "note" in self.model_fields_set: - _dict['note'] = None - - # set to None if age_of_money (nullable) is None - # and model_fields_set contains the field - if self.age_of_money is None and "age_of_money" in self.model_fields_set: - _dict['age_of_money'] = None - return _dict @classmethod @@ -105,7 +104,15 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "activity": obj.get("activity"), "to_be_budgeted": obj.get("to_be_budgeted"), "age_of_money": obj.get("age_of_money"), - "deleted": obj.get("deleted") + "deleted": obj.get("deleted"), + "income_formatted": obj.get("income_formatted"), + "income_currency": obj.get("income_currency"), + "budgeted_formatted": obj.get("budgeted_formatted"), + "budgeted_currency": obj.get("budgeted_currency"), + "activity_formatted": obj.get("activity_formatted"), + "activity_currency": obj.get("activity_currency"), + "to_be_budgeted_formatted": obj.get("to_be_budgeted_formatted"), + "to_be_budgeted_currency": obj.get("to_be_budgeted_currency") }) return _obj diff --git a/ynab/models/month_summary_base.py b/ynab/models/month_summary_base.py new file mode 100644 index 0000000..8fe2d4b --- /dev/null +++ b/ynab/models/month_summary_base.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class MonthSummaryBase(BaseModel): + """ + MonthSummaryBase + """ # noqa: E501 + month: date + note: Optional[StrictStr] = None + income: StrictInt = Field(description="The total amount of transactions categorized to 'Inflow: Ready to Assign' in the month") + budgeted: StrictInt = Field(description="The total amount assigned (budgeted) in the month") + activity: StrictInt = Field(description="The total amount of transactions in the month, excluding those categorized to 'Inflow: Ready to Assign'") + to_be_budgeted: StrictInt = Field(description="The available amount for 'Ready to Assign'") + age_of_money: Optional[StrictInt] = Field(default=None, description="The Age of Money as of the month") + deleted: StrictBool = Field(description="Whether or not the month has been deleted. Deleted months will only be included in delta requests.") + __properties: ClassVar[List[str]] = ["month", "note", "income", "budgeted", "activity", "to_be_budgeted", "age_of_money", "deleted"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MonthSummaryBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if note (nullable) is None + # and model_fields_set contains the field + if self.note is None and "note" in self.model_fields_set: + _dict['note'] = None + + # set to None if age_of_money (nullable) is None + # and model_fields_set contains the field + if self.age_of_money is None and "age_of_money" in self.model_fields_set: + _dict['age_of_money'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MonthSummaryBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "month": obj.get("month"), + "note": obj.get("note"), + "income": obj.get("income"), + "budgeted": obj.get("budgeted"), + "activity": obj.get("activity"), + "to_be_budgeted": obj.get("to_be_budgeted"), + "age_of_money": obj.get("age_of_money"), + "deleted": obj.get("deleted") + }) + return _obj + + diff --git a/ynab/models/new_category.py b/ynab/models/new_category.py index 3e69be5..dd74a9c 100644 --- a/ynab/models/new_category.py +++ b/ynab/models/new_category.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,11 +18,12 @@ import json from datetime import date -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class NewCategory(BaseModel): """ @@ -31,12 +32,14 @@ class NewCategory(BaseModel): name: Optional[StrictStr] = None note: Optional[StrictStr] = None category_group_id: Optional[UUID] = None - goal_target: Optional[StrictInt] = Field(default=None, description="The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount.") + goal_target: Optional[StrictInt] = Field(default=None, description="The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories.") goal_target_date: Optional[date] = Field(default=None, description="The goal target date in ISO format (e.g. 2016-12-01).") - __properties: ClassVar[List[str]] = ["name", "note", "category_group_id", "goal_target", "goal_target_date"] + goal_needs_whole_amount: Optional[StrictBool] = Field(default=None, description="Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'.") + __properties: ClassVar[List[str]] = ["name", "note", "category_group_id", "goal_target", "goal_target_date", "goal_needs_whole_amount"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -90,7 +92,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "note": obj.get("note"), "category_group_id": obj.get("category_group_id"), "goal_target": obj.get("goal_target"), - "goal_target_date": obj.get("goal_target_date") + "goal_target_date": obj.get("goal_target_date"), + "goal_needs_whole_amount": obj.get("goal_needs_whole_amount") }) return _obj diff --git a/ynab/models/new_transaction.py b/ynab/models/new_transaction.py index b482ffd..9579faa 100644 --- a/ynab/models/new_transaction.py +++ b/ynab/models/new_transaction.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -27,6 +27,7 @@ from ynab.models.transaction_flag_color import TransactionFlagColor from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class NewTransaction(BaseModel): """ @@ -47,7 +48,8 @@ class NewTransaction(BaseModel): __properties: ClassVar[List[str]] = ["account_id", "date", "amount", "payee_id", "payee_name", "category_id", "memo", "cleared", "approved", "flag_color", "subtransactions", "import_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -59,8 +61,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/patch_category_group_wrapper.py b/ynab/models/patch_category_group_wrapper.py index 4b3d5c8..ea0ec91 100644 --- a/ynab/models/patch_category_group_wrapper.py +++ b/ynab/models/patch_category_group_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_category_group import SaveCategoryGroup from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PatchCategoryGroupWrapper(BaseModel): """ @@ -31,7 +32,8 @@ class PatchCategoryGroupWrapper(BaseModel): __properties: ClassVar[List[str]] = ["category_group"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/patch_category_wrapper.py b/ynab/models/patch_category_wrapper.py index cd8f743..4aa9a95 100644 --- a/ynab/models/patch_category_wrapper.py +++ b/ynab/models/patch_category_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.existing_category import ExistingCategory from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PatchCategoryWrapper(BaseModel): """ @@ -31,7 +32,8 @@ class PatchCategoryWrapper(BaseModel): __properties: ClassVar[List[str]] = ["category"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/patch_month_category_wrapper.py b/ynab/models/patch_month_category_wrapper.py index df0d6e8..79c80d8 100644 --- a/ynab/models/patch_month_category_wrapper.py +++ b/ynab/models/patch_month_category_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_month_category import SaveMonthCategory from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PatchMonthCategoryWrapper(BaseModel): """ @@ -31,7 +32,8 @@ class PatchMonthCategoryWrapper(BaseModel): __properties: ClassVar[List[str]] = ["category"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/patch_payee_wrapper.py b/ynab/models/patch_payee_wrapper.py index a6f6963..e7b85e8 100644 --- a/ynab/models/patch_payee_wrapper.py +++ b/ynab/models/patch_payee_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_payee import SavePayee from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PatchPayeeWrapper(BaseModel): """ @@ -31,7 +32,8 @@ class PatchPayeeWrapper(BaseModel): __properties: ClassVar[List[str]] = ["payee"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/patch_transactions_wrapper.py b/ynab/models/patch_transactions_wrapper.py index 74d0e6b..c1effd7 100644 --- a/ynab/models/patch_transactions_wrapper.py +++ b/ynab/models/patch_transactions_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_transaction_with_id_or_import_id import SaveTransactionWithIdOrImportId from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PatchTransactionsWrapper(BaseModel): """ @@ -31,7 +32,8 @@ class PatchTransactionsWrapper(BaseModel): __properties: ClassVar[List[str]] = ["transactions"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/payee.py b/ynab/models/payee.py index d238974..c7a9bb1 100644 --- a/ynab/models/payee.py +++ b/ynab/models/payee.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Payee(BaseModel): """ @@ -34,7 +35,8 @@ class Payee(BaseModel): __properties: ClassVar[List[str]] = ["id", "name", "transfer_account_id", "deleted"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/payee_location.py b/ynab/models/payee_location.py index 8bb1080..17e2c53 100644 --- a/ynab/models/payee_location.py +++ b/ynab/models/payee_location.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayeeLocation(BaseModel): """ @@ -35,7 +36,8 @@ class PayeeLocation(BaseModel): __properties: ClassVar[List[str]] = ["id", "payee_id", "latitude", "longitude", "deleted"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/payee_location_response.py b/ynab/models/payee_location_response.py index bc74923..ab09a0c 100644 --- a/ynab/models/payee_location_response.py +++ b/ynab/models/payee_location_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.payee_location_response_data import PayeeLocationResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayeeLocationResponse(BaseModel): """ @@ -31,7 +32,8 @@ class PayeeLocationResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/payee_location_response_data.py b/ynab/models/payee_location_response_data.py index 5aff1f6..4306825 100644 --- a/ynab/models/payee_location_response_data.py +++ b/ynab/models/payee_location_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.payee_location import PayeeLocation from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayeeLocationResponseData(BaseModel): """ @@ -31,7 +32,8 @@ class PayeeLocationResponseData(BaseModel): __properties: ClassVar[List[str]] = ["payee_location"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/payee_locations_response.py b/ynab/models/payee_locations_response.py index 6a80feb..b1689a1 100644 --- a/ynab/models/payee_locations_response.py +++ b/ynab/models/payee_locations_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.payee_locations_response_data import PayeeLocationsResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayeeLocationsResponse(BaseModel): """ @@ -31,7 +32,8 @@ class PayeeLocationsResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/payee_locations_response_data.py b/ynab/models/payee_locations_response_data.py index 17c9424..1ebd46b 100644 --- a/ynab/models/payee_locations_response_data.py +++ b/ynab/models/payee_locations_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.payee_location import PayeeLocation from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayeeLocationsResponseData(BaseModel): """ @@ -31,7 +32,8 @@ class PayeeLocationsResponseData(BaseModel): __properties: ClassVar[List[str]] = ["payee_locations"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/payee_response.py b/ynab/models/payee_response.py index 94976cd..552a87b 100644 --- a/ynab/models/payee_response.py +++ b/ynab/models/payee_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.payee_response_data import PayeeResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayeeResponse(BaseModel): """ @@ -31,7 +32,8 @@ class PayeeResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/payee_response_data.py b/ynab/models/payee_response_data.py index dc538cc..89347b6 100644 --- a/ynab/models/payee_response_data.py +++ b/ynab/models/payee_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.payee import Payee from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayeeResponseData(BaseModel): """ @@ -31,7 +32,8 @@ class PayeeResponseData(BaseModel): __properties: ClassVar[List[str]] = ["payee"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/payees_response.py b/ynab/models/payees_response.py index f4fb139..f30bcc9 100644 --- a/ynab/models/payees_response.py +++ b/ynab/models/payees_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.payees_response_data import PayeesResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayeesResponse(BaseModel): """ @@ -31,7 +32,8 @@ class PayeesResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/payees_response_data.py b/ynab/models/payees_response_data.py index 1501830..e39b9be 100644 --- a/ynab/models/payees_response_data.py +++ b/ynab/models/payees_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.payee import Payee from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayeesResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class PayeesResponseData(BaseModel): __properties: ClassVar[List[str]] = ["payees", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/plan_detail.py b/ynab/models/plan_detail.py index ed26e79..befdce0 100644 --- a/ynab/models/plan_detail.py +++ b/ynab/models/plan_detail.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -21,20 +21,21 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional from uuid import UUID -from ynab.models.account import Account -from ynab.models.category import Category +from ynab.models.account_base import AccountBase +from ynab.models.category_base import CategoryBase from ynab.models.category_group import CategoryGroup from ynab.models.currency_format import CurrencyFormat from ynab.models.date_format import DateFormat -from ynab.models.month_detail import MonthDetail +from ynab.models.month_detail_base import MonthDetailBase from ynab.models.payee import Payee from ynab.models.payee_location import PayeeLocation -from ynab.models.scheduled_sub_transaction import ScheduledSubTransaction -from ynab.models.scheduled_transaction_summary import ScheduledTransactionSummary -from ynab.models.sub_transaction import SubTransaction -from ynab.models.transaction_summary import TransactionSummary +from ynab.models.scheduled_sub_transaction_base import ScheduledSubTransactionBase +from ynab.models.scheduled_transaction_summary_base import ScheduledTransactionSummaryBase +from ynab.models.sub_transaction_base import SubTransactionBase +from ynab.models.transaction_summary_base import TransactionSummaryBase from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PlanDetail(BaseModel): """ @@ -47,20 +48,21 @@ class PlanDetail(BaseModel): last_month: Optional[date] = Field(default=None, description="The latest plan month") date_format: Optional[DateFormat] = None currency_format: Optional[CurrencyFormat] = None - accounts: Optional[List[Account]] = None + accounts: Optional[List[AccountBase]] = None payees: Optional[List[Payee]] = None payee_locations: Optional[List[PayeeLocation]] = None category_groups: Optional[List[CategoryGroup]] = None - categories: Optional[List[Category]] = None - months: Optional[List[MonthDetail]] = None - transactions: Optional[List[TransactionSummary]] = None - subtransactions: Optional[List[SubTransaction]] = None - scheduled_transactions: Optional[List[ScheduledTransactionSummary]] = None - scheduled_subtransactions: Optional[List[ScheduledSubTransaction]] = None + categories: Optional[List[CategoryBase]] = None + months: Optional[List[MonthDetailBase]] = None + transactions: Optional[List[TransactionSummaryBase]] = None + subtransactions: Optional[List[SubTransactionBase]] = None + scheduled_transactions: Optional[List[ScheduledTransactionSummaryBase]] = None + scheduled_subtransactions: Optional[List[ScheduledSubTransactionBase]] = None __properties: ClassVar[List[str]] = ["id", "name", "last_modified_on", "first_month", "last_month", "date_format", "currency_format", "accounts", "payees", "payee_locations", "category_groups", "categories", "months", "transactions", "subtransactions", "scheduled_transactions", "scheduled_subtransactions"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -72,8 +74,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -193,16 +194,16 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "last_month": obj.get("last_month"), "date_format": DateFormat.from_dict(obj["date_format"]) if obj.get("date_format") is not None else None, "currency_format": CurrencyFormat.from_dict(obj["currency_format"]) if obj.get("currency_format") is not None else None, - "accounts": [Account.from_dict(_item) for _item in obj["accounts"]] if obj.get("accounts") is not None else None, + "accounts": [AccountBase.from_dict(_item) for _item in obj["accounts"]] if obj.get("accounts") is not None else None, "payees": [Payee.from_dict(_item) for _item in obj["payees"]] if obj.get("payees") is not None else None, "payee_locations": [PayeeLocation.from_dict(_item) for _item in obj["payee_locations"]] if obj.get("payee_locations") is not None else None, "category_groups": [CategoryGroup.from_dict(_item) for _item in obj["category_groups"]] if obj.get("category_groups") is not None else None, - "categories": [Category.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, - "months": [MonthDetail.from_dict(_item) for _item in obj["months"]] if obj.get("months") is not None else None, - "transactions": [TransactionSummary.from_dict(_item) for _item in obj["transactions"]] if obj.get("transactions") is not None else None, - "subtransactions": [SubTransaction.from_dict(_item) for _item in obj["subtransactions"]] if obj.get("subtransactions") is not None else None, - "scheduled_transactions": [ScheduledTransactionSummary.from_dict(_item) for _item in obj["scheduled_transactions"]] if obj.get("scheduled_transactions") is not None else None, - "scheduled_subtransactions": [ScheduledSubTransaction.from_dict(_item) for _item in obj["scheduled_subtransactions"]] if obj.get("scheduled_subtransactions") is not None else None + "categories": [CategoryBase.from_dict(_item) for _item in obj["categories"]] if obj.get("categories") is not None else None, + "months": [MonthDetailBase.from_dict(_item) for _item in obj["months"]] if obj.get("months") is not None else None, + "transactions": [TransactionSummaryBase.from_dict(_item) for _item in obj["transactions"]] if obj.get("transactions") is not None else None, + "subtransactions": [SubTransactionBase.from_dict(_item) for _item in obj["subtransactions"]] if obj.get("subtransactions") is not None else None, + "scheduled_transactions": [ScheduledTransactionSummaryBase.from_dict(_item) for _item in obj["scheduled_transactions"]] if obj.get("scheduled_transactions") is not None else None, + "scheduled_subtransactions": [ScheduledSubTransactionBase.from_dict(_item) for _item in obj["scheduled_subtransactions"]] if obj.get("scheduled_subtransactions") is not None else None }) return _obj diff --git a/ynab/models/plan_detail_response.py b/ynab/models/plan_detail_response.py index 74f2443..207a210 100644 --- a/ynab/models/plan_detail_response.py +++ b/ynab/models/plan_detail_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.plan_detail_response_data import PlanDetailResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PlanDetailResponse(BaseModel): """ @@ -31,7 +32,8 @@ class PlanDetailResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/plan_detail_response_data.py b/ynab/models/plan_detail_response_data.py index 4604ac4..c95873e 100644 --- a/ynab/models/plan_detail_response_data.py +++ b/ynab/models/plan_detail_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.plan_detail import PlanDetail from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PlanDetailResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class PlanDetailResponseData(BaseModel): __properties: ClassVar[List[str]] = ["plan", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/plan_settings.py b/ynab/models/plan_settings.py index dfd886b..09f3fbb 100644 --- a/ynab/models/plan_settings.py +++ b/ynab/models/plan_settings.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -23,6 +23,7 @@ from ynab.models.date_format import DateFormat from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PlanSettings(BaseModel): """ @@ -33,7 +34,8 @@ class PlanSettings(BaseModel): __properties: ClassVar[List[str]] = ["date_format", "currency_format"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/plan_settings_response.py b/ynab/models/plan_settings_response.py index 2bfca10..7fd45a0 100644 --- a/ynab/models/plan_settings_response.py +++ b/ynab/models/plan_settings_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.plan_settings_response_data import PlanSettingsResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PlanSettingsResponse(BaseModel): """ @@ -31,7 +32,8 @@ class PlanSettingsResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/plan_settings_response_data.py b/ynab/models/plan_settings_response_data.py index 523e7c4..d1e5f4c 100644 --- a/ynab/models/plan_settings_response_data.py +++ b/ynab/models/plan_settings_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.plan_settings import PlanSettings from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PlanSettingsResponseData(BaseModel): """ @@ -31,7 +32,8 @@ class PlanSettingsResponseData(BaseModel): __properties: ClassVar[List[str]] = ["settings"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/plan_summary.py b/ynab/models/plan_summary.py index 34b58d0..09ac39c 100644 --- a/ynab/models/plan_summary.py +++ b/ynab/models/plan_summary.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -26,6 +26,7 @@ from ynab.models.date_format import DateFormat from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PlanSummary(BaseModel): """ @@ -42,7 +43,8 @@ class PlanSummary(BaseModel): __properties: ClassVar[List[str]] = ["id", "name", "last_modified_on", "first_month", "last_month", "date_format", "currency_format", "accounts"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/plan_summary_response.py b/ynab/models/plan_summary_response.py index 9bd3863..fefb7ce 100644 --- a/ynab/models/plan_summary_response.py +++ b/ynab/models/plan_summary_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.plan_summary_response_data import PlanSummaryResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PlanSummaryResponse(BaseModel): """ @@ -31,7 +32,8 @@ class PlanSummaryResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/plan_summary_response_data.py b/ynab/models/plan_summary_response_data.py index f62059f..b88a190 100644 --- a/ynab/models/plan_summary_response_data.py +++ b/ynab/models/plan_summary_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.plan_summary import PlanSummary from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PlanSummaryResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class PlanSummaryResponseData(BaseModel): __properties: ClassVar[List[str]] = ["plans", "default_plan"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/post_account_wrapper.py b/ynab/models/post_account_wrapper.py index 89cf86a..cc0b047 100644 --- a/ynab/models/post_account_wrapper.py +++ b/ynab/models/post_account_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_account import SaveAccount from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PostAccountWrapper(BaseModel): """ @@ -31,7 +32,8 @@ class PostAccountWrapper(BaseModel): __properties: ClassVar[List[str]] = ["account"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/post_category_group_wrapper.py b/ynab/models/post_category_group_wrapper.py index 1f46509..21ac68d 100644 --- a/ynab/models/post_category_group_wrapper.py +++ b/ynab/models/post_category_group_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_category_group import SaveCategoryGroup from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PostCategoryGroupWrapper(BaseModel): """ @@ -31,7 +32,8 @@ class PostCategoryGroupWrapper(BaseModel): __properties: ClassVar[List[str]] = ["category_group"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/post_category_wrapper.py b/ynab/models/post_category_wrapper.py index 220a1c0..edad5f9 100644 --- a/ynab/models/post_category_wrapper.py +++ b/ynab/models/post_category_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.new_category import NewCategory from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PostCategoryWrapper(BaseModel): """ @@ -31,7 +32,8 @@ class PostCategoryWrapper(BaseModel): __properties: ClassVar[List[str]] = ["category"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/post_payee.py b/ynab/models/post_payee.py new file mode 100644 index 0000000..3ed14eb --- /dev/null +++ b/ynab/models/post_payee.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PostPayee(BaseModel): + """ + PostPayee + """ # noqa: E501 + name: Annotated[str, Field(strict=True, max_length=500)] = Field(description="The name of the payee.") + __properties: ClassVar[List[str]] = ["name"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PostPayee from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PostPayee from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name") + }) + return _obj + + diff --git a/ynab/models/post_payee_wrapper.py b/ynab/models/post_payee_wrapper.py new file mode 100644 index 0000000..875daa3 --- /dev/null +++ b/ynab/models/post_payee_wrapper.py @@ -0,0 +1,92 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from ynab.models.post_payee import PostPayee +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class PostPayeeWrapper(BaseModel): + """ + PostPayeeWrapper + """ # noqa: E501 + payee: PostPayee + __properties: ClassVar[List[str]] = ["payee"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PostPayeeWrapper from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of payee + if self.payee: + _dict['payee'] = self.payee.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PostPayeeWrapper from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "payee": PostPayee.from_dict(obj["payee"]) if obj.get("payee") is not None else None + }) + return _obj + + diff --git a/ynab/models/post_scheduled_transaction_wrapper.py b/ynab/models/post_scheduled_transaction_wrapper.py index d78846e..09afad8 100644 --- a/ynab/models/post_scheduled_transaction_wrapper.py +++ b/ynab/models/post_scheduled_transaction_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_scheduled_transaction import SaveScheduledTransaction from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PostScheduledTransactionWrapper(BaseModel): """ @@ -31,7 +32,8 @@ class PostScheduledTransactionWrapper(BaseModel): __properties: ClassVar[List[str]] = ["scheduled_transaction"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/post_transactions_wrapper.py b/ynab/models/post_transactions_wrapper.py index 2497603..e22e969 100644 --- a/ynab/models/post_transactions_wrapper.py +++ b/ynab/models/post_transactions_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.new_transaction import NewTransaction from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PostTransactionsWrapper(BaseModel): """ @@ -32,7 +33,8 @@ class PostTransactionsWrapper(BaseModel): __properties: ClassVar[List[str]] = ["transaction", "transactions"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/put_scheduled_transaction_wrapper.py b/ynab/models/put_scheduled_transaction_wrapper.py index 415df33..ed940d3 100644 --- a/ynab/models/put_scheduled_transaction_wrapper.py +++ b/ynab/models/put_scheduled_transaction_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_scheduled_transaction import SaveScheduledTransaction from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PutScheduledTransactionWrapper(BaseModel): """ @@ -31,7 +32,8 @@ class PutScheduledTransactionWrapper(BaseModel): __properties: ClassVar[List[str]] = ["scheduled_transaction"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/put_transaction_wrapper.py b/ynab/models/put_transaction_wrapper.py index d3a4805..77df7f7 100644 --- a/ynab/models/put_transaction_wrapper.py +++ b/ynab/models/put_transaction_wrapper.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.existing_transaction import ExistingTransaction from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PutTransactionWrapper(BaseModel): """ @@ -31,7 +32,8 @@ class PutTransactionWrapper(BaseModel): __properties: ClassVar[List[str]] = ["transaction"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_account.py b/ynab/models/save_account.py index 1a28056..ab27604 100644 --- a/ynab/models/save_account.py +++ b/ynab/models/save_account.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,21 +19,23 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List -from ynab.models.account_type import AccountType +from ynab.models.save_account_type import SaveAccountType from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveAccount(BaseModel): """ SaveAccount """ # noqa: E501 name: StrictStr = Field(description="The name of the account") - type: AccountType + type: SaveAccountType balance: StrictInt = Field(description="The current balance of the account in milliunits format") __properties: ClassVar[List[str]] = ["name", "type", "balance"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_account_type.py b/ynab/models/save_account_type.py new file mode 100644 index 0000000..2726981 --- /dev/null +++ b/ynab/models/save_account_type.py @@ -0,0 +1,41 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class SaveAccountType(str, Enum): + """ + The type of account to create or update + """ + + """ + allowed enum values + """ + CHECKING = 'checking' + SAVINGS = 'savings' + CASH = 'cash' + CREDITCARD = 'creditCard' + OTHERASSET = 'otherAsset' + OTHERLIABILITY = 'otherLiability' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of SaveAccountType from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/ynab/models/save_category.py b/ynab/models/save_category.py index e307650..e46b503 100644 --- a/ynab/models/save_category.py +++ b/ynab/models/save_category.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,11 +18,12 @@ import json from datetime import date -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveCategory(BaseModel): """ @@ -31,12 +32,14 @@ class SaveCategory(BaseModel): name: Optional[StrictStr] = None note: Optional[StrictStr] = None category_group_id: Optional[UUID] = None - goal_target: Optional[StrictInt] = Field(default=None, description="The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly 'Needed for Spending' goal will be created for the category with this target amount.") + goal_target: Optional[StrictInt] = Field(default=None, description="The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED' or 'MF' for Credit Card Payment categories.") goal_target_date: Optional[date] = Field(default=None, description="The goal target date in ISO format (e.g. 2016-12-01).") - __properties: ClassVar[List[str]] = ["name", "note", "category_group_id", "goal_target", "goal_target_date"] + goal_needs_whole_amount: Optional[StrictBool] = Field(default=None, description="Whether the goal requires the full target amount each period. Only supported for 'NEED' goals. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'.") + __properties: ClassVar[List[str]] = ["name", "note", "category_group_id", "goal_target", "goal_target_date", "goal_needs_whole_amount"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -94,6 +96,11 @@ def to_dict(self) -> Dict[str, Any]: if self.goal_target_date is None and "goal_target_date" in self.model_fields_set: _dict['goal_target_date'] = None + # set to None if goal_needs_whole_amount (nullable) is None + # and model_fields_set contains the field + if self.goal_needs_whole_amount is None and "goal_needs_whole_amount" in self.model_fields_set: + _dict['goal_needs_whole_amount'] = None + return _dict @classmethod @@ -110,7 +117,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "note": obj.get("note"), "category_group_id": obj.get("category_group_id"), "goal_target": obj.get("goal_target"), - "goal_target_date": obj.get("goal_target_date") + "goal_target_date": obj.get("goal_target_date"), + "goal_needs_whole_amount": obj.get("goal_needs_whole_amount") }) return _obj diff --git a/ynab/models/save_category_group.py b/ynab/models/save_category_group.py index c305bf0..1205002 100644 --- a/ynab/models/save_category_group.py +++ b/ynab/models/save_category_group.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveCategoryGroup(BaseModel): """ @@ -31,7 +32,8 @@ class SaveCategoryGroup(BaseModel): __properties: ClassVar[List[str]] = ["name"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_category_group_response.py b/ynab/models/save_category_group_response.py index dcde649..c1480c3 100644 --- a/ynab/models/save_category_group_response.py +++ b/ynab/models/save_category_group_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_category_group_response_data import SaveCategoryGroupResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveCategoryGroupResponse(BaseModel): """ @@ -31,7 +32,8 @@ class SaveCategoryGroupResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_category_group_response_data.py b/ynab/models/save_category_group_response_data.py index 796e496..7f5072b 100644 --- a/ynab/models/save_category_group_response_data.py +++ b/ynab/models/save_category_group_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.category_group import CategoryGroup from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveCategoryGroupResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class SaveCategoryGroupResponseData(BaseModel): __properties: ClassVar[List[str]] = ["category_group", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_category_response.py b/ynab/models/save_category_response.py index ed01191..103849e 100644 --- a/ynab/models/save_category_response.py +++ b/ynab/models/save_category_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_category_response_data import SaveCategoryResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveCategoryResponse(BaseModel): """ @@ -31,7 +32,8 @@ class SaveCategoryResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_category_response_data.py b/ynab/models/save_category_response_data.py index fd6349d..249bb70 100644 --- a/ynab/models/save_category_response_data.py +++ b/ynab/models/save_category_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.category import Category from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveCategoryResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class SaveCategoryResponseData(BaseModel): __properties: ClassVar[List[str]] = ["category", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_month_category.py b/ynab/models/save_month_category.py index 95d7db2..0448660 100644 --- a/ynab/models/save_month_category.py +++ b/ynab/models/save_month_category.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveMonthCategory(BaseModel): """ @@ -30,7 +31,8 @@ class SaveMonthCategory(BaseModel): __properties: ClassVar[List[str]] = ["budgeted"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_payee.py b/ynab/models/save_payee.py index cc78ff1..391e8e0 100644 --- a/ynab/models/save_payee.py +++ b/ynab/models/save_payee.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,16 +22,18 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SavePayee(BaseModel): """ SavePayee """ # noqa: E501 - name: Optional[Annotated[str, Field(strict=True, max_length=500)]] = Field(default=None, description="The name of the payee. The name must be a maximum of 500 characters.") + name: Optional[Annotated[str, Field(strict=True, max_length=500)]] = Field(default=None, description="The name of the payee.") __properties: ClassVar[List[str]] = ["name"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_payee_response.py b/ynab/models/save_payee_response.py index 7ebdc42..6168737 100644 --- a/ynab/models/save_payee_response.py +++ b/ynab/models/save_payee_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_payee_response_data import SavePayeeResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SavePayeeResponse(BaseModel): """ @@ -31,7 +32,8 @@ class SavePayeeResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_payee_response_data.py b/ynab/models/save_payee_response_data.py index 7fca1bc..9363c15 100644 --- a/ynab/models/save_payee_response_data.py +++ b/ynab/models/save_payee_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.payee import Payee from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SavePayeeResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class SavePayeeResponseData(BaseModel): __properties: ClassVar[List[str]] = ["payee", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_scheduled_transaction.py b/ynab/models/save_scheduled_transaction.py index 14f8d30..f7da27d 100644 --- a/ynab/models/save_scheduled_transaction.py +++ b/ynab/models/save_scheduled_transaction.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -26,6 +26,7 @@ from ynab.models.transaction_flag_color import TransactionFlagColor from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveScheduledTransaction(BaseModel): """ @@ -43,7 +44,8 @@ class SaveScheduledTransaction(BaseModel): __properties: ClassVar[List[str]] = ["account_id", "date", "amount", "payee_id", "payee_name", "category_id", "memo", "flag_color", "frequency"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_sub_transaction.py b/ynab/models/save_sub_transaction.py index 9134886..97be599 100644 --- a/ynab/models/save_sub_transaction.py +++ b/ynab/models/save_sub_transaction.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -23,6 +23,7 @@ from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveSubTransaction(BaseModel): """ @@ -36,7 +37,8 @@ class SaveSubTransaction(BaseModel): __properties: ClassVar[List[str]] = ["amount", "payee_id", "payee_name", "category_id", "memo"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_transaction_with_id_or_import_id.py b/ynab/models/save_transaction_with_id_or_import_id.py index cbf2850..9aa2ea7 100644 --- a/ynab/models/save_transaction_with_id_or_import_id.py +++ b/ynab/models/save_transaction_with_id_or_import_id.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -27,6 +27,7 @@ from ynab.models.transaction_flag_color import TransactionFlagColor from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveTransactionWithIdOrImportId(BaseModel): """ @@ -48,7 +49,8 @@ class SaveTransactionWithIdOrImportId(BaseModel): __properties: ClassVar[List[str]] = ["account_id", "date", "amount", "payee_id", "payee_name", "category_id", "memo", "cleared", "approved", "flag_color", "subtransactions", "id", "import_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -60,8 +62,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_transaction_with_optional_fields.py b/ynab/models/save_transaction_with_optional_fields.py index ff476b5..3e53064 100644 --- a/ynab/models/save_transaction_with_optional_fields.py +++ b/ynab/models/save_transaction_with_optional_fields.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -27,6 +27,7 @@ from ynab.models.transaction_flag_color import TransactionFlagColor from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveTransactionWithOptionalFields(BaseModel): """ @@ -46,7 +47,8 @@ class SaveTransactionWithOptionalFields(BaseModel): __properties: ClassVar[List[str]] = ["account_id", "date", "amount", "payee_id", "payee_name", "category_id", "memo", "cleared", "approved", "flag_color", "subtransactions"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -58,8 +60,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_transactions_response.py b/ynab/models/save_transactions_response.py index db31db8..6af934a 100644 --- a/ynab/models/save_transactions_response.py +++ b/ynab/models/save_transactions_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.save_transactions_response_data import SaveTransactionsResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveTransactionsResponse(BaseModel): """ @@ -31,7 +32,8 @@ class SaveTransactionsResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/save_transactions_response_data.py b/ynab/models/save_transactions_response_data.py index 4f7c72e..077192b 100644 --- a/ynab/models/save_transactions_response_data.py +++ b/ynab/models/save_transactions_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.transaction_detail import TransactionDetail from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SaveTransactionsResponseData(BaseModel): """ @@ -35,7 +36,8 @@ class SaveTransactionsResponseData(BaseModel): __properties: ClassVar[List[str]] = ["transaction_ids", "transaction", "transactions", "duplicate_import_ids", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/scheduled_sub_transaction.py b/ynab/models/scheduled_sub_transaction.py index bc0b054..0c44892 100644 --- a/ynab/models/scheduled_sub_transaction.py +++ b/ynab/models/scheduled_sub_transaction.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -17,11 +17,12 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ScheduledSubTransaction(BaseModel): """ @@ -37,10 +38,13 @@ class ScheduledSubTransaction(BaseModel): category_name: Optional[StrictStr] = None transfer_account_id: Optional[UUID] = Field(default=None, description="If a transfer, the account_id which the scheduled subtransaction transfers to") deleted: StrictBool = Field(description="Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests.") - __properties: ClassVar[List[str]] = ["id", "scheduled_transaction_id", "amount", "memo", "payee_id", "payee_name", "category_id", "category_name", "transfer_account_id", "deleted"] + amount_formatted: Optional[StrictStr] = Field(default=None, description="The scheduled subtransaction amount formatted in the plan's currency format") + amount_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The scheduled subtransaction amount as a decimal currency amount") + __properties: ClassVar[List[str]] = ["id", "scheduled_transaction_id", "amount", "memo", "payee_id", "payee_name", "category_id", "category_name", "transfer_account_id", "deleted", "amount_formatted", "amount_currency"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,36 +81,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if memo (nullable) is None - # and model_fields_set contains the field - if self.memo is None and "memo" in self.model_fields_set: - _dict['memo'] = None - - # set to None if payee_id (nullable) is None - # and model_fields_set contains the field - if self.payee_id is None and "payee_id" in self.model_fields_set: - _dict['payee_id'] = None - - # set to None if payee_name (nullable) is None - # and model_fields_set contains the field - if self.payee_name is None and "payee_name" in self.model_fields_set: - _dict['payee_name'] = None - - # set to None if category_id (nullable) is None - # and model_fields_set contains the field - if self.category_id is None and "category_id" in self.model_fields_set: - _dict['category_id'] = None - - # set to None if category_name (nullable) is None - # and model_fields_set contains the field - if self.category_name is None and "category_name" in self.model_fields_set: - _dict['category_name'] = None - - # set to None if transfer_account_id (nullable) is None - # and model_fields_set contains the field - if self.transfer_account_id is None and "transfer_account_id" in self.model_fields_set: - _dict['transfer_account_id'] = None - return _dict @classmethod @@ -129,7 +102,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "category_id": obj.get("category_id"), "category_name": obj.get("category_name"), "transfer_account_id": obj.get("transfer_account_id"), - "deleted": obj.get("deleted") + "deleted": obj.get("deleted"), + "amount_formatted": obj.get("amount_formatted"), + "amount_currency": obj.get("amount_currency") }) return _obj diff --git a/ynab/models/scheduled_sub_transaction_base.py b/ynab/models/scheduled_sub_transaction_base.py new file mode 100644 index 0000000..ebc8c0c --- /dev/null +++ b/ynab/models/scheduled_sub_transaction_base.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScheduledSubTransactionBase(BaseModel): + """ + ScheduledSubTransactionBase + """ # noqa: E501 + id: UUID + scheduled_transaction_id: UUID + amount: StrictInt = Field(description="The scheduled subtransaction amount in milliunits format") + memo: Optional[StrictStr] = None + payee_id: Optional[UUID] = None + payee_name: Optional[StrictStr] = None + category_id: Optional[UUID] = None + category_name: Optional[StrictStr] = None + transfer_account_id: Optional[UUID] = Field(default=None, description="If a transfer, the account_id which the scheduled subtransaction transfers to") + deleted: StrictBool = Field(description="Whether or not the scheduled subtransaction has been deleted. Deleted scheduled subtransactions will only be included in delta requests.") + __properties: ClassVar[List[str]] = ["id", "scheduled_transaction_id", "amount", "memo", "payee_id", "payee_name", "category_id", "category_name", "transfer_account_id", "deleted"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScheduledSubTransactionBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if memo (nullable) is None + # and model_fields_set contains the field + if self.memo is None and "memo" in self.model_fields_set: + _dict['memo'] = None + + # set to None if payee_id (nullable) is None + # and model_fields_set contains the field + if self.payee_id is None and "payee_id" in self.model_fields_set: + _dict['payee_id'] = None + + # set to None if payee_name (nullable) is None + # and model_fields_set contains the field + if self.payee_name is None and "payee_name" in self.model_fields_set: + _dict['payee_name'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if category_name (nullable) is None + # and model_fields_set contains the field + if self.category_name is None and "category_name" in self.model_fields_set: + _dict['category_name'] = None + + # set to None if transfer_account_id (nullable) is None + # and model_fields_set contains the field + if self.transfer_account_id is None and "transfer_account_id" in self.model_fields_set: + _dict['transfer_account_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScheduledSubTransactionBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "scheduled_transaction_id": obj.get("scheduled_transaction_id"), + "amount": obj.get("amount"), + "memo": obj.get("memo"), + "payee_id": obj.get("payee_id"), + "payee_name": obj.get("payee_name"), + "category_id": obj.get("category_id"), + "category_name": obj.get("category_name"), + "transfer_account_id": obj.get("transfer_account_id"), + "deleted": obj.get("deleted") + }) + return _obj + + diff --git a/ynab/models/scheduled_transaction_detail.py b/ynab/models/scheduled_transaction_detail.py index ed52300..740d6e5 100644 --- a/ynab/models/scheduled_transaction_detail.py +++ b/ynab/models/scheduled_transaction_detail.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,13 +18,14 @@ import json from datetime import date -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from uuid import UUID from ynab.models.scheduled_sub_transaction import ScheduledSubTransaction from ynab.models.transaction_flag_color import TransactionFlagColor from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ScheduledTransactionDetail(BaseModel): """ @@ -43,11 +44,13 @@ class ScheduledTransactionDetail(BaseModel): category_id: Optional[UUID] = None transfer_account_id: Optional[UUID] = Field(default=None, description="If a transfer, the account_id which the scheduled transaction transfers to") deleted: StrictBool = Field(description="Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests.") + amount_formatted: Optional[StrictStr] = Field(default=None, description="The scheduled transaction amount formatted in the plan's currency format") + amount_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The scheduled transaction amount as a decimal currency amount") account_name: StrictStr payee_name: Optional[StrictStr] = None category_name: Optional[StrictStr] = Field(default=None, description="The name of the category. If a split scheduled transaction, this will be 'Split'.") subtransactions: List[ScheduledSubTransaction] = Field(description="If a split scheduled transaction, the subtransactions.") - __properties: ClassVar[List[str]] = ["id", "date_first", "date_next", "frequency", "amount", "memo", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "deleted", "account_name", "payee_name", "category_name", "subtransactions"] + __properties: ClassVar[List[str]] = ["id", "date_first", "date_next", "frequency", "amount", "memo", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "deleted", "amount_formatted", "amount_currency", "account_name", "payee_name", "category_name", "subtransactions"] @field_validator('frequency') def frequency_validate_enum(cls, value): @@ -57,7 +60,8 @@ def frequency_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -69,8 +73,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -142,6 +145,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "category_id": obj.get("category_id"), "transfer_account_id": obj.get("transfer_account_id"), "deleted": obj.get("deleted"), + "amount_formatted": obj.get("amount_formatted"), + "amount_currency": obj.get("amount_currency"), "account_name": obj.get("account_name"), "payee_name": obj.get("payee_name"), "category_name": obj.get("category_name"), diff --git a/ynab/models/scheduled_transaction_frequency.py b/ynab/models/scheduled_transaction_frequency.py index 3e37cc2..a03bafc 100644 --- a/ynab/models/scheduled_transaction_frequency.py +++ b/ynab/models/scheduled_transaction_frequency.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/models/scheduled_transaction_response.py b/ynab/models/scheduled_transaction_response.py index 03f6faa..0e819ee 100644 --- a/ynab/models/scheduled_transaction_response.py +++ b/ynab/models/scheduled_transaction_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.scheduled_transaction_response_data import ScheduledTransactionResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ScheduledTransactionResponse(BaseModel): """ @@ -31,7 +32,8 @@ class ScheduledTransactionResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/scheduled_transaction_response_data.py b/ynab/models/scheduled_transaction_response_data.py index 801f33b..e604527 100644 --- a/ynab/models/scheduled_transaction_response_data.py +++ b/ynab/models/scheduled_transaction_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.scheduled_transaction_detail import ScheduledTransactionDetail from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ScheduledTransactionResponseData(BaseModel): """ @@ -31,7 +32,8 @@ class ScheduledTransactionResponseData(BaseModel): __properties: ClassVar[List[str]] = ["scheduled_transaction"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/scheduled_transaction_summary.py b/ynab/models/scheduled_transaction_summary.py index ad75ffb..8705970 100644 --- a/ynab/models/scheduled_transaction_summary.py +++ b/ynab/models/scheduled_transaction_summary.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,12 +18,13 @@ import json from datetime import date -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from uuid import UUID from ynab.models.transaction_flag_color import TransactionFlagColor from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ScheduledTransactionSummary(BaseModel): """ @@ -42,7 +43,9 @@ class ScheduledTransactionSummary(BaseModel): category_id: Optional[UUID] = None transfer_account_id: Optional[UUID] = Field(default=None, description="If a transfer, the account_id which the scheduled transaction transfers to") deleted: StrictBool = Field(description="Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests.") - __properties: ClassVar[List[str]] = ["id", "date_first", "date_next", "frequency", "amount", "memo", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "deleted"] + amount_formatted: Optional[StrictStr] = Field(default=None, description="The scheduled transaction amount formatted in the plan's currency format") + amount_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The scheduled transaction amount as a decimal currency amount") + __properties: ClassVar[List[str]] = ["id", "date_first", "date_next", "frequency", "amount", "memo", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "deleted", "amount_formatted", "amount_currency"] @field_validator('frequency') def frequency_validate_enum(cls, value): @@ -52,7 +55,8 @@ def frequency_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -64,8 +68,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -90,36 +93,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if memo (nullable) is None - # and model_fields_set contains the field - if self.memo is None and "memo" in self.model_fields_set: - _dict['memo'] = None - # set to None if flag_color (nullable) is None # and model_fields_set contains the field if self.flag_color is None and "flag_color" in self.model_fields_set: _dict['flag_color'] = None - # set to None if flag_name (nullable) is None - # and model_fields_set contains the field - if self.flag_name is None and "flag_name" in self.model_fields_set: - _dict['flag_name'] = None - - # set to None if payee_id (nullable) is None - # and model_fields_set contains the field - if self.payee_id is None and "payee_id" in self.model_fields_set: - _dict['payee_id'] = None - - # set to None if category_id (nullable) is None - # and model_fields_set contains the field - if self.category_id is None and "category_id" in self.model_fields_set: - _dict['category_id'] = None - - # set to None if transfer_account_id (nullable) is None - # and model_fields_set contains the field - if self.transfer_account_id is None and "transfer_account_id" in self.model_fields_set: - _dict['transfer_account_id'] = None - return _dict @classmethod @@ -144,7 +122,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "payee_id": obj.get("payee_id"), "category_id": obj.get("category_id"), "transfer_account_id": obj.get("transfer_account_id"), - "deleted": obj.get("deleted") + "deleted": obj.get("deleted"), + "amount_formatted": obj.get("amount_formatted"), + "amount_currency": obj.get("amount_currency") }) return _obj diff --git a/ynab/models/scheduled_transaction_summary_base.py b/ynab/models/scheduled_transaction_summary_base.py new file mode 100644 index 0000000..6b325ba --- /dev/null +++ b/ynab/models/scheduled_transaction_summary_base.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from ynab.models.transaction_flag_color import TransactionFlagColor +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ScheduledTransactionSummaryBase(BaseModel): + """ + ScheduledTransactionSummaryBase + """ # noqa: E501 + id: UUID + date_first: date = Field(description="The first date for which the Scheduled Transaction was scheduled.") + date_next: date = Field(description="The next date for which the Scheduled Transaction is scheduled.") + frequency: StrictStr + amount: StrictInt = Field(description="The scheduled transaction amount in milliunits format") + memo: Optional[StrictStr] = None + flag_color: Optional[TransactionFlagColor] = None + flag_name: Optional[StrictStr] = Field(default=None, description="The customized name of a transaction flag") + account_id: UUID + payee_id: Optional[UUID] = None + category_id: Optional[UUID] = None + transfer_account_id: Optional[UUID] = Field(default=None, description="If a transfer, the account_id which the scheduled transaction transfers to") + deleted: StrictBool = Field(description="Whether or not the scheduled transaction has been deleted. Deleted scheduled transactions will only be included in delta requests.") + __properties: ClassVar[List[str]] = ["id", "date_first", "date_next", "frequency", "amount", "memo", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "deleted"] + + @field_validator('frequency') + def frequency_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['never', 'daily', 'weekly', 'everyOtherWeek', 'twiceAMonth', 'every4Weeks', 'monthly', 'everyOtherMonth', 'every3Months', 'every4Months', 'twiceAYear', 'yearly', 'everyOtherYear']): + raise ValueError("must be one of enum values ('never', 'daily', 'weekly', 'everyOtherWeek', 'twiceAMonth', 'every4Weeks', 'monthly', 'everyOtherMonth', 'every3Months', 'every4Months', 'twiceAYear', 'yearly', 'everyOtherYear')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ScheduledTransactionSummaryBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if memo (nullable) is None + # and model_fields_set contains the field + if self.memo is None and "memo" in self.model_fields_set: + _dict['memo'] = None + + # set to None if flag_color (nullable) is None + # and model_fields_set contains the field + if self.flag_color is None and "flag_color" in self.model_fields_set: + _dict['flag_color'] = None + + # set to None if flag_name (nullable) is None + # and model_fields_set contains the field + if self.flag_name is None and "flag_name" in self.model_fields_set: + _dict['flag_name'] = None + + # set to None if payee_id (nullable) is None + # and model_fields_set contains the field + if self.payee_id is None and "payee_id" in self.model_fields_set: + _dict['payee_id'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if transfer_account_id (nullable) is None + # and model_fields_set contains the field + if self.transfer_account_id is None and "transfer_account_id" in self.model_fields_set: + _dict['transfer_account_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ScheduledTransactionSummaryBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "date_first": obj.get("date_first"), + "date_next": obj.get("date_next"), + "frequency": obj.get("frequency"), + "amount": obj.get("amount"), + "memo": obj.get("memo"), + "flag_color": obj.get("flag_color"), + "flag_name": obj.get("flag_name"), + "account_id": obj.get("account_id"), + "payee_id": obj.get("payee_id"), + "category_id": obj.get("category_id"), + "transfer_account_id": obj.get("transfer_account_id"), + "deleted": obj.get("deleted") + }) + return _obj + + diff --git a/ynab/models/scheduled_transactions_response.py b/ynab/models/scheduled_transactions_response.py index 12715b2..2531111 100644 --- a/ynab/models/scheduled_transactions_response.py +++ b/ynab/models/scheduled_transactions_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.scheduled_transactions_response_data import ScheduledTransactionsResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ScheduledTransactionsResponse(BaseModel): """ @@ -31,7 +32,8 @@ class ScheduledTransactionsResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/scheduled_transactions_response_data.py b/ynab/models/scheduled_transactions_response_data.py index 88cbd15..bd6bfc9 100644 --- a/ynab/models/scheduled_transactions_response_data.py +++ b/ynab/models/scheduled_transactions_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.scheduled_transaction_detail import ScheduledTransactionDetail from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ScheduledTransactionsResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class ScheduledTransactionsResponseData(BaseModel): __properties: ClassVar[List[str]] = ["scheduled_transactions", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/sub_transaction.py b/ynab/models/sub_transaction.py index d473115..f18f9f5 100644 --- a/ynab/models/sub_transaction.py +++ b/ynab/models/sub_transaction.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -17,11 +17,12 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SubTransaction(BaseModel): """ @@ -38,10 +39,13 @@ class SubTransaction(BaseModel): transfer_account_id: Optional[UUID] = Field(default=None, description="If a transfer, the account_id which the subtransaction transfers to") transfer_transaction_id: Optional[StrictStr] = Field(default=None, description="If a transfer, the id of transaction on the other side of the transfer") deleted: StrictBool = Field(description="Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests.") - __properties: ClassVar[List[str]] = ["id", "transaction_id", "amount", "memo", "payee_id", "payee_name", "category_id", "category_name", "transfer_account_id", "transfer_transaction_id", "deleted"] + amount_formatted: Optional[StrictStr] = Field(default=None, description="The subtransaction amount formatted in the plan's currency format") + amount_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The subtransaction amount as a decimal currency amount") + __properties: ClassVar[List[str]] = ["id", "transaction_id", "amount", "memo", "payee_id", "payee_name", "category_id", "category_name", "transfer_account_id", "transfer_transaction_id", "deleted", "amount_formatted", "amount_currency"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +57,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -79,41 +82,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if memo (nullable) is None - # and model_fields_set contains the field - if self.memo is None and "memo" in self.model_fields_set: - _dict['memo'] = None - - # set to None if payee_id (nullable) is None - # and model_fields_set contains the field - if self.payee_id is None and "payee_id" in self.model_fields_set: - _dict['payee_id'] = None - - # set to None if payee_name (nullable) is None - # and model_fields_set contains the field - if self.payee_name is None and "payee_name" in self.model_fields_set: - _dict['payee_name'] = None - - # set to None if category_id (nullable) is None - # and model_fields_set contains the field - if self.category_id is None and "category_id" in self.model_fields_set: - _dict['category_id'] = None - - # set to None if category_name (nullable) is None - # and model_fields_set contains the field - if self.category_name is None and "category_name" in self.model_fields_set: - _dict['category_name'] = None - - # set to None if transfer_account_id (nullable) is None - # and model_fields_set contains the field - if self.transfer_account_id is None and "transfer_account_id" in self.model_fields_set: - _dict['transfer_account_id'] = None - - # set to None if transfer_transaction_id (nullable) is None - # and model_fields_set contains the field - if self.transfer_transaction_id is None and "transfer_transaction_id" in self.model_fields_set: - _dict['transfer_transaction_id'] = None - return _dict @classmethod @@ -136,7 +104,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "category_name": obj.get("category_name"), "transfer_account_id": obj.get("transfer_account_id"), "transfer_transaction_id": obj.get("transfer_transaction_id"), - "deleted": obj.get("deleted") + "deleted": obj.get("deleted"), + "amount_formatted": obj.get("amount_formatted"), + "amount_currency": obj.get("amount_currency") }) return _obj diff --git a/ynab/models/sub_transaction_base.py b/ynab/models/sub_transaction_base.py new file mode 100644 index 0000000..0185800 --- /dev/null +++ b/ynab/models/sub_transaction_base.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SubTransactionBase(BaseModel): + """ + SubTransactionBase + """ # noqa: E501 + id: StrictStr + transaction_id: StrictStr + amount: StrictInt = Field(description="The subtransaction amount in milliunits format") + memo: Optional[StrictStr] = None + payee_id: Optional[UUID] = None + payee_name: Optional[StrictStr] = None + category_id: Optional[UUID] = None + category_name: Optional[StrictStr] = None + transfer_account_id: Optional[UUID] = Field(default=None, description="If a transfer, the account_id which the subtransaction transfers to") + transfer_transaction_id: Optional[StrictStr] = Field(default=None, description="If a transfer, the id of transaction on the other side of the transfer") + deleted: StrictBool = Field(description="Whether or not the subtransaction has been deleted. Deleted subtransactions will only be included in delta requests.") + __properties: ClassVar[List[str]] = ["id", "transaction_id", "amount", "memo", "payee_id", "payee_name", "category_id", "category_name", "transfer_account_id", "transfer_transaction_id", "deleted"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SubTransactionBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if memo (nullable) is None + # and model_fields_set contains the field + if self.memo is None and "memo" in self.model_fields_set: + _dict['memo'] = None + + # set to None if payee_id (nullable) is None + # and model_fields_set contains the field + if self.payee_id is None and "payee_id" in self.model_fields_set: + _dict['payee_id'] = None + + # set to None if payee_name (nullable) is None + # and model_fields_set contains the field + if self.payee_name is None and "payee_name" in self.model_fields_set: + _dict['payee_name'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if category_name (nullable) is None + # and model_fields_set contains the field + if self.category_name is None and "category_name" in self.model_fields_set: + _dict['category_name'] = None + + # set to None if transfer_account_id (nullable) is None + # and model_fields_set contains the field + if self.transfer_account_id is None and "transfer_account_id" in self.model_fields_set: + _dict['transfer_account_id'] = None + + # set to None if transfer_transaction_id (nullable) is None + # and model_fields_set contains the field + if self.transfer_transaction_id is None and "transfer_transaction_id" in self.model_fields_set: + _dict['transfer_transaction_id'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SubTransactionBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "transaction_id": obj.get("transaction_id"), + "amount": obj.get("amount"), + "memo": obj.get("memo"), + "payee_id": obj.get("payee_id"), + "payee_name": obj.get("payee_name"), + "category_id": obj.get("category_id"), + "category_name": obj.get("category_name"), + "transfer_account_id": obj.get("transfer_account_id"), + "transfer_transaction_id": obj.get("transfer_transaction_id"), + "deleted": obj.get("deleted") + }) + return _obj + + diff --git a/ynab/models/transaction_cleared_status.py b/ynab/models/transaction_cleared_status.py index 6957b17..9a2d34c 100644 --- a/ynab/models/transaction_cleared_status.py +++ b/ynab/models/transaction_cleared_status.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/models/transaction_detail.py b/ynab/models/transaction_detail.py index 1fa4ec8..fbde1e5 100644 --- a/ynab/models/transaction_detail.py +++ b/ynab/models/transaction_detail.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,14 +18,15 @@ import json from datetime import date -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from uuid import UUID from ynab.models.sub_transaction import SubTransaction from ynab.models.transaction_cleared_status import TransactionClearedStatus from ynab.models.transaction_flag_color import TransactionFlagColor from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransactionDetail(BaseModel): """ @@ -50,11 +51,13 @@ class TransactionDetail(BaseModel): import_payee_name_original: Optional[StrictStr] = Field(default=None, description="If the transaction was imported, the original payee name as it appeared on the statement") debt_transaction_type: Optional[StrictStr] = Field(default=None, description="If the transaction is a debt/loan account transaction, the type of transaction") deleted: StrictBool = Field(description="Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.") + amount_formatted: Optional[StrictStr] = Field(default=None, description="The transaction amount formatted in the plan's currency format") + amount_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The transaction amount as a decimal currency amount") account_name: StrictStr payee_name: Optional[StrictStr] = None category_name: Optional[StrictStr] = Field(default=None, description="The name of the category. If a split transaction, this will be 'Split'.") subtransactions: List[SubTransaction] = Field(description="If a split transaction, the subtransactions.") - __properties: ClassVar[List[str]] = ["id", "date", "amount", "memo", "cleared", "approved", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "transfer_transaction_id", "matched_transaction_id", "import_id", "import_payee_name", "import_payee_name_original", "debt_transaction_type", "deleted", "account_name", "payee_name", "category_name", "subtransactions"] + __properties: ClassVar[List[str]] = ["id", "date", "amount", "memo", "cleared", "approved", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "transfer_transaction_id", "matched_transaction_id", "import_id", "import_payee_name", "import_payee_name_original", "debt_transaction_type", "deleted", "amount_formatted", "amount_currency", "account_name", "payee_name", "category_name", "subtransactions"] @field_validator('debt_transaction_type') def debt_transaction_type_validate_enum(cls, value): @@ -67,7 +70,8 @@ def debt_transaction_type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -79,8 +83,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -163,6 +166,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "import_payee_name_original": obj.get("import_payee_name_original"), "debt_transaction_type": obj.get("debt_transaction_type"), "deleted": obj.get("deleted"), + "amount_formatted": obj.get("amount_formatted"), + "amount_currency": obj.get("amount_currency"), "account_name": obj.get("account_name"), "payee_name": obj.get("payee_name"), "category_name": obj.get("category_name"), diff --git a/ynab/models/transaction_flag_color.py b/ynab/models/transaction_flag_color.py index e25dd25..1f80974 100644 --- a/ynab/models/transaction_flag_color.py +++ b/ynab/models/transaction_flag_color.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/ynab/models/transaction_response.py b/ynab/models/transaction_response.py index 8078dc4..bac5d33 100644 --- a/ynab/models/transaction_response.py +++ b/ynab/models/transaction_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.transaction_response_data import TransactionResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransactionResponse(BaseModel): """ @@ -31,7 +32,8 @@ class TransactionResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/transaction_response_data.py b/ynab/models/transaction_response_data.py index 99f1f65..8072aa5 100644 --- a/ynab/models/transaction_response_data.py +++ b/ynab/models/transaction_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.transaction_detail import TransactionDetail from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransactionResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class TransactionResponseData(BaseModel): __properties: ClassVar[List[str]] = ["transaction", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/transaction_summary.py b/ynab/models/transaction_summary.py index 71dfe95..e4ccbc7 100644 --- a/ynab/models/transaction_summary.py +++ b/ynab/models/transaction_summary.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,13 +18,14 @@ import json from datetime import date -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from uuid import UUID from ynab.models.transaction_cleared_status import TransactionClearedStatus from ynab.models.transaction_flag_color import TransactionFlagColor from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransactionSummary(BaseModel): """ @@ -49,7 +50,9 @@ class TransactionSummary(BaseModel): import_payee_name_original: Optional[StrictStr] = Field(default=None, description="If the transaction was imported, the original payee name as it appeared on the statement") debt_transaction_type: Optional[StrictStr] = Field(default=None, description="If the transaction is a debt/loan account transaction, the type of transaction") deleted: StrictBool = Field(description="Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.") - __properties: ClassVar[List[str]] = ["id", "date", "amount", "memo", "cleared", "approved", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "transfer_transaction_id", "matched_transaction_id", "import_id", "import_payee_name", "import_payee_name_original", "debt_transaction_type", "deleted"] + amount_formatted: Optional[StrictStr] = Field(default=None, description="The transaction amount formatted in the plan's currency format") + amount_currency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The transaction amount as a decimal currency amount") + __properties: ClassVar[List[str]] = ["id", "date", "amount", "memo", "cleared", "approved", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "transfer_transaction_id", "matched_transaction_id", "import_id", "import_payee_name", "import_payee_name_original", "debt_transaction_type", "deleted", "amount_formatted", "amount_currency"] @field_validator('debt_transaction_type') def debt_transaction_type_validate_enum(cls, value): @@ -62,7 +65,8 @@ def debt_transaction_type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -74,8 +78,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -100,61 +103,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if memo (nullable) is None - # and model_fields_set contains the field - if self.memo is None and "memo" in self.model_fields_set: - _dict['memo'] = None - # set to None if flag_color (nullable) is None # and model_fields_set contains the field if self.flag_color is None and "flag_color" in self.model_fields_set: _dict['flag_color'] = None - # set to None if flag_name (nullable) is None - # and model_fields_set contains the field - if self.flag_name is None and "flag_name" in self.model_fields_set: - _dict['flag_name'] = None - - # set to None if payee_id (nullable) is None - # and model_fields_set contains the field - if self.payee_id is None and "payee_id" in self.model_fields_set: - _dict['payee_id'] = None - - # set to None if category_id (nullable) is None - # and model_fields_set contains the field - if self.category_id is None and "category_id" in self.model_fields_set: - _dict['category_id'] = None - - # set to None if transfer_account_id (nullable) is None - # and model_fields_set contains the field - if self.transfer_account_id is None and "transfer_account_id" in self.model_fields_set: - _dict['transfer_account_id'] = None - - # set to None if transfer_transaction_id (nullable) is None - # and model_fields_set contains the field - if self.transfer_transaction_id is None and "transfer_transaction_id" in self.model_fields_set: - _dict['transfer_transaction_id'] = None - - # set to None if matched_transaction_id (nullable) is None - # and model_fields_set contains the field - if self.matched_transaction_id is None and "matched_transaction_id" in self.model_fields_set: - _dict['matched_transaction_id'] = None - - # set to None if import_id (nullable) is None - # and model_fields_set contains the field - if self.import_id is None and "import_id" in self.model_fields_set: - _dict['import_id'] = None - - # set to None if import_payee_name (nullable) is None - # and model_fields_set contains the field - if self.import_payee_name is None and "import_payee_name" in self.model_fields_set: - _dict['import_payee_name'] = None - - # set to None if import_payee_name_original (nullable) is None - # and model_fields_set contains the field - if self.import_payee_name_original is None and "import_payee_name_original" in self.model_fields_set: - _dict['import_payee_name_original'] = None - # set to None if debt_transaction_type (nullable) is None # and model_fields_set contains the field if self.debt_transaction_type is None and "debt_transaction_type" in self.model_fields_set: @@ -190,7 +143,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "import_payee_name": obj.get("import_payee_name"), "import_payee_name_original": obj.get("import_payee_name_original"), "debt_transaction_type": obj.get("debt_transaction_type"), - "deleted": obj.get("deleted") + "deleted": obj.get("deleted"), + "amount_formatted": obj.get("amount_formatted"), + "amount_currency": obj.get("amount_currency") }) return _obj diff --git a/ynab/models/transaction_summary_base.py b/ynab/models/transaction_summary_base.py new file mode 100644 index 0000000..5d87992 --- /dev/null +++ b/ynab/models/transaction_summary_base.py @@ -0,0 +1,198 @@ +# coding: utf-8 + +""" + YNAB API Endpoints + + Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com + + The version of the OpenAPI document: 1.83.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import date +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from uuid import UUID +from ynab.models.transaction_cleared_status import TransactionClearedStatus +from ynab.models.transaction_flag_color import TransactionFlagColor +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TransactionSummaryBase(BaseModel): + """ + TransactionSummaryBase + """ # noqa: E501 + id: StrictStr + var_date: date = Field(description="The transaction date in ISO format (e.g. 2016-12-01)", alias="date") + amount: StrictInt = Field(description="The transaction amount in milliunits format") + memo: Optional[StrictStr] = None + cleared: TransactionClearedStatus + approved: StrictBool = Field(description="Whether or not the transaction is approved") + flag_color: Optional[TransactionFlagColor] = None + flag_name: Optional[StrictStr] = Field(default=None, description="The customized name of a transaction flag") + account_id: UUID + payee_id: Optional[UUID] = None + category_id: Optional[UUID] = None + transfer_account_id: Optional[UUID] = Field(default=None, description="If a transfer transaction, the account to which it transfers") + transfer_transaction_id: Optional[StrictStr] = Field(default=None, description="If a transfer transaction, the id of transaction on the other side of the transfer") + matched_transaction_id: Optional[StrictStr] = Field(default=None, description="If transaction is matched, the id of the matched transaction") + import_id: Optional[StrictStr] = Field(default=None, description="If the transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'.") + import_payee_name: Optional[StrictStr] = Field(default=None, description="If the transaction was imported, the payee name that was used when importing and before applying any payee rename rules") + import_payee_name_original: Optional[StrictStr] = Field(default=None, description="If the transaction was imported, the original payee name as it appeared on the statement") + debt_transaction_type: Optional[StrictStr] = Field(default=None, description="If the transaction is a debt/loan account transaction, the type of transaction") + deleted: StrictBool = Field(description="Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests.") + __properties: ClassVar[List[str]] = ["id", "date", "amount", "memo", "cleared", "approved", "flag_color", "flag_name", "account_id", "payee_id", "category_id", "transfer_account_id", "transfer_transaction_id", "matched_transaction_id", "import_id", "import_payee_name", "import_payee_name_original", "debt_transaction_type", "deleted"] + + @field_validator('debt_transaction_type') + def debt_transaction_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['payment', 'refund', 'fee', 'interest', 'escrow', 'balanceAdjustment', 'credit', 'charge']): + raise ValueError("must be one of enum values ('payment', 'refund', 'fee', 'interest', 'escrow', 'balanceAdjustment', 'credit', 'charge')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TransactionSummaryBase from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if memo (nullable) is None + # and model_fields_set contains the field + if self.memo is None and "memo" in self.model_fields_set: + _dict['memo'] = None + + # set to None if flag_color (nullable) is None + # and model_fields_set contains the field + if self.flag_color is None and "flag_color" in self.model_fields_set: + _dict['flag_color'] = None + + # set to None if flag_name (nullable) is None + # and model_fields_set contains the field + if self.flag_name is None and "flag_name" in self.model_fields_set: + _dict['flag_name'] = None + + # set to None if payee_id (nullable) is None + # and model_fields_set contains the field + if self.payee_id is None and "payee_id" in self.model_fields_set: + _dict['payee_id'] = None + + # set to None if category_id (nullable) is None + # and model_fields_set contains the field + if self.category_id is None and "category_id" in self.model_fields_set: + _dict['category_id'] = None + + # set to None if transfer_account_id (nullable) is None + # and model_fields_set contains the field + if self.transfer_account_id is None and "transfer_account_id" in self.model_fields_set: + _dict['transfer_account_id'] = None + + # set to None if transfer_transaction_id (nullable) is None + # and model_fields_set contains the field + if self.transfer_transaction_id is None and "transfer_transaction_id" in self.model_fields_set: + _dict['transfer_transaction_id'] = None + + # set to None if matched_transaction_id (nullable) is None + # and model_fields_set contains the field + if self.matched_transaction_id is None and "matched_transaction_id" in self.model_fields_set: + _dict['matched_transaction_id'] = None + + # set to None if import_id (nullable) is None + # and model_fields_set contains the field + if self.import_id is None and "import_id" in self.model_fields_set: + _dict['import_id'] = None + + # set to None if import_payee_name (nullable) is None + # and model_fields_set contains the field + if self.import_payee_name is None and "import_payee_name" in self.model_fields_set: + _dict['import_payee_name'] = None + + # set to None if import_payee_name_original (nullable) is None + # and model_fields_set contains the field + if self.import_payee_name_original is None and "import_payee_name_original" in self.model_fields_set: + _dict['import_payee_name_original'] = None + + # set to None if debt_transaction_type (nullable) is None + # and model_fields_set contains the field + if self.debt_transaction_type is None and "debt_transaction_type" in self.model_fields_set: + _dict['debt_transaction_type'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TransactionSummaryBase from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "date": obj.get("date"), + "amount": obj.get("amount"), + "memo": obj.get("memo"), + "cleared": obj.get("cleared"), + "approved": obj.get("approved"), + "flag_color": obj.get("flag_color"), + "flag_name": obj.get("flag_name"), + "account_id": obj.get("account_id"), + "payee_id": obj.get("payee_id"), + "category_id": obj.get("category_id"), + "transfer_account_id": obj.get("transfer_account_id"), + "transfer_transaction_id": obj.get("transfer_transaction_id"), + "matched_transaction_id": obj.get("matched_transaction_id"), + "import_id": obj.get("import_id"), + "import_payee_name": obj.get("import_payee_name"), + "import_payee_name_original": obj.get("import_payee_name_original"), + "debt_transaction_type": obj.get("debt_transaction_type"), + "deleted": obj.get("deleted") + }) + return _obj + + diff --git a/ynab/models/transactions_import_response.py b/ynab/models/transactions_import_response.py index 753ad68..e0773da 100644 --- a/ynab/models/transactions_import_response.py +++ b/ynab/models/transactions_import_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.transactions_import_response_data import TransactionsImportResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransactionsImportResponse(BaseModel): """ @@ -31,7 +32,8 @@ class TransactionsImportResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/transactions_import_response_data.py b/ynab/models/transactions_import_response_data.py index c06d612..6c5b0b0 100644 --- a/ynab/models/transactions_import_response_data.py +++ b/ynab/models/transactions_import_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransactionsImportResponseData(BaseModel): """ @@ -30,7 +31,8 @@ class TransactionsImportResponseData(BaseModel): __properties: ClassVar[List[str]] = ["transaction_ids"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -42,8 +44,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/transactions_response.py b/ynab/models/transactions_response.py index f7cc0fa..5812211 100644 --- a/ynab/models/transactions_response.py +++ b/ynab/models/transactions_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.transactions_response_data import TransactionsResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransactionsResponse(BaseModel): """ @@ -31,7 +32,8 @@ class TransactionsResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/transactions_response_data.py b/ynab/models/transactions_response_data.py index d674c0d..3b31c19 100644 --- a/ynab/models/transactions_response_data.py +++ b/ynab/models/transactions_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.transaction_detail import TransactionDetail from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransactionsResponseData(BaseModel): """ @@ -32,7 +33,8 @@ class TransactionsResponseData(BaseModel): __properties: ClassVar[List[str]] = ["transactions", "server_knowledge"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/user.py b/ynab/models/user.py index 27b9fce..1fa309b 100644 --- a/ynab/models/user.py +++ b/ynab/models/user.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from uuid import UUID from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class User(BaseModel): """ @@ -31,7 +32,8 @@ class User(BaseModel): __properties: ClassVar[List[str]] = ["id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/user_response.py b/ynab/models/user_response.py index 64f6bcb..4461de9 100644 --- a/ynab/models/user_response.py +++ b/ynab/models/user_response.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.user_response_data import UserResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class UserResponse(BaseModel): """ @@ -31,7 +32,8 @@ class UserResponse(BaseModel): __properties: ClassVar[List[str]] = ["data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/models/user_response_data.py b/ynab/models/user_response_data.py index 5f1b010..08669ac 100644 --- a/ynab/models/user_response_data.py +++ b/ynab/models/user_response_data.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -22,6 +22,7 @@ from ynab.models.user import User from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class UserResponseData(BaseModel): """ @@ -31,7 +32,8 @@ class UserResponseData(BaseModel): __properties: ClassVar[List[str]] = ["user"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/ynab/rest.py b/ynab/rest.py index 736143a..e2855eb 100644 --- a/ynab/rest.py +++ b/ynab/rest.py @@ -5,7 +5,7 @@ Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com - The version of the OpenAPI document: 1.79.0 + The version of the OpenAPI document: 1.83.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually.