ynab-cli 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ynab_cli/__init__.py +0 -0
- ynab_cli/adapters/__init__.py +0 -0
- ynab_cli/adapters/rich/__init__.py +0 -0
- ynab_cli/adapters/rich/io.py +38 -0
- ynab_cli/adapters/textual/__init__.py +0 -0
- ynab_cli/adapters/textual/io.py +62 -0
- ynab_cli/adapters/ynab/__init__.py +8 -0
- ynab_cli/adapters/ynab/api/__init__.py +1 -0
- ynab_cli/adapters/ynab/api/accounts/__init__.py +1 -0
- ynab_cli/adapters/ynab/api/accounts/create_account.py +186 -0
- ynab_cli/adapters/ynab/api/accounts/get_account_by_id.py +177 -0
- ynab_cli/adapters/ynab/api/accounts/get_accounts.py +184 -0
- ynab_cli/adapters/ynab/api/budgets/__init__.py +1 -0
- ynab_cli/adapters/ynab/api/budgets/get_budget_by_id.py +188 -0
- ynab_cli/adapters/ynab/api/budgets/get_budget_settings_by_id.py +163 -0
- ynab_cli/adapters/ynab/api/budgets/get_budgets.py +171 -0
- ynab_cli/adapters/ynab/api/categories/__init__.py +1 -0
- ynab_cli/adapters/ynab/api/categories/get_categories.py +188 -0
- ynab_cli/adapters/ynab/api/categories/get_category_by_id.py +180 -0
- ynab_cli/adapters/ynab/api/categories/get_month_category_by_id.py +194 -0
- ynab_cli/adapters/ynab/api/categories/update_category.py +199 -0
- ynab_cli/adapters/ynab/api/categories/update_month_category.py +213 -0
- ynab_cli/adapters/ynab/api/months/__init__.py +1 -0
- ynab_cli/adapters/ynab/api/months/get_budget_month.py +177 -0
- ynab_cli/adapters/ynab/api/months/get_budget_months.py +184 -0
- ynab_cli/adapters/ynab/api/payee_locations/__init__.py +1 -0
- ynab_cli/adapters/ynab/api/payee_locations/get_payee_location_by_id.py +176 -0
- ynab_cli/adapters/ynab/api/payee_locations/get_payee_locations.py +163 -0
- ynab_cli/adapters/ynab/api/payee_locations/get_payee_locations_by_payee.py +176 -0
- ynab_cli/adapters/ynab/api/payees/__init__.py +1 -0
- ynab_cli/adapters/ynab/api/payees/get_payee_by_id.py +176 -0
- ynab_cli/adapters/ynab/api/payees/get_payees.py +184 -0
- ynab_cli/adapters/ynab/api/payees/update_payee.py +199 -0
- ynab_cli/adapters/ynab/api/scheduled_transactions/__init__.py +1 -0
- ynab_cli/adapters/ynab/api/scheduled_transactions/create_scheduled_transaction.py +186 -0
- ynab_cli/adapters/ynab/api/scheduled_transactions/delete_scheduled_transaction.py +176 -0
- ynab_cli/adapters/ynab/api/scheduled_transactions/get_scheduled_transaction_by_id.py +176 -0
- ynab_cli/adapters/ynab/api/scheduled_transactions/get_scheduled_transactions.py +184 -0
- ynab_cli/adapters/ynab/api/scheduled_transactions/update_scheduled_transaction.py +199 -0
- ynab_cli/adapters/ynab/api/transactions/__init__.py +1 -0
- ynab_cli/adapters/ynab/api/transactions/create_transaction.py +202 -0
- ynab_cli/adapters/ynab/api/transactions/delete_transaction.py +176 -0
- ynab_cli/adapters/ynab/api/transactions/get_transaction_by_id.py +176 -0
- ynab_cli/adapters/ynab/api/transactions/get_transactions.py +227 -0
- ynab_cli/adapters/ynab/api/transactions/get_transactions_by_account.py +236 -0
- ynab_cli/adapters/ynab/api/transactions/get_transactions_by_category.py +236 -0
- ynab_cli/adapters/ynab/api/transactions/get_transactions_by_month.py +236 -0
- ynab_cli/adapters/ynab/api/transactions/get_transactions_by_payee.py +236 -0
- ynab_cli/adapters/ynab/api/transactions/import_transactions.py +183 -0
- ynab_cli/adapters/ynab/api/transactions/update_transaction.py +199 -0
- ynab_cli/adapters/ynab/api/transactions/update_transactions.py +177 -0
- ynab_cli/adapters/ynab/api/user/__init__.py +1 -0
- ynab_cli/adapters/ynab/api/user/get_user.py +130 -0
- ynab_cli/adapters/ynab/client.py +268 -0
- ynab_cli/adapters/ynab/errors.py +16 -0
- ynab_cli/adapters/ynab/models/__init__.py +229 -0
- ynab_cli/adapters/ynab/models/account.py +345 -0
- ynab_cli/adapters/ynab/models/account_response.py +65 -0
- ynab_cli/adapters/ynab/models/account_response_data.py +65 -0
- ynab_cli/adapters/ynab/models/account_type.py +23 -0
- ynab_cli/adapters/ynab/models/accounts_response.py +65 -0
- ynab_cli/adapters/ynab/models/accounts_response_data.py +81 -0
- ynab_cli/adapters/ynab/models/budget_detail.py +405 -0
- ynab_cli/adapters/ynab/models/budget_detail_response.py +65 -0
- ynab_cli/adapters/ynab/models/budget_detail_response_data.py +73 -0
- ynab_cli/adapters/ynab/models/budget_settings.py +115 -0
- ynab_cli/adapters/ynab/models/budget_settings_response.py +65 -0
- ynab_cli/adapters/ynab/models/budget_settings_response_data.py +65 -0
- ynab_cli/adapters/ynab/models/budget_summary.py +216 -0
- ynab_cli/adapters/ynab/models/budget_summary_response.py +65 -0
- ynab_cli/adapters/ynab/models/budget_summary_response_data.py +91 -0
- ynab_cli/adapters/ynab/models/bulk_response.py +65 -0
- ynab_cli/adapters/ynab/models/bulk_response_data.py +65 -0
- ynab_cli/adapters/ynab/models/bulk_response_data_bulk.py +68 -0
- ynab_cli/adapters/ynab/models/bulk_transactions.py +75 -0
- ynab_cli/adapters/ynab/models/categories_response.py +65 -0
- ynab_cli/adapters/ynab/models/categories_response_data.py +81 -0
- ynab_cli/adapters/ynab/models/category.py +519 -0
- ynab_cli/adapters/ynab/models/category_goal_type_type_1.py +15 -0
- ynab_cli/adapters/ynab/models/category_goal_type_type_2_type_1.py +15 -0
- ynab_cli/adapters/ynab/models/category_goal_type_type_3_type_1.py +15 -0
- ynab_cli/adapters/ynab/models/category_group.py +85 -0
- ynab_cli/adapters/ynab/models/category_group_with_categories.py +108 -0
- ynab_cli/adapters/ynab/models/category_response.py +65 -0
- ynab_cli/adapters/ynab/models/category_response_data.py +65 -0
- ynab_cli/adapters/ynab/models/currency_format_type_0.py +117 -0
- ynab_cli/adapters/ynab/models/date_format_type_0.py +61 -0
- ynab_cli/adapters/ynab/models/error_detail.py +75 -0
- ynab_cli/adapters/ynab/models/error_response.py +65 -0
- ynab_cli/adapters/ynab/models/existing_transaction.py +322 -0
- ynab_cli/adapters/ynab/models/get_transactions_by_account_type.py +12 -0
- ynab_cli/adapters/ynab/models/get_transactions_by_category_type.py +12 -0
- ynab_cli/adapters/ynab/models/get_transactions_by_month_type.py +12 -0
- ynab_cli/adapters/ynab/models/get_transactions_by_payee_type.py +12 -0
- ynab_cli/adapters/ynab/models/get_transactions_type.py +12 -0
- ynab_cli/adapters/ynab/models/hybrid_transaction.py +567 -0
- ynab_cli/adapters/ynab/models/hybrid_transaction_type.py +12 -0
- ynab_cli/adapters/ynab/models/hybrid_transactions_response.py +65 -0
- ynab_cli/adapters/ynab/models/hybrid_transactions_response_data.py +84 -0
- ynab_cli/adapters/ynab/models/loan_account_periodic_value_type_0.py +44 -0
- ynab_cli/adapters/ynab/models/month_detail.py +168 -0
- ynab_cli/adapters/ynab/models/month_detail_response.py +65 -0
- ynab_cli/adapters/ynab/models/month_detail_response_data.py +65 -0
- ynab_cli/adapters/ynab/models/month_summaries_response.py +65 -0
- ynab_cli/adapters/ynab/models/month_summaries_response_data.py +81 -0
- ynab_cli/adapters/ynab/models/month_summary.py +145 -0
- ynab_cli/adapters/ynab/models/new_transaction.py +352 -0
- ynab_cli/adapters/ynab/models/patch_category_wrapper.py +65 -0
- ynab_cli/adapters/ynab/models/patch_month_category_wrapper.py +65 -0
- ynab_cli/adapters/ynab/models/patch_payee_wrapper.py +65 -0
- ynab_cli/adapters/ynab/models/patch_transactions_wrapper.py +73 -0
- ynab_cli/adapters/ynab/models/payee.py +100 -0
- ynab_cli/adapters/ynab/models/payee_location.py +93 -0
- ynab_cli/adapters/ynab/models/payee_location_response.py +65 -0
- ynab_cli/adapters/ynab/models/payee_location_response_data.py +65 -0
- ynab_cli/adapters/ynab/models/payee_locations_response.py +65 -0
- ynab_cli/adapters/ynab/models/payee_locations_response_data.py +73 -0
- ynab_cli/adapters/ynab/models/payee_response.py +65 -0
- ynab_cli/adapters/ynab/models/payee_response_data.py +65 -0
- ynab_cli/adapters/ynab/models/payees_response.py +65 -0
- ynab_cli/adapters/ynab/models/payees_response_data.py +81 -0
- ynab_cli/adapters/ynab/models/post_account_wrapper.py +65 -0
- ynab_cli/adapters/ynab/models/post_scheduled_transaction_wrapper.py +65 -0
- ynab_cli/adapters/ynab/models/post_transactions_wrapper.py +91 -0
- ynab_cli/adapters/ynab/models/put_scheduled_transaction_wrapper.py +65 -0
- ynab_cli/adapters/ynab/models/put_transaction_wrapper.py +65 -0
- ynab_cli/adapters/ynab/models/save_account.py +77 -0
- ynab_cli/adapters/ynab/models/save_category.py +129 -0
- ynab_cli/adapters/ynab/models/save_category_response.py +65 -0
- ynab_cli/adapters/ynab/models/save_category_response_data.py +73 -0
- ynab_cli/adapters/ynab/models/save_month_category.py +59 -0
- ynab_cli/adapters/ynab/models/save_payee.py +59 -0
- ynab_cli/adapters/ynab/models/save_payee_response.py +65 -0
- ynab_cli/adapters/ynab/models/save_payee_response_data.py +73 -0
- ynab_cli/adapters/ynab/models/save_scheduled_transaction.py +269 -0
- ynab_cli/adapters/ynab/models/save_sub_transaction.py +166 -0
- ynab_cli/adapters/ynab/models/save_transaction_with_id_or_import_id.py +366 -0
- ynab_cli/adapters/ynab/models/save_transaction_with_optional_fields.py +322 -0
- ynab_cli/adapters/ynab/models/save_transactions_response.py +65 -0
- ynab_cli/adapters/ynab/models/save_transactions_response_data.py +123 -0
- ynab_cli/adapters/ynab/models/scheduled_sub_transaction.py +238 -0
- ynab_cli/adapters/ynab/models/scheduled_transaction_detail.py +381 -0
- ynab_cli/adapters/ynab/models/scheduled_transaction_frequency.py +23 -0
- ynab_cli/adapters/ynab/models/scheduled_transaction_response.py +65 -0
- ynab_cli/adapters/ynab/models/scheduled_transaction_response_data.py +65 -0
- ynab_cli/adapters/ynab/models/scheduled_transaction_summary.py +310 -0
- ynab_cli/adapters/ynab/models/scheduled_transaction_summary_frequency.py +23 -0
- ynab_cli/adapters/ynab/models/scheduled_transactions_response.py +65 -0
- ynab_cli/adapters/ynab/models/scheduled_transactions_response_data.py +81 -0
- ynab_cli/adapters/ynab/models/sub_transaction.py +259 -0
- ynab_cli/adapters/ynab/models/transaction_cleared_status.py +13 -0
- ynab_cli/adapters/ynab/models/transaction_detail.py +570 -0
- ynab_cli/adapters/ynab/models/transaction_flag_color_type_1.py +16 -0
- ynab_cli/adapters/ynab/models/transaction_flag_color_type_2_type_1.py +16 -0
- ynab_cli/adapters/ynab/models/transaction_flag_color_type_3_type_1.py +16 -0
- ynab_cli/adapters/ynab/models/transaction_response.py +65 -0
- ynab_cli/adapters/ynab/models/transaction_response_data.py +65 -0
- ynab_cli/adapters/ynab/models/transaction_summary.py +499 -0
- ynab_cli/adapters/ynab/models/transaction_summary_debt_transaction_type_type_1.py +18 -0
- ynab_cli/adapters/ynab/models/transaction_summary_debt_transaction_type_type_2_type_1.py +18 -0
- ynab_cli/adapters/ynab/models/transaction_summary_debt_transaction_type_type_3_type_1.py +18 -0
- ynab_cli/adapters/ynab/models/transactions_import_response.py +65 -0
- ynab_cli/adapters/ynab/models/transactions_import_response_data.py +59 -0
- ynab_cli/adapters/ynab/models/transactions_response.py +65 -0
- ynab_cli/adapters/ynab/models/transactions_response_data.py +81 -0
- ynab_cli/adapters/ynab/models/user.py +60 -0
- ynab_cli/adapters/ynab/models/user_response.py +65 -0
- ynab_cli/adapters/ynab/models/user_response_data.py +65 -0
- ynab_cli/adapters/ynab/types.py +46 -0
- ynab_cli/adapters/ynab/util.py +78 -0
- ynab_cli/domain/__init__.py +0 -0
- ynab_cli/domain/constants.py +3 -0
- ynab_cli/domain/models/__init__.py +0 -0
- ynab_cli/domain/models/rules.py +37 -0
- ynab_cli/domain/ports/__init__.py +5 -0
- ynab_cli/domain/ports/io.py +63 -0
- ynab_cli/domain/settings.py +16 -0
- ynab_cli/domain/use_cases/__init__.py +0 -0
- ynab_cli/domain/use_cases/categories.py +105 -0
- ynab_cli/domain/use_cases/payees.py +232 -0
- ynab_cli/domain/use_cases/transactions.py +93 -0
- ynab_cli/host/__init__.py +14 -0
- ynab_cli/host/cli.py +37 -0
- ynab_cli/host/click/__init__.py +0 -0
- ynab_cli/host/click/cli.py +44 -0
- ynab_cli/host/click/commands/__init__.py +0 -0
- ynab_cli/host/click/commands/categories.py +92 -0
- ynab_cli/host/click/commands/payees.py +157 -0
- ynab_cli/host/click/commands/rich/__init__.py +0 -0
- ynab_cli/host/click/commands/rich/progress_table.py +37 -0
- ynab_cli/host/click/commands/transactions.py +76 -0
- ynab_cli/host/constants.py +3 -0
- ynab_cli/host/textual/__init__.py +0 -0
- ynab_cli/host/textual/app.py +98 -0
- ynab_cli/host/textual/app.tcss +47 -0
- ynab_cli/host/textual/cli.py +42 -0
- ynab_cli/host/textual/widgets/__init__.py +58 -0
- ynab_cli/host/textual/widgets/categories.py +90 -0
- ynab_cli/host/textual/widgets/payees.py +154 -0
- ynab_cli/host/textual/widgets/transactions.py +89 -0
- ynab_cli/py.typed +0 -0
- ynab_cli-0.3.0.dist-info/METADATA +102 -0
- ynab_cli-0.3.0.dist-info/RECORD +206 -0
- ynab_cli-0.3.0.dist-info/WHEEL +4 -0
- ynab_cli-0.3.0.dist-info/entry_points.txt +2 -0
- ynab_cli-0.3.0.dist-info/licenses/LICENSE.md +21 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from collections.abc import Mapping
|
|
3
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
from dateutil.parser import isoparse
|
|
9
|
+
|
|
10
|
+
from ynab_cli.adapters.ynab.types import UNSET, Unset
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from ynab_cli.adapters.ynab.models.account import Account
|
|
14
|
+
from ynab_cli.adapters.ynab.models.category import Category
|
|
15
|
+
from ynab_cli.adapters.ynab.models.category_group import CategoryGroup
|
|
16
|
+
from ynab_cli.adapters.ynab.models.currency_format_type_0 import CurrencyFormatType0
|
|
17
|
+
from ynab_cli.adapters.ynab.models.date_format_type_0 import DateFormatType0
|
|
18
|
+
from ynab_cli.adapters.ynab.models.month_detail import MonthDetail
|
|
19
|
+
from ynab_cli.adapters.ynab.models.payee import Payee
|
|
20
|
+
from ynab_cli.adapters.ynab.models.payee_location import PayeeLocation
|
|
21
|
+
from ynab_cli.adapters.ynab.models.scheduled_sub_transaction import ScheduledSubTransaction
|
|
22
|
+
from ynab_cli.adapters.ynab.models.scheduled_transaction_summary import ScheduledTransactionSummary
|
|
23
|
+
from ynab_cli.adapters.ynab.models.sub_transaction import SubTransaction
|
|
24
|
+
from ynab_cli.adapters.ynab.models.transaction_summary import TransactionSummary
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
T = TypeVar("T", bound="BudgetDetail")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@_attrs_define
|
|
31
|
+
class BudgetDetail:
|
|
32
|
+
"""
|
|
33
|
+
Attributes:
|
|
34
|
+
id (UUID):
|
|
35
|
+
name (str):
|
|
36
|
+
last_modified_on (Union[Unset, datetime.datetime]): The last time any changes were made to the budget from
|
|
37
|
+
either a web or mobile client
|
|
38
|
+
first_month (Union[Unset, datetime.date]): The earliest budget month
|
|
39
|
+
last_month (Union[Unset, datetime.date]): The latest budget month
|
|
40
|
+
date_format (Union['DateFormatType0', None, Unset]): The date format setting for the budget. In some cases the
|
|
41
|
+
format will not be available and will be specified as null.
|
|
42
|
+
currency_format (Union['CurrencyFormatType0', None, Unset]): The currency format setting for the budget. In
|
|
43
|
+
some cases the format will not be available and will be specified as null.
|
|
44
|
+
accounts (Union[Unset, list['Account']]): The budget accounts (only included if `include_accounts=true`
|
|
45
|
+
specified as query parameter)
|
|
46
|
+
payees (Union[Unset, list['Payee']]):
|
|
47
|
+
payee_locations (Union[Unset, list['PayeeLocation']]):
|
|
48
|
+
category_groups (Union[Unset, list['CategoryGroup']]):
|
|
49
|
+
categories (Union[Unset, list['Category']]):
|
|
50
|
+
months (Union[Unset, list['MonthDetail']]):
|
|
51
|
+
transactions (Union[Unset, list['TransactionSummary']]):
|
|
52
|
+
subtransactions (Union[Unset, list['SubTransaction']]):
|
|
53
|
+
scheduled_transactions (Union[Unset, list['ScheduledTransactionSummary']]):
|
|
54
|
+
scheduled_subtransactions (Union[Unset, list['ScheduledSubTransaction']]):
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
id: UUID
|
|
58
|
+
name: str
|
|
59
|
+
last_modified_on: Unset | datetime.datetime = UNSET
|
|
60
|
+
first_month: Unset | datetime.date = UNSET
|
|
61
|
+
last_month: Unset | datetime.date = UNSET
|
|
62
|
+
date_format: Union["DateFormatType0", None, Unset] = UNSET
|
|
63
|
+
currency_format: Union["CurrencyFormatType0", None, Unset] = UNSET
|
|
64
|
+
accounts: Unset | list["Account"] = UNSET
|
|
65
|
+
payees: Unset | list["Payee"] = UNSET
|
|
66
|
+
payee_locations: Unset | list["PayeeLocation"] = UNSET
|
|
67
|
+
category_groups: Unset | list["CategoryGroup"] = UNSET
|
|
68
|
+
categories: Unset | list["Category"] = UNSET
|
|
69
|
+
months: Unset | list["MonthDetail"] = UNSET
|
|
70
|
+
transactions: Unset | list["TransactionSummary"] = UNSET
|
|
71
|
+
subtransactions: Unset | list["SubTransaction"] = UNSET
|
|
72
|
+
scheduled_transactions: Unset | list["ScheduledTransactionSummary"] = UNSET
|
|
73
|
+
scheduled_subtransactions: Unset | list["ScheduledSubTransaction"] = UNSET
|
|
74
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
75
|
+
|
|
76
|
+
def to_dict(self) -> dict[str, Any]:
|
|
77
|
+
from ynab_cli.adapters.ynab.models.currency_format_type_0 import CurrencyFormatType0
|
|
78
|
+
from ynab_cli.adapters.ynab.models.date_format_type_0 import DateFormatType0
|
|
79
|
+
|
|
80
|
+
id = str(self.id)
|
|
81
|
+
|
|
82
|
+
name = self.name
|
|
83
|
+
|
|
84
|
+
last_modified_on: Unset | str = UNSET
|
|
85
|
+
if not isinstance(self.last_modified_on, Unset):
|
|
86
|
+
last_modified_on = self.last_modified_on.isoformat()
|
|
87
|
+
|
|
88
|
+
first_month: Unset | str = UNSET
|
|
89
|
+
if not isinstance(self.first_month, Unset):
|
|
90
|
+
first_month = self.first_month.isoformat()
|
|
91
|
+
|
|
92
|
+
last_month: Unset | str = UNSET
|
|
93
|
+
if not isinstance(self.last_month, Unset):
|
|
94
|
+
last_month = self.last_month.isoformat()
|
|
95
|
+
|
|
96
|
+
date_format: None | Unset | dict[str, Any]
|
|
97
|
+
if isinstance(self.date_format, Unset):
|
|
98
|
+
date_format = UNSET
|
|
99
|
+
elif isinstance(self.date_format, DateFormatType0):
|
|
100
|
+
date_format = self.date_format.to_dict()
|
|
101
|
+
else:
|
|
102
|
+
date_format = self.date_format
|
|
103
|
+
|
|
104
|
+
currency_format: None | Unset | dict[str, Any]
|
|
105
|
+
if isinstance(self.currency_format, Unset):
|
|
106
|
+
currency_format = UNSET
|
|
107
|
+
elif isinstance(self.currency_format, CurrencyFormatType0):
|
|
108
|
+
currency_format = self.currency_format.to_dict()
|
|
109
|
+
else:
|
|
110
|
+
currency_format = self.currency_format
|
|
111
|
+
|
|
112
|
+
accounts: Unset | list[dict[str, Any]] = UNSET
|
|
113
|
+
if not isinstance(self.accounts, Unset):
|
|
114
|
+
accounts = []
|
|
115
|
+
for accounts_item_data in self.accounts:
|
|
116
|
+
accounts_item = accounts_item_data.to_dict()
|
|
117
|
+
accounts.append(accounts_item)
|
|
118
|
+
|
|
119
|
+
payees: Unset | list[dict[str, Any]] = UNSET
|
|
120
|
+
if not isinstance(self.payees, Unset):
|
|
121
|
+
payees = []
|
|
122
|
+
for payees_item_data in self.payees:
|
|
123
|
+
payees_item = payees_item_data.to_dict()
|
|
124
|
+
payees.append(payees_item)
|
|
125
|
+
|
|
126
|
+
payee_locations: Unset | list[dict[str, Any]] = UNSET
|
|
127
|
+
if not isinstance(self.payee_locations, Unset):
|
|
128
|
+
payee_locations = []
|
|
129
|
+
for payee_locations_item_data in self.payee_locations:
|
|
130
|
+
payee_locations_item = payee_locations_item_data.to_dict()
|
|
131
|
+
payee_locations.append(payee_locations_item)
|
|
132
|
+
|
|
133
|
+
category_groups: Unset | list[dict[str, Any]] = UNSET
|
|
134
|
+
if not isinstance(self.category_groups, Unset):
|
|
135
|
+
category_groups = []
|
|
136
|
+
for category_groups_item_data in self.category_groups:
|
|
137
|
+
category_groups_item = category_groups_item_data.to_dict()
|
|
138
|
+
category_groups.append(category_groups_item)
|
|
139
|
+
|
|
140
|
+
categories: Unset | list[dict[str, Any]] = UNSET
|
|
141
|
+
if not isinstance(self.categories, Unset):
|
|
142
|
+
categories = []
|
|
143
|
+
for categories_item_data in self.categories:
|
|
144
|
+
categories_item = categories_item_data.to_dict()
|
|
145
|
+
categories.append(categories_item)
|
|
146
|
+
|
|
147
|
+
months: Unset | list[dict[str, Any]] = UNSET
|
|
148
|
+
if not isinstance(self.months, Unset):
|
|
149
|
+
months = []
|
|
150
|
+
for months_item_data in self.months:
|
|
151
|
+
months_item = months_item_data.to_dict()
|
|
152
|
+
months.append(months_item)
|
|
153
|
+
|
|
154
|
+
transactions: Unset | list[dict[str, Any]] = UNSET
|
|
155
|
+
if not isinstance(self.transactions, Unset):
|
|
156
|
+
transactions = []
|
|
157
|
+
for transactions_item_data in self.transactions:
|
|
158
|
+
transactions_item = transactions_item_data.to_dict()
|
|
159
|
+
transactions.append(transactions_item)
|
|
160
|
+
|
|
161
|
+
subtransactions: Unset | list[dict[str, Any]] = UNSET
|
|
162
|
+
if not isinstance(self.subtransactions, Unset):
|
|
163
|
+
subtransactions = []
|
|
164
|
+
for subtransactions_item_data in self.subtransactions:
|
|
165
|
+
subtransactions_item = subtransactions_item_data.to_dict()
|
|
166
|
+
subtransactions.append(subtransactions_item)
|
|
167
|
+
|
|
168
|
+
scheduled_transactions: Unset | list[dict[str, Any]] = UNSET
|
|
169
|
+
if not isinstance(self.scheduled_transactions, Unset):
|
|
170
|
+
scheduled_transactions = []
|
|
171
|
+
for scheduled_transactions_item_data in self.scheduled_transactions:
|
|
172
|
+
scheduled_transactions_item = scheduled_transactions_item_data.to_dict()
|
|
173
|
+
scheduled_transactions.append(scheduled_transactions_item)
|
|
174
|
+
|
|
175
|
+
scheduled_subtransactions: Unset | list[dict[str, Any]] = UNSET
|
|
176
|
+
if not isinstance(self.scheduled_subtransactions, Unset):
|
|
177
|
+
scheduled_subtransactions = []
|
|
178
|
+
for scheduled_subtransactions_item_data in self.scheduled_subtransactions:
|
|
179
|
+
scheduled_subtransactions_item = scheduled_subtransactions_item_data.to_dict()
|
|
180
|
+
scheduled_subtransactions.append(scheduled_subtransactions_item)
|
|
181
|
+
|
|
182
|
+
field_dict: dict[str, Any] = {}
|
|
183
|
+
field_dict.update(self.additional_properties)
|
|
184
|
+
field_dict.update(
|
|
185
|
+
{
|
|
186
|
+
"id": id,
|
|
187
|
+
"name": name,
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
if last_modified_on is not UNSET:
|
|
191
|
+
field_dict["last_modified_on"] = last_modified_on
|
|
192
|
+
if first_month is not UNSET:
|
|
193
|
+
field_dict["first_month"] = first_month
|
|
194
|
+
if last_month is not UNSET:
|
|
195
|
+
field_dict["last_month"] = last_month
|
|
196
|
+
if date_format is not UNSET:
|
|
197
|
+
field_dict["date_format"] = date_format
|
|
198
|
+
if currency_format is not UNSET:
|
|
199
|
+
field_dict["currency_format"] = currency_format
|
|
200
|
+
if accounts is not UNSET:
|
|
201
|
+
field_dict["accounts"] = accounts
|
|
202
|
+
if payees is not UNSET:
|
|
203
|
+
field_dict["payees"] = payees
|
|
204
|
+
if payee_locations is not UNSET:
|
|
205
|
+
field_dict["payee_locations"] = payee_locations
|
|
206
|
+
if category_groups is not UNSET:
|
|
207
|
+
field_dict["category_groups"] = category_groups
|
|
208
|
+
if categories is not UNSET:
|
|
209
|
+
field_dict["categories"] = categories
|
|
210
|
+
if months is not UNSET:
|
|
211
|
+
field_dict["months"] = months
|
|
212
|
+
if transactions is not UNSET:
|
|
213
|
+
field_dict["transactions"] = transactions
|
|
214
|
+
if subtransactions is not UNSET:
|
|
215
|
+
field_dict["subtransactions"] = subtransactions
|
|
216
|
+
if scheduled_transactions is not UNSET:
|
|
217
|
+
field_dict["scheduled_transactions"] = scheduled_transactions
|
|
218
|
+
if scheduled_subtransactions is not UNSET:
|
|
219
|
+
field_dict["scheduled_subtransactions"] = scheduled_subtransactions
|
|
220
|
+
|
|
221
|
+
return field_dict
|
|
222
|
+
|
|
223
|
+
@classmethod
|
|
224
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
225
|
+
from ynab_cli.adapters.ynab.models.account import Account
|
|
226
|
+
from ynab_cli.adapters.ynab.models.category import Category
|
|
227
|
+
from ynab_cli.adapters.ynab.models.category_group import CategoryGroup
|
|
228
|
+
from ynab_cli.adapters.ynab.models.currency_format_type_0 import CurrencyFormatType0
|
|
229
|
+
from ynab_cli.adapters.ynab.models.date_format_type_0 import DateFormatType0
|
|
230
|
+
from ynab_cli.adapters.ynab.models.month_detail import MonthDetail
|
|
231
|
+
from ynab_cli.adapters.ynab.models.payee import Payee
|
|
232
|
+
from ynab_cli.adapters.ynab.models.payee_location import PayeeLocation
|
|
233
|
+
from ynab_cli.adapters.ynab.models.scheduled_sub_transaction import ScheduledSubTransaction
|
|
234
|
+
from ynab_cli.adapters.ynab.models.scheduled_transaction_summary import ScheduledTransactionSummary
|
|
235
|
+
from ynab_cli.adapters.ynab.models.sub_transaction import SubTransaction
|
|
236
|
+
from ynab_cli.adapters.ynab.models.transaction_summary import TransactionSummary
|
|
237
|
+
|
|
238
|
+
d = dict(src_dict)
|
|
239
|
+
id = UUID(d.pop("id"))
|
|
240
|
+
|
|
241
|
+
name = d.pop("name")
|
|
242
|
+
|
|
243
|
+
_last_modified_on = d.pop("last_modified_on", UNSET)
|
|
244
|
+
last_modified_on: Unset | datetime.datetime
|
|
245
|
+
if isinstance(_last_modified_on, Unset):
|
|
246
|
+
last_modified_on = UNSET
|
|
247
|
+
else:
|
|
248
|
+
last_modified_on = isoparse(_last_modified_on)
|
|
249
|
+
|
|
250
|
+
_first_month = d.pop("first_month", UNSET)
|
|
251
|
+
first_month: Unset | datetime.date
|
|
252
|
+
if isinstance(_first_month, Unset):
|
|
253
|
+
first_month = UNSET
|
|
254
|
+
else:
|
|
255
|
+
first_month = isoparse(_first_month).date()
|
|
256
|
+
|
|
257
|
+
_last_month = d.pop("last_month", UNSET)
|
|
258
|
+
last_month: Unset | datetime.date
|
|
259
|
+
if isinstance(_last_month, Unset):
|
|
260
|
+
last_month = UNSET
|
|
261
|
+
else:
|
|
262
|
+
last_month = isoparse(_last_month).date()
|
|
263
|
+
|
|
264
|
+
def _parse_date_format(data: object) -> Union["DateFormatType0", None, Unset]:
|
|
265
|
+
if data is None:
|
|
266
|
+
return data
|
|
267
|
+
if isinstance(data, Unset):
|
|
268
|
+
return data
|
|
269
|
+
try:
|
|
270
|
+
if not isinstance(data, dict):
|
|
271
|
+
raise TypeError()
|
|
272
|
+
componentsschemas_date_format_type_0 = DateFormatType0.from_dict(data)
|
|
273
|
+
|
|
274
|
+
return componentsschemas_date_format_type_0
|
|
275
|
+
except: # noqa: E722
|
|
276
|
+
pass
|
|
277
|
+
return cast(Union["DateFormatType0", None, Unset], data)
|
|
278
|
+
|
|
279
|
+
date_format = _parse_date_format(d.pop("date_format", UNSET))
|
|
280
|
+
|
|
281
|
+
def _parse_currency_format(data: object) -> Union["CurrencyFormatType0", None, Unset]:
|
|
282
|
+
if data is None:
|
|
283
|
+
return data
|
|
284
|
+
if isinstance(data, Unset):
|
|
285
|
+
return data
|
|
286
|
+
try:
|
|
287
|
+
if not isinstance(data, dict):
|
|
288
|
+
raise TypeError()
|
|
289
|
+
componentsschemas_currency_format_type_0 = CurrencyFormatType0.from_dict(data)
|
|
290
|
+
|
|
291
|
+
return componentsschemas_currency_format_type_0
|
|
292
|
+
except: # noqa: E722
|
|
293
|
+
pass
|
|
294
|
+
return cast(Union["CurrencyFormatType0", None, Unset], data)
|
|
295
|
+
|
|
296
|
+
currency_format = _parse_currency_format(d.pop("currency_format", UNSET))
|
|
297
|
+
|
|
298
|
+
accounts = []
|
|
299
|
+
_accounts = d.pop("accounts", UNSET)
|
|
300
|
+
for accounts_item_data in _accounts or []:
|
|
301
|
+
accounts_item = Account.from_dict(accounts_item_data)
|
|
302
|
+
|
|
303
|
+
accounts.append(accounts_item)
|
|
304
|
+
|
|
305
|
+
payees = []
|
|
306
|
+
_payees = d.pop("payees", UNSET)
|
|
307
|
+
for payees_item_data in _payees or []:
|
|
308
|
+
payees_item = Payee.from_dict(payees_item_data)
|
|
309
|
+
|
|
310
|
+
payees.append(payees_item)
|
|
311
|
+
|
|
312
|
+
payee_locations = []
|
|
313
|
+
_payee_locations = d.pop("payee_locations", UNSET)
|
|
314
|
+
for payee_locations_item_data in _payee_locations or []:
|
|
315
|
+
payee_locations_item = PayeeLocation.from_dict(payee_locations_item_data)
|
|
316
|
+
|
|
317
|
+
payee_locations.append(payee_locations_item)
|
|
318
|
+
|
|
319
|
+
category_groups = []
|
|
320
|
+
_category_groups = d.pop("category_groups", UNSET)
|
|
321
|
+
for category_groups_item_data in _category_groups or []:
|
|
322
|
+
category_groups_item = CategoryGroup.from_dict(category_groups_item_data)
|
|
323
|
+
|
|
324
|
+
category_groups.append(category_groups_item)
|
|
325
|
+
|
|
326
|
+
categories = []
|
|
327
|
+
_categories = d.pop("categories", UNSET)
|
|
328
|
+
for categories_item_data in _categories or []:
|
|
329
|
+
categories_item = Category.from_dict(categories_item_data)
|
|
330
|
+
|
|
331
|
+
categories.append(categories_item)
|
|
332
|
+
|
|
333
|
+
months = []
|
|
334
|
+
_months = d.pop("months", UNSET)
|
|
335
|
+
for months_item_data in _months or []:
|
|
336
|
+
months_item = MonthDetail.from_dict(months_item_data)
|
|
337
|
+
|
|
338
|
+
months.append(months_item)
|
|
339
|
+
|
|
340
|
+
transactions = []
|
|
341
|
+
_transactions = d.pop("transactions", UNSET)
|
|
342
|
+
for transactions_item_data in _transactions or []:
|
|
343
|
+
transactions_item = TransactionSummary.from_dict(transactions_item_data)
|
|
344
|
+
|
|
345
|
+
transactions.append(transactions_item)
|
|
346
|
+
|
|
347
|
+
subtransactions = []
|
|
348
|
+
_subtransactions = d.pop("subtransactions", UNSET)
|
|
349
|
+
for subtransactions_item_data in _subtransactions or []:
|
|
350
|
+
subtransactions_item = SubTransaction.from_dict(subtransactions_item_data)
|
|
351
|
+
|
|
352
|
+
subtransactions.append(subtransactions_item)
|
|
353
|
+
|
|
354
|
+
scheduled_transactions = []
|
|
355
|
+
_scheduled_transactions = d.pop("scheduled_transactions", UNSET)
|
|
356
|
+
for scheduled_transactions_item_data in _scheduled_transactions or []:
|
|
357
|
+
scheduled_transactions_item = ScheduledTransactionSummary.from_dict(scheduled_transactions_item_data)
|
|
358
|
+
|
|
359
|
+
scheduled_transactions.append(scheduled_transactions_item)
|
|
360
|
+
|
|
361
|
+
scheduled_subtransactions = []
|
|
362
|
+
_scheduled_subtransactions = d.pop("scheduled_subtransactions", UNSET)
|
|
363
|
+
for scheduled_subtransactions_item_data in _scheduled_subtransactions or []:
|
|
364
|
+
scheduled_subtransactions_item = ScheduledSubTransaction.from_dict(scheduled_subtransactions_item_data)
|
|
365
|
+
|
|
366
|
+
scheduled_subtransactions.append(scheduled_subtransactions_item)
|
|
367
|
+
|
|
368
|
+
budget_detail = cls(
|
|
369
|
+
id=id,
|
|
370
|
+
name=name,
|
|
371
|
+
last_modified_on=last_modified_on,
|
|
372
|
+
first_month=first_month,
|
|
373
|
+
last_month=last_month,
|
|
374
|
+
date_format=date_format,
|
|
375
|
+
currency_format=currency_format,
|
|
376
|
+
accounts=accounts,
|
|
377
|
+
payees=payees,
|
|
378
|
+
payee_locations=payee_locations,
|
|
379
|
+
category_groups=category_groups,
|
|
380
|
+
categories=categories,
|
|
381
|
+
months=months,
|
|
382
|
+
transactions=transactions,
|
|
383
|
+
subtransactions=subtransactions,
|
|
384
|
+
scheduled_transactions=scheduled_transactions,
|
|
385
|
+
scheduled_subtransactions=scheduled_subtransactions,
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
budget_detail.additional_properties = d
|
|
389
|
+
return budget_detail
|
|
390
|
+
|
|
391
|
+
@property
|
|
392
|
+
def additional_keys(self) -> list[str]:
|
|
393
|
+
return list(self.additional_properties.keys())
|
|
394
|
+
|
|
395
|
+
def __getitem__(self, key: str) -> Any:
|
|
396
|
+
return self.additional_properties[key]
|
|
397
|
+
|
|
398
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
399
|
+
self.additional_properties[key] = value
|
|
400
|
+
|
|
401
|
+
def __delitem__(self, key: str) -> None:
|
|
402
|
+
del self.additional_properties[key]
|
|
403
|
+
|
|
404
|
+
def __contains__(self, key: str) -> bool:
|
|
405
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from ynab_cli.adapters.ynab.models.budget_detail_response_data import BudgetDetailResponseData
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T", bound="BudgetDetailResponse")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class BudgetDetailResponse:
|
|
16
|
+
"""
|
|
17
|
+
Attributes:
|
|
18
|
+
data (BudgetDetailResponseData):
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
data: "BudgetDetailResponseData"
|
|
22
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
23
|
+
|
|
24
|
+
def to_dict(self) -> dict[str, Any]:
|
|
25
|
+
data = self.data.to_dict()
|
|
26
|
+
|
|
27
|
+
field_dict: dict[str, Any] = {}
|
|
28
|
+
field_dict.update(self.additional_properties)
|
|
29
|
+
field_dict.update(
|
|
30
|
+
{
|
|
31
|
+
"data": data,
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return field_dict
|
|
36
|
+
|
|
37
|
+
@classmethod
|
|
38
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
39
|
+
from ynab_cli.adapters.ynab.models.budget_detail_response_data import BudgetDetailResponseData
|
|
40
|
+
|
|
41
|
+
d = dict(src_dict)
|
|
42
|
+
data = BudgetDetailResponseData.from_dict(d.pop("data"))
|
|
43
|
+
|
|
44
|
+
budget_detail_response = cls(
|
|
45
|
+
data=data,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
budget_detail_response.additional_properties = d
|
|
49
|
+
return budget_detail_response
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def additional_keys(self) -> list[str]:
|
|
53
|
+
return list(self.additional_properties.keys())
|
|
54
|
+
|
|
55
|
+
def __getitem__(self, key: str) -> Any:
|
|
56
|
+
return self.additional_properties[key]
|
|
57
|
+
|
|
58
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
59
|
+
self.additional_properties[key] = value
|
|
60
|
+
|
|
61
|
+
def __delitem__(self, key: str) -> None:
|
|
62
|
+
del self.additional_properties[key]
|
|
63
|
+
|
|
64
|
+
def __contains__(self, key: str) -> bool:
|
|
65
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from ynab_cli.adapters.ynab.models.budget_detail import BudgetDetail
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T", bound="BudgetDetailResponseData")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class BudgetDetailResponseData:
|
|
16
|
+
"""
|
|
17
|
+
Attributes:
|
|
18
|
+
budget (BudgetDetail):
|
|
19
|
+
server_knowledge (int): The knowledge of the server
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
budget: "BudgetDetail"
|
|
23
|
+
server_knowledge: int
|
|
24
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
25
|
+
|
|
26
|
+
def to_dict(self) -> dict[str, Any]:
|
|
27
|
+
budget = self.budget.to_dict()
|
|
28
|
+
|
|
29
|
+
server_knowledge = self.server_knowledge
|
|
30
|
+
|
|
31
|
+
field_dict: dict[str, Any] = {}
|
|
32
|
+
field_dict.update(self.additional_properties)
|
|
33
|
+
field_dict.update(
|
|
34
|
+
{
|
|
35
|
+
"budget": budget,
|
|
36
|
+
"server_knowledge": server_knowledge,
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
return field_dict
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
44
|
+
from ynab_cli.adapters.ynab.models.budget_detail import BudgetDetail
|
|
45
|
+
|
|
46
|
+
d = dict(src_dict)
|
|
47
|
+
budget = BudgetDetail.from_dict(d.pop("budget"))
|
|
48
|
+
|
|
49
|
+
server_knowledge = d.pop("server_knowledge")
|
|
50
|
+
|
|
51
|
+
budget_detail_response_data = cls(
|
|
52
|
+
budget=budget,
|
|
53
|
+
server_knowledge=server_knowledge,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
budget_detail_response_data.additional_properties = d
|
|
57
|
+
return budget_detail_response_data
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def additional_keys(self) -> list[str]:
|
|
61
|
+
return list(self.additional_properties.keys())
|
|
62
|
+
|
|
63
|
+
def __getitem__(self, key: str) -> Any:
|
|
64
|
+
return self.additional_properties[key]
|
|
65
|
+
|
|
66
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
67
|
+
self.additional_properties[key] = value
|
|
68
|
+
|
|
69
|
+
def __delitem__(self, key: str) -> None:
|
|
70
|
+
del self.additional_properties[key]
|
|
71
|
+
|
|
72
|
+
def __contains__(self, key: str) -> bool:
|
|
73
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from ynab_cli.adapters.ynab.models.currency_format_type_0 import CurrencyFormatType0
|
|
9
|
+
from ynab_cli.adapters.ynab.models.date_format_type_0 import DateFormatType0
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
T = TypeVar("T", bound="BudgetSettings")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@_attrs_define
|
|
16
|
+
class BudgetSettings:
|
|
17
|
+
"""
|
|
18
|
+
Attributes:
|
|
19
|
+
date_format (Union['DateFormatType0', None]): The date format setting for the budget. In some cases the format
|
|
20
|
+
will not be available and will be specified as null.
|
|
21
|
+
currency_format (Union['CurrencyFormatType0', None]): The currency format setting for the budget. In some cases
|
|
22
|
+
the format will not be available and will be specified as null.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
date_format: Union["DateFormatType0", None]
|
|
26
|
+
currency_format: Union["CurrencyFormatType0", None]
|
|
27
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
28
|
+
|
|
29
|
+
def to_dict(self) -> dict[str, Any]:
|
|
30
|
+
from ynab_cli.adapters.ynab.models.currency_format_type_0 import CurrencyFormatType0
|
|
31
|
+
from ynab_cli.adapters.ynab.models.date_format_type_0 import DateFormatType0
|
|
32
|
+
|
|
33
|
+
date_format: None | dict[str, Any]
|
|
34
|
+
if isinstance(self.date_format, DateFormatType0):
|
|
35
|
+
date_format = self.date_format.to_dict()
|
|
36
|
+
else:
|
|
37
|
+
date_format = self.date_format
|
|
38
|
+
|
|
39
|
+
currency_format: None | dict[str, Any]
|
|
40
|
+
if isinstance(self.currency_format, CurrencyFormatType0):
|
|
41
|
+
currency_format = self.currency_format.to_dict()
|
|
42
|
+
else:
|
|
43
|
+
currency_format = self.currency_format
|
|
44
|
+
|
|
45
|
+
field_dict: dict[str, Any] = {}
|
|
46
|
+
field_dict.update(self.additional_properties)
|
|
47
|
+
field_dict.update(
|
|
48
|
+
{
|
|
49
|
+
"date_format": date_format,
|
|
50
|
+
"currency_format": currency_format,
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
return field_dict
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
58
|
+
from ynab_cli.adapters.ynab.models.currency_format_type_0 import CurrencyFormatType0
|
|
59
|
+
from ynab_cli.adapters.ynab.models.date_format_type_0 import DateFormatType0
|
|
60
|
+
|
|
61
|
+
d = dict(src_dict)
|
|
62
|
+
|
|
63
|
+
def _parse_date_format(data: object) -> Union["DateFormatType0", None]:
|
|
64
|
+
if data is None:
|
|
65
|
+
return data
|
|
66
|
+
try:
|
|
67
|
+
if not isinstance(data, dict):
|
|
68
|
+
raise TypeError()
|
|
69
|
+
componentsschemas_date_format_type_0 = DateFormatType0.from_dict(data)
|
|
70
|
+
|
|
71
|
+
return componentsschemas_date_format_type_0
|
|
72
|
+
except: # noqa: E722
|
|
73
|
+
pass
|
|
74
|
+
return cast(Union["DateFormatType0", None], data)
|
|
75
|
+
|
|
76
|
+
date_format = _parse_date_format(d.pop("date_format"))
|
|
77
|
+
|
|
78
|
+
def _parse_currency_format(data: object) -> Union["CurrencyFormatType0", None]:
|
|
79
|
+
if data is None:
|
|
80
|
+
return data
|
|
81
|
+
try:
|
|
82
|
+
if not isinstance(data, dict):
|
|
83
|
+
raise TypeError()
|
|
84
|
+
componentsschemas_currency_format_type_0 = CurrencyFormatType0.from_dict(data)
|
|
85
|
+
|
|
86
|
+
return componentsschemas_currency_format_type_0
|
|
87
|
+
except: # noqa: E722
|
|
88
|
+
pass
|
|
89
|
+
return cast(Union["CurrencyFormatType0", None], data)
|
|
90
|
+
|
|
91
|
+
currency_format = _parse_currency_format(d.pop("currency_format"))
|
|
92
|
+
|
|
93
|
+
budget_settings = cls(
|
|
94
|
+
date_format=date_format,
|
|
95
|
+
currency_format=currency_format,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
budget_settings.additional_properties = d
|
|
99
|
+
return budget_settings
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def additional_keys(self) -> list[str]:
|
|
103
|
+
return list(self.additional_properties.keys())
|
|
104
|
+
|
|
105
|
+
def __getitem__(self, key: str) -> Any:
|
|
106
|
+
return self.additional_properties[key]
|
|
107
|
+
|
|
108
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
109
|
+
self.additional_properties[key] = value
|
|
110
|
+
|
|
111
|
+
def __delitem__(self, key: str) -> None:
|
|
112
|
+
del self.additional_properties[key]
|
|
113
|
+
|
|
114
|
+
def __contains__(self, key: str) -> bool:
|
|
115
|
+
return key in self.additional_properties
|