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,570 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from collections.abc import Mapping
|
|
3
|
+
from typing import TYPE_CHECKING, Any, TypeVar, 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.models.transaction_cleared_status import TransactionClearedStatus
|
|
11
|
+
from ynab_cli.adapters.ynab.models.transaction_flag_color_type_1 import TransactionFlagColorType1
|
|
12
|
+
from ynab_cli.adapters.ynab.models.transaction_flag_color_type_2_type_1 import TransactionFlagColorType2Type1
|
|
13
|
+
from ynab_cli.adapters.ynab.models.transaction_flag_color_type_3_type_1 import TransactionFlagColorType3Type1
|
|
14
|
+
from ynab_cli.adapters.ynab.models.transaction_summary_debt_transaction_type_type_1 import (
|
|
15
|
+
TransactionSummaryDebtTransactionTypeType1,
|
|
16
|
+
)
|
|
17
|
+
from ynab_cli.adapters.ynab.models.transaction_summary_debt_transaction_type_type_2_type_1 import (
|
|
18
|
+
TransactionSummaryDebtTransactionTypeType2Type1,
|
|
19
|
+
)
|
|
20
|
+
from ynab_cli.adapters.ynab.models.transaction_summary_debt_transaction_type_type_3_type_1 import (
|
|
21
|
+
TransactionSummaryDebtTransactionTypeType3Type1,
|
|
22
|
+
)
|
|
23
|
+
from ynab_cli.adapters.ynab.types import UNSET, Unset
|
|
24
|
+
|
|
25
|
+
if TYPE_CHECKING:
|
|
26
|
+
from ynab_cli.adapters.ynab.models.sub_transaction import SubTransaction
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
T = TypeVar("T", bound="TransactionDetail")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@_attrs_define
|
|
33
|
+
class TransactionDetail:
|
|
34
|
+
"""
|
|
35
|
+
Attributes:
|
|
36
|
+
id (str):
|
|
37
|
+
date (datetime.date): The transaction date in ISO format (e.g. 2016-12-01)
|
|
38
|
+
amount (int): The transaction amount in milliunits format
|
|
39
|
+
cleared (TransactionClearedStatus): The cleared status of the transaction
|
|
40
|
+
approved (bool): Whether or not the transaction is approved
|
|
41
|
+
account_id (UUID):
|
|
42
|
+
deleted (bool): Whether or not the transaction has been deleted. Deleted transactions will only be included in
|
|
43
|
+
delta requests.
|
|
44
|
+
account_name (str):
|
|
45
|
+
subtransactions (list['SubTransaction']): If a split transaction, the subtransactions.
|
|
46
|
+
memo (Union[None, Unset, str]):
|
|
47
|
+
flag_color (Union[None, TransactionFlagColorType1, TransactionFlagColorType2Type1,
|
|
48
|
+
TransactionFlagColorType3Type1, Unset]): The transaction flag
|
|
49
|
+
flag_name (Union[None, Unset, str]): The customized name of a transaction flag
|
|
50
|
+
payee_id (Union[None, UUID, Unset]):
|
|
51
|
+
category_id (Union[None, UUID, Unset]):
|
|
52
|
+
transfer_account_id (Union[None, UUID, Unset]): If a transfer transaction, the account to which it transfers
|
|
53
|
+
transfer_transaction_id (Union[None, Unset, str]): If a transfer transaction, the id of transaction on the other
|
|
54
|
+
side of the transfer
|
|
55
|
+
matched_transaction_id (Union[None, Unset, str]): If transaction is matched, the id of the matched transaction
|
|
56
|
+
import_id (Union[None, Unset, str]): If the transaction was imported, this field is a unique (by account) import
|
|
57
|
+
identifier. If this transaction was imported through File Based Import or Direct Import and not through the
|
|
58
|
+
API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a
|
|
59
|
+
transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of
|
|
60
|
+
'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and
|
|
61
|
+
same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'.
|
|
62
|
+
import_payee_name (Union[None, Unset, str]): If the transaction was imported, the payee name that was used when
|
|
63
|
+
importing and before applying any payee rename rules
|
|
64
|
+
import_payee_name_original (Union[None, Unset, str]): If the transaction was imported, the original payee name
|
|
65
|
+
as it appeared on the statement
|
|
66
|
+
debt_transaction_type (Union[None, TransactionSummaryDebtTransactionTypeType1,
|
|
67
|
+
TransactionSummaryDebtTransactionTypeType2Type1, TransactionSummaryDebtTransactionTypeType3Type1, Unset]): If
|
|
68
|
+
the transaction is a debt/loan account transaction, the type of transaction
|
|
69
|
+
payee_name (Union[None, Unset, str]):
|
|
70
|
+
category_name (Union[None, Unset, str]): The name of the category. If a split transaction, this will be
|
|
71
|
+
'Split'.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
id: str
|
|
75
|
+
date: datetime.date
|
|
76
|
+
amount: int
|
|
77
|
+
cleared: TransactionClearedStatus
|
|
78
|
+
approved: bool
|
|
79
|
+
account_id: UUID
|
|
80
|
+
deleted: bool
|
|
81
|
+
account_name: str
|
|
82
|
+
subtransactions: list["SubTransaction"]
|
|
83
|
+
memo: None | Unset | str = UNSET
|
|
84
|
+
flag_color: (
|
|
85
|
+
None | TransactionFlagColorType1 | TransactionFlagColorType2Type1 | TransactionFlagColorType3Type1 | Unset
|
|
86
|
+
) = UNSET
|
|
87
|
+
flag_name: None | Unset | str = UNSET
|
|
88
|
+
payee_id: None | UUID | Unset = UNSET
|
|
89
|
+
category_id: None | UUID | Unset = UNSET
|
|
90
|
+
transfer_account_id: None | UUID | Unset = UNSET
|
|
91
|
+
transfer_transaction_id: None | Unset | str = UNSET
|
|
92
|
+
matched_transaction_id: None | Unset | str = UNSET
|
|
93
|
+
import_id: None | Unset | str = UNSET
|
|
94
|
+
import_payee_name: None | Unset | str = UNSET
|
|
95
|
+
import_payee_name_original: None | Unset | str = UNSET
|
|
96
|
+
debt_transaction_type: (
|
|
97
|
+
None
|
|
98
|
+
| TransactionSummaryDebtTransactionTypeType1
|
|
99
|
+
| TransactionSummaryDebtTransactionTypeType2Type1
|
|
100
|
+
| TransactionSummaryDebtTransactionTypeType3Type1
|
|
101
|
+
| Unset
|
|
102
|
+
) = UNSET
|
|
103
|
+
payee_name: None | Unset | str = UNSET
|
|
104
|
+
category_name: None | Unset | str = UNSET
|
|
105
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
106
|
+
|
|
107
|
+
def to_dict(self) -> dict[str, Any]:
|
|
108
|
+
id = self.id
|
|
109
|
+
|
|
110
|
+
date = self.date.isoformat()
|
|
111
|
+
|
|
112
|
+
amount = self.amount
|
|
113
|
+
|
|
114
|
+
cleared = self.cleared.value
|
|
115
|
+
|
|
116
|
+
approved = self.approved
|
|
117
|
+
|
|
118
|
+
account_id = str(self.account_id)
|
|
119
|
+
|
|
120
|
+
deleted = self.deleted
|
|
121
|
+
|
|
122
|
+
account_name = self.account_name
|
|
123
|
+
|
|
124
|
+
subtransactions = []
|
|
125
|
+
for subtransactions_item_data in self.subtransactions:
|
|
126
|
+
subtransactions_item = subtransactions_item_data.to_dict()
|
|
127
|
+
subtransactions.append(subtransactions_item)
|
|
128
|
+
|
|
129
|
+
memo: None | Unset | str
|
|
130
|
+
if isinstance(self.memo, Unset):
|
|
131
|
+
memo = UNSET
|
|
132
|
+
else:
|
|
133
|
+
memo = self.memo
|
|
134
|
+
|
|
135
|
+
flag_color: None | Unset | str
|
|
136
|
+
if isinstance(self.flag_color, Unset):
|
|
137
|
+
flag_color = UNSET
|
|
138
|
+
elif isinstance(self.flag_color, TransactionFlagColorType1):
|
|
139
|
+
flag_color = self.flag_color.value
|
|
140
|
+
elif isinstance(self.flag_color, TransactionFlagColorType2Type1):
|
|
141
|
+
flag_color = self.flag_color.value
|
|
142
|
+
elif isinstance(self.flag_color, TransactionFlagColorType3Type1):
|
|
143
|
+
flag_color = self.flag_color.value
|
|
144
|
+
else:
|
|
145
|
+
flag_color = self.flag_color
|
|
146
|
+
|
|
147
|
+
flag_name: None | Unset | str
|
|
148
|
+
if isinstance(self.flag_name, Unset):
|
|
149
|
+
flag_name = UNSET
|
|
150
|
+
else:
|
|
151
|
+
flag_name = self.flag_name
|
|
152
|
+
|
|
153
|
+
payee_id: None | Unset | str
|
|
154
|
+
if isinstance(self.payee_id, Unset):
|
|
155
|
+
payee_id = UNSET
|
|
156
|
+
elif isinstance(self.payee_id, UUID):
|
|
157
|
+
payee_id = str(self.payee_id)
|
|
158
|
+
else:
|
|
159
|
+
payee_id = self.payee_id
|
|
160
|
+
|
|
161
|
+
category_id: None | Unset | str
|
|
162
|
+
if isinstance(self.category_id, Unset):
|
|
163
|
+
category_id = UNSET
|
|
164
|
+
elif isinstance(self.category_id, UUID):
|
|
165
|
+
category_id = str(self.category_id)
|
|
166
|
+
else:
|
|
167
|
+
category_id = self.category_id
|
|
168
|
+
|
|
169
|
+
transfer_account_id: None | Unset | str
|
|
170
|
+
if isinstance(self.transfer_account_id, Unset):
|
|
171
|
+
transfer_account_id = UNSET
|
|
172
|
+
elif isinstance(self.transfer_account_id, UUID):
|
|
173
|
+
transfer_account_id = str(self.transfer_account_id)
|
|
174
|
+
else:
|
|
175
|
+
transfer_account_id = self.transfer_account_id
|
|
176
|
+
|
|
177
|
+
transfer_transaction_id: None | Unset | str
|
|
178
|
+
if isinstance(self.transfer_transaction_id, Unset):
|
|
179
|
+
transfer_transaction_id = UNSET
|
|
180
|
+
else:
|
|
181
|
+
transfer_transaction_id = self.transfer_transaction_id
|
|
182
|
+
|
|
183
|
+
matched_transaction_id: None | Unset | str
|
|
184
|
+
if isinstance(self.matched_transaction_id, Unset):
|
|
185
|
+
matched_transaction_id = UNSET
|
|
186
|
+
else:
|
|
187
|
+
matched_transaction_id = self.matched_transaction_id
|
|
188
|
+
|
|
189
|
+
import_id: None | Unset | str
|
|
190
|
+
if isinstance(self.import_id, Unset):
|
|
191
|
+
import_id = UNSET
|
|
192
|
+
else:
|
|
193
|
+
import_id = self.import_id
|
|
194
|
+
|
|
195
|
+
import_payee_name: None | Unset | str
|
|
196
|
+
if isinstance(self.import_payee_name, Unset):
|
|
197
|
+
import_payee_name = UNSET
|
|
198
|
+
else:
|
|
199
|
+
import_payee_name = self.import_payee_name
|
|
200
|
+
|
|
201
|
+
import_payee_name_original: None | Unset | str
|
|
202
|
+
if isinstance(self.import_payee_name_original, Unset):
|
|
203
|
+
import_payee_name_original = UNSET
|
|
204
|
+
else:
|
|
205
|
+
import_payee_name_original = self.import_payee_name_original
|
|
206
|
+
|
|
207
|
+
debt_transaction_type: None | Unset | str
|
|
208
|
+
if isinstance(self.debt_transaction_type, Unset):
|
|
209
|
+
debt_transaction_type = UNSET
|
|
210
|
+
elif isinstance(self.debt_transaction_type, TransactionSummaryDebtTransactionTypeType1):
|
|
211
|
+
debt_transaction_type = self.debt_transaction_type.value
|
|
212
|
+
elif isinstance(self.debt_transaction_type, TransactionSummaryDebtTransactionTypeType2Type1):
|
|
213
|
+
debt_transaction_type = self.debt_transaction_type.value
|
|
214
|
+
elif isinstance(self.debt_transaction_type, TransactionSummaryDebtTransactionTypeType3Type1):
|
|
215
|
+
debt_transaction_type = self.debt_transaction_type.value
|
|
216
|
+
else:
|
|
217
|
+
debt_transaction_type = self.debt_transaction_type
|
|
218
|
+
|
|
219
|
+
payee_name: None | Unset | str
|
|
220
|
+
if isinstance(self.payee_name, Unset):
|
|
221
|
+
payee_name = UNSET
|
|
222
|
+
else:
|
|
223
|
+
payee_name = self.payee_name
|
|
224
|
+
|
|
225
|
+
category_name: None | Unset | str
|
|
226
|
+
if isinstance(self.category_name, Unset):
|
|
227
|
+
category_name = UNSET
|
|
228
|
+
else:
|
|
229
|
+
category_name = self.category_name
|
|
230
|
+
|
|
231
|
+
field_dict: dict[str, Any] = {}
|
|
232
|
+
field_dict.update(self.additional_properties)
|
|
233
|
+
field_dict.update(
|
|
234
|
+
{
|
|
235
|
+
"id": id,
|
|
236
|
+
"date": date,
|
|
237
|
+
"amount": amount,
|
|
238
|
+
"cleared": cleared,
|
|
239
|
+
"approved": approved,
|
|
240
|
+
"account_id": account_id,
|
|
241
|
+
"deleted": deleted,
|
|
242
|
+
"account_name": account_name,
|
|
243
|
+
"subtransactions": subtransactions,
|
|
244
|
+
}
|
|
245
|
+
)
|
|
246
|
+
if memo is not UNSET:
|
|
247
|
+
field_dict["memo"] = memo
|
|
248
|
+
if flag_color is not UNSET:
|
|
249
|
+
field_dict["flag_color"] = flag_color
|
|
250
|
+
if flag_name is not UNSET:
|
|
251
|
+
field_dict["flag_name"] = flag_name
|
|
252
|
+
if payee_id is not UNSET:
|
|
253
|
+
field_dict["payee_id"] = payee_id
|
|
254
|
+
if category_id is not UNSET:
|
|
255
|
+
field_dict["category_id"] = category_id
|
|
256
|
+
if transfer_account_id is not UNSET:
|
|
257
|
+
field_dict["transfer_account_id"] = transfer_account_id
|
|
258
|
+
if transfer_transaction_id is not UNSET:
|
|
259
|
+
field_dict["transfer_transaction_id"] = transfer_transaction_id
|
|
260
|
+
if matched_transaction_id is not UNSET:
|
|
261
|
+
field_dict["matched_transaction_id"] = matched_transaction_id
|
|
262
|
+
if import_id is not UNSET:
|
|
263
|
+
field_dict["import_id"] = import_id
|
|
264
|
+
if import_payee_name is not UNSET:
|
|
265
|
+
field_dict["import_payee_name"] = import_payee_name
|
|
266
|
+
if import_payee_name_original is not UNSET:
|
|
267
|
+
field_dict["import_payee_name_original"] = import_payee_name_original
|
|
268
|
+
if debt_transaction_type is not UNSET:
|
|
269
|
+
field_dict["debt_transaction_type"] = debt_transaction_type
|
|
270
|
+
if payee_name is not UNSET:
|
|
271
|
+
field_dict["payee_name"] = payee_name
|
|
272
|
+
if category_name is not UNSET:
|
|
273
|
+
field_dict["category_name"] = category_name
|
|
274
|
+
|
|
275
|
+
return field_dict
|
|
276
|
+
|
|
277
|
+
@classmethod
|
|
278
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
279
|
+
from ynab_cli.adapters.ynab.models.sub_transaction import SubTransaction
|
|
280
|
+
|
|
281
|
+
d = dict(src_dict)
|
|
282
|
+
id = d.pop("id")
|
|
283
|
+
|
|
284
|
+
date = isoparse(d.pop("date")).date()
|
|
285
|
+
|
|
286
|
+
amount = d.pop("amount")
|
|
287
|
+
|
|
288
|
+
cleared = TransactionClearedStatus(d.pop("cleared"))
|
|
289
|
+
|
|
290
|
+
approved = d.pop("approved")
|
|
291
|
+
|
|
292
|
+
account_id = UUID(d.pop("account_id"))
|
|
293
|
+
|
|
294
|
+
deleted = d.pop("deleted")
|
|
295
|
+
|
|
296
|
+
account_name = d.pop("account_name")
|
|
297
|
+
|
|
298
|
+
subtransactions = []
|
|
299
|
+
_subtransactions = d.pop("subtransactions")
|
|
300
|
+
for subtransactions_item_data in _subtransactions:
|
|
301
|
+
subtransactions_item = SubTransaction.from_dict(subtransactions_item_data)
|
|
302
|
+
|
|
303
|
+
subtransactions.append(subtransactions_item)
|
|
304
|
+
|
|
305
|
+
def _parse_memo(data: object) -> None | Unset | str:
|
|
306
|
+
if data is None:
|
|
307
|
+
return data
|
|
308
|
+
if isinstance(data, Unset):
|
|
309
|
+
return data
|
|
310
|
+
return cast(None | Unset | str, data)
|
|
311
|
+
|
|
312
|
+
memo = _parse_memo(d.pop("memo", UNSET))
|
|
313
|
+
|
|
314
|
+
def _parse_flag_color(
|
|
315
|
+
data: object,
|
|
316
|
+
) -> None | TransactionFlagColorType1 | TransactionFlagColorType2Type1 | TransactionFlagColorType3Type1 | Unset:
|
|
317
|
+
if data is None:
|
|
318
|
+
return data
|
|
319
|
+
if isinstance(data, Unset):
|
|
320
|
+
return data
|
|
321
|
+
try:
|
|
322
|
+
if not isinstance(data, str):
|
|
323
|
+
raise TypeError()
|
|
324
|
+
componentsschemas_transaction_flag_color_type_1 = TransactionFlagColorType1(data)
|
|
325
|
+
|
|
326
|
+
return componentsschemas_transaction_flag_color_type_1
|
|
327
|
+
except: # noqa: E722
|
|
328
|
+
pass
|
|
329
|
+
try:
|
|
330
|
+
if not isinstance(data, str):
|
|
331
|
+
raise TypeError()
|
|
332
|
+
componentsschemas_transaction_flag_color_type_2_type_1 = TransactionFlagColorType2Type1(data)
|
|
333
|
+
|
|
334
|
+
return componentsschemas_transaction_flag_color_type_2_type_1
|
|
335
|
+
except: # noqa: E722
|
|
336
|
+
pass
|
|
337
|
+
try:
|
|
338
|
+
if not isinstance(data, str):
|
|
339
|
+
raise TypeError()
|
|
340
|
+
componentsschemas_transaction_flag_color_type_3_type_1 = TransactionFlagColorType3Type1(data)
|
|
341
|
+
|
|
342
|
+
return componentsschemas_transaction_flag_color_type_3_type_1
|
|
343
|
+
except: # noqa: E722
|
|
344
|
+
pass
|
|
345
|
+
return cast(
|
|
346
|
+
None
|
|
347
|
+
| TransactionFlagColorType1
|
|
348
|
+
| TransactionFlagColorType2Type1
|
|
349
|
+
| TransactionFlagColorType3Type1
|
|
350
|
+
| Unset,
|
|
351
|
+
data,
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
flag_color = _parse_flag_color(d.pop("flag_color", UNSET))
|
|
355
|
+
|
|
356
|
+
def _parse_flag_name(data: object) -> None | Unset | str:
|
|
357
|
+
if data is None:
|
|
358
|
+
return data
|
|
359
|
+
if isinstance(data, Unset):
|
|
360
|
+
return data
|
|
361
|
+
return cast(None | Unset | str, data)
|
|
362
|
+
|
|
363
|
+
flag_name = _parse_flag_name(d.pop("flag_name", UNSET))
|
|
364
|
+
|
|
365
|
+
def _parse_payee_id(data: object) -> None | UUID | Unset:
|
|
366
|
+
if data is None:
|
|
367
|
+
return data
|
|
368
|
+
if isinstance(data, Unset):
|
|
369
|
+
return data
|
|
370
|
+
try:
|
|
371
|
+
if not isinstance(data, str):
|
|
372
|
+
raise TypeError()
|
|
373
|
+
payee_id_type_0 = UUID(data)
|
|
374
|
+
|
|
375
|
+
return payee_id_type_0
|
|
376
|
+
except: # noqa: E722
|
|
377
|
+
pass
|
|
378
|
+
return cast(None | UUID | Unset, data)
|
|
379
|
+
|
|
380
|
+
payee_id = _parse_payee_id(d.pop("payee_id", UNSET))
|
|
381
|
+
|
|
382
|
+
def _parse_category_id(data: object) -> None | UUID | Unset:
|
|
383
|
+
if data is None:
|
|
384
|
+
return data
|
|
385
|
+
if isinstance(data, Unset):
|
|
386
|
+
return data
|
|
387
|
+
try:
|
|
388
|
+
if not isinstance(data, str):
|
|
389
|
+
raise TypeError()
|
|
390
|
+
category_id_type_0 = UUID(data)
|
|
391
|
+
|
|
392
|
+
return category_id_type_0
|
|
393
|
+
except: # noqa: E722
|
|
394
|
+
pass
|
|
395
|
+
return cast(None | UUID | Unset, data)
|
|
396
|
+
|
|
397
|
+
category_id = _parse_category_id(d.pop("category_id", UNSET))
|
|
398
|
+
|
|
399
|
+
def _parse_transfer_account_id(data: object) -> None | UUID | Unset:
|
|
400
|
+
if data is None:
|
|
401
|
+
return data
|
|
402
|
+
if isinstance(data, Unset):
|
|
403
|
+
return data
|
|
404
|
+
try:
|
|
405
|
+
if not isinstance(data, str):
|
|
406
|
+
raise TypeError()
|
|
407
|
+
transfer_account_id_type_0 = UUID(data)
|
|
408
|
+
|
|
409
|
+
return transfer_account_id_type_0
|
|
410
|
+
except: # noqa: E722
|
|
411
|
+
pass
|
|
412
|
+
return cast(None | UUID | Unset, data)
|
|
413
|
+
|
|
414
|
+
transfer_account_id = _parse_transfer_account_id(d.pop("transfer_account_id", UNSET))
|
|
415
|
+
|
|
416
|
+
def _parse_transfer_transaction_id(data: object) -> None | Unset | str:
|
|
417
|
+
if data is None:
|
|
418
|
+
return data
|
|
419
|
+
if isinstance(data, Unset):
|
|
420
|
+
return data
|
|
421
|
+
return cast(None | Unset | str, data)
|
|
422
|
+
|
|
423
|
+
transfer_transaction_id = _parse_transfer_transaction_id(d.pop("transfer_transaction_id", UNSET))
|
|
424
|
+
|
|
425
|
+
def _parse_matched_transaction_id(data: object) -> None | Unset | str:
|
|
426
|
+
if data is None:
|
|
427
|
+
return data
|
|
428
|
+
if isinstance(data, Unset):
|
|
429
|
+
return data
|
|
430
|
+
return cast(None | Unset | str, data)
|
|
431
|
+
|
|
432
|
+
matched_transaction_id = _parse_matched_transaction_id(d.pop("matched_transaction_id", UNSET))
|
|
433
|
+
|
|
434
|
+
def _parse_import_id(data: object) -> None | Unset | str:
|
|
435
|
+
if data is None:
|
|
436
|
+
return data
|
|
437
|
+
if isinstance(data, Unset):
|
|
438
|
+
return data
|
|
439
|
+
return cast(None | Unset | str, data)
|
|
440
|
+
|
|
441
|
+
import_id = _parse_import_id(d.pop("import_id", UNSET))
|
|
442
|
+
|
|
443
|
+
def _parse_import_payee_name(data: object) -> None | Unset | str:
|
|
444
|
+
if data is None:
|
|
445
|
+
return data
|
|
446
|
+
if isinstance(data, Unset):
|
|
447
|
+
return data
|
|
448
|
+
return cast(None | Unset | str, data)
|
|
449
|
+
|
|
450
|
+
import_payee_name = _parse_import_payee_name(d.pop("import_payee_name", UNSET))
|
|
451
|
+
|
|
452
|
+
def _parse_import_payee_name_original(data: object) -> None | Unset | str:
|
|
453
|
+
if data is None:
|
|
454
|
+
return data
|
|
455
|
+
if isinstance(data, Unset):
|
|
456
|
+
return data
|
|
457
|
+
return cast(None | Unset | str, data)
|
|
458
|
+
|
|
459
|
+
import_payee_name_original = _parse_import_payee_name_original(d.pop("import_payee_name_original", UNSET))
|
|
460
|
+
|
|
461
|
+
def _parse_debt_transaction_type(
|
|
462
|
+
data: object,
|
|
463
|
+
) -> (
|
|
464
|
+
None
|
|
465
|
+
| TransactionSummaryDebtTransactionTypeType1
|
|
466
|
+
| TransactionSummaryDebtTransactionTypeType2Type1
|
|
467
|
+
| TransactionSummaryDebtTransactionTypeType3Type1
|
|
468
|
+
| Unset
|
|
469
|
+
):
|
|
470
|
+
if data is None:
|
|
471
|
+
return data
|
|
472
|
+
if isinstance(data, Unset):
|
|
473
|
+
return data
|
|
474
|
+
try:
|
|
475
|
+
if not isinstance(data, str):
|
|
476
|
+
raise TypeError()
|
|
477
|
+
debt_transaction_type_type_1 = TransactionSummaryDebtTransactionTypeType1(data)
|
|
478
|
+
|
|
479
|
+
return debt_transaction_type_type_1
|
|
480
|
+
except: # noqa: E722
|
|
481
|
+
pass
|
|
482
|
+
try:
|
|
483
|
+
if not isinstance(data, str):
|
|
484
|
+
raise TypeError()
|
|
485
|
+
debt_transaction_type_type_2_type_1 = TransactionSummaryDebtTransactionTypeType2Type1(data)
|
|
486
|
+
|
|
487
|
+
return debt_transaction_type_type_2_type_1
|
|
488
|
+
except: # noqa: E722
|
|
489
|
+
pass
|
|
490
|
+
try:
|
|
491
|
+
if not isinstance(data, str):
|
|
492
|
+
raise TypeError()
|
|
493
|
+
debt_transaction_type_type_3_type_1 = TransactionSummaryDebtTransactionTypeType3Type1(data)
|
|
494
|
+
|
|
495
|
+
return debt_transaction_type_type_3_type_1
|
|
496
|
+
except: # noqa: E722
|
|
497
|
+
pass
|
|
498
|
+
return cast(
|
|
499
|
+
None
|
|
500
|
+
| TransactionSummaryDebtTransactionTypeType1
|
|
501
|
+
| TransactionSummaryDebtTransactionTypeType2Type1
|
|
502
|
+
| TransactionSummaryDebtTransactionTypeType3Type1
|
|
503
|
+
| Unset,
|
|
504
|
+
data,
|
|
505
|
+
)
|
|
506
|
+
|
|
507
|
+
debt_transaction_type = _parse_debt_transaction_type(d.pop("debt_transaction_type", UNSET))
|
|
508
|
+
|
|
509
|
+
def _parse_payee_name(data: object) -> None | Unset | str:
|
|
510
|
+
if data is None:
|
|
511
|
+
return data
|
|
512
|
+
if isinstance(data, Unset):
|
|
513
|
+
return data
|
|
514
|
+
return cast(None | Unset | str, data)
|
|
515
|
+
|
|
516
|
+
payee_name = _parse_payee_name(d.pop("payee_name", UNSET))
|
|
517
|
+
|
|
518
|
+
def _parse_category_name(data: object) -> None | Unset | str:
|
|
519
|
+
if data is None:
|
|
520
|
+
return data
|
|
521
|
+
if isinstance(data, Unset):
|
|
522
|
+
return data
|
|
523
|
+
return cast(None | Unset | str, data)
|
|
524
|
+
|
|
525
|
+
category_name = _parse_category_name(d.pop("category_name", UNSET))
|
|
526
|
+
|
|
527
|
+
transaction_detail = cls(
|
|
528
|
+
id=id,
|
|
529
|
+
date=date,
|
|
530
|
+
amount=amount,
|
|
531
|
+
cleared=cleared,
|
|
532
|
+
approved=approved,
|
|
533
|
+
account_id=account_id,
|
|
534
|
+
deleted=deleted,
|
|
535
|
+
account_name=account_name,
|
|
536
|
+
subtransactions=subtransactions,
|
|
537
|
+
memo=memo,
|
|
538
|
+
flag_color=flag_color,
|
|
539
|
+
flag_name=flag_name,
|
|
540
|
+
payee_id=payee_id,
|
|
541
|
+
category_id=category_id,
|
|
542
|
+
transfer_account_id=transfer_account_id,
|
|
543
|
+
transfer_transaction_id=transfer_transaction_id,
|
|
544
|
+
matched_transaction_id=matched_transaction_id,
|
|
545
|
+
import_id=import_id,
|
|
546
|
+
import_payee_name=import_payee_name,
|
|
547
|
+
import_payee_name_original=import_payee_name_original,
|
|
548
|
+
debt_transaction_type=debt_transaction_type,
|
|
549
|
+
payee_name=payee_name,
|
|
550
|
+
category_name=category_name,
|
|
551
|
+
)
|
|
552
|
+
|
|
553
|
+
transaction_detail.additional_properties = d
|
|
554
|
+
return transaction_detail
|
|
555
|
+
|
|
556
|
+
@property
|
|
557
|
+
def additional_keys(self) -> list[str]:
|
|
558
|
+
return list(self.additional_properties.keys())
|
|
559
|
+
|
|
560
|
+
def __getitem__(self, key: str) -> Any:
|
|
561
|
+
return self.additional_properties[key]
|
|
562
|
+
|
|
563
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
564
|
+
self.additional_properties[key] = value
|
|
565
|
+
|
|
566
|
+
def __delitem__(self, key: str) -> None:
|
|
567
|
+
del self.additional_properties[key]
|
|
568
|
+
|
|
569
|
+
def __contains__(self, key: str) -> bool:
|
|
570
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
from typing_extensions import override
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TransactionFlagColorType1(str, Enum):
|
|
7
|
+
BLUE = "blue"
|
|
8
|
+
GREEN = "green"
|
|
9
|
+
ORANGE = "orange"
|
|
10
|
+
PURPLE = "purple"
|
|
11
|
+
RED = "red"
|
|
12
|
+
YELLOW = "yellow"
|
|
13
|
+
|
|
14
|
+
@override
|
|
15
|
+
def __str__(self) -> str:
|
|
16
|
+
return str(self.value)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
from typing_extensions import override
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TransactionFlagColorType2Type1(str, Enum):
|
|
7
|
+
BLUE = "blue"
|
|
8
|
+
GREEN = "green"
|
|
9
|
+
ORANGE = "orange"
|
|
10
|
+
PURPLE = "purple"
|
|
11
|
+
RED = "red"
|
|
12
|
+
YELLOW = "yellow"
|
|
13
|
+
|
|
14
|
+
@override
|
|
15
|
+
def __str__(self) -> str:
|
|
16
|
+
return str(self.value)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
from typing_extensions import override
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TransactionFlagColorType3Type1(str, Enum):
|
|
7
|
+
BLUE = "blue"
|
|
8
|
+
GREEN = "green"
|
|
9
|
+
ORANGE = "orange"
|
|
10
|
+
PURPLE = "purple"
|
|
11
|
+
RED = "red"
|
|
12
|
+
YELLOW = "yellow"
|
|
13
|
+
|
|
14
|
+
@override
|
|
15
|
+
def __str__(self) -> str:
|
|
16
|
+
return str(self.value)
|
|
@@ -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.transaction_response_data import TransactionResponseData
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T", bound="TransactionResponse")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class TransactionResponse:
|
|
16
|
+
"""
|
|
17
|
+
Attributes:
|
|
18
|
+
data (TransactionResponseData):
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
data: "TransactionResponseData"
|
|
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.transaction_response_data import TransactionResponseData
|
|
40
|
+
|
|
41
|
+
d = dict(src_dict)
|
|
42
|
+
data = TransactionResponseData.from_dict(d.pop("data"))
|
|
43
|
+
|
|
44
|
+
transaction_response = cls(
|
|
45
|
+
data=data,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
transaction_response.additional_properties = d
|
|
49
|
+
return transaction_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
|