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.
Files changed (206) hide show
  1. ynab_cli/__init__.py +0 -0
  2. ynab_cli/adapters/__init__.py +0 -0
  3. ynab_cli/adapters/rich/__init__.py +0 -0
  4. ynab_cli/adapters/rich/io.py +38 -0
  5. ynab_cli/adapters/textual/__init__.py +0 -0
  6. ynab_cli/adapters/textual/io.py +62 -0
  7. ynab_cli/adapters/ynab/__init__.py +8 -0
  8. ynab_cli/adapters/ynab/api/__init__.py +1 -0
  9. ynab_cli/adapters/ynab/api/accounts/__init__.py +1 -0
  10. ynab_cli/adapters/ynab/api/accounts/create_account.py +186 -0
  11. ynab_cli/adapters/ynab/api/accounts/get_account_by_id.py +177 -0
  12. ynab_cli/adapters/ynab/api/accounts/get_accounts.py +184 -0
  13. ynab_cli/adapters/ynab/api/budgets/__init__.py +1 -0
  14. ynab_cli/adapters/ynab/api/budgets/get_budget_by_id.py +188 -0
  15. ynab_cli/adapters/ynab/api/budgets/get_budget_settings_by_id.py +163 -0
  16. ynab_cli/adapters/ynab/api/budgets/get_budgets.py +171 -0
  17. ynab_cli/adapters/ynab/api/categories/__init__.py +1 -0
  18. ynab_cli/adapters/ynab/api/categories/get_categories.py +188 -0
  19. ynab_cli/adapters/ynab/api/categories/get_category_by_id.py +180 -0
  20. ynab_cli/adapters/ynab/api/categories/get_month_category_by_id.py +194 -0
  21. ynab_cli/adapters/ynab/api/categories/update_category.py +199 -0
  22. ynab_cli/adapters/ynab/api/categories/update_month_category.py +213 -0
  23. ynab_cli/adapters/ynab/api/months/__init__.py +1 -0
  24. ynab_cli/adapters/ynab/api/months/get_budget_month.py +177 -0
  25. ynab_cli/adapters/ynab/api/months/get_budget_months.py +184 -0
  26. ynab_cli/adapters/ynab/api/payee_locations/__init__.py +1 -0
  27. ynab_cli/adapters/ynab/api/payee_locations/get_payee_location_by_id.py +176 -0
  28. ynab_cli/adapters/ynab/api/payee_locations/get_payee_locations.py +163 -0
  29. ynab_cli/adapters/ynab/api/payee_locations/get_payee_locations_by_payee.py +176 -0
  30. ynab_cli/adapters/ynab/api/payees/__init__.py +1 -0
  31. ynab_cli/adapters/ynab/api/payees/get_payee_by_id.py +176 -0
  32. ynab_cli/adapters/ynab/api/payees/get_payees.py +184 -0
  33. ynab_cli/adapters/ynab/api/payees/update_payee.py +199 -0
  34. ynab_cli/adapters/ynab/api/scheduled_transactions/__init__.py +1 -0
  35. ynab_cli/adapters/ynab/api/scheduled_transactions/create_scheduled_transaction.py +186 -0
  36. ynab_cli/adapters/ynab/api/scheduled_transactions/delete_scheduled_transaction.py +176 -0
  37. ynab_cli/adapters/ynab/api/scheduled_transactions/get_scheduled_transaction_by_id.py +176 -0
  38. ynab_cli/adapters/ynab/api/scheduled_transactions/get_scheduled_transactions.py +184 -0
  39. ynab_cli/adapters/ynab/api/scheduled_transactions/update_scheduled_transaction.py +199 -0
  40. ynab_cli/adapters/ynab/api/transactions/__init__.py +1 -0
  41. ynab_cli/adapters/ynab/api/transactions/create_transaction.py +202 -0
  42. ynab_cli/adapters/ynab/api/transactions/delete_transaction.py +176 -0
  43. ynab_cli/adapters/ynab/api/transactions/get_transaction_by_id.py +176 -0
  44. ynab_cli/adapters/ynab/api/transactions/get_transactions.py +227 -0
  45. ynab_cli/adapters/ynab/api/transactions/get_transactions_by_account.py +236 -0
  46. ynab_cli/adapters/ynab/api/transactions/get_transactions_by_category.py +236 -0
  47. ynab_cli/adapters/ynab/api/transactions/get_transactions_by_month.py +236 -0
  48. ynab_cli/adapters/ynab/api/transactions/get_transactions_by_payee.py +236 -0
  49. ynab_cli/adapters/ynab/api/transactions/import_transactions.py +183 -0
  50. ynab_cli/adapters/ynab/api/transactions/update_transaction.py +199 -0
  51. ynab_cli/adapters/ynab/api/transactions/update_transactions.py +177 -0
  52. ynab_cli/adapters/ynab/api/user/__init__.py +1 -0
  53. ynab_cli/adapters/ynab/api/user/get_user.py +130 -0
  54. ynab_cli/adapters/ynab/client.py +268 -0
  55. ynab_cli/adapters/ynab/errors.py +16 -0
  56. ynab_cli/adapters/ynab/models/__init__.py +229 -0
  57. ynab_cli/adapters/ynab/models/account.py +345 -0
  58. ynab_cli/adapters/ynab/models/account_response.py +65 -0
  59. ynab_cli/adapters/ynab/models/account_response_data.py +65 -0
  60. ynab_cli/adapters/ynab/models/account_type.py +23 -0
  61. ynab_cli/adapters/ynab/models/accounts_response.py +65 -0
  62. ynab_cli/adapters/ynab/models/accounts_response_data.py +81 -0
  63. ynab_cli/adapters/ynab/models/budget_detail.py +405 -0
  64. ynab_cli/adapters/ynab/models/budget_detail_response.py +65 -0
  65. ynab_cli/adapters/ynab/models/budget_detail_response_data.py +73 -0
  66. ynab_cli/adapters/ynab/models/budget_settings.py +115 -0
  67. ynab_cli/adapters/ynab/models/budget_settings_response.py +65 -0
  68. ynab_cli/adapters/ynab/models/budget_settings_response_data.py +65 -0
  69. ynab_cli/adapters/ynab/models/budget_summary.py +216 -0
  70. ynab_cli/adapters/ynab/models/budget_summary_response.py +65 -0
  71. ynab_cli/adapters/ynab/models/budget_summary_response_data.py +91 -0
  72. ynab_cli/adapters/ynab/models/bulk_response.py +65 -0
  73. ynab_cli/adapters/ynab/models/bulk_response_data.py +65 -0
  74. ynab_cli/adapters/ynab/models/bulk_response_data_bulk.py +68 -0
  75. ynab_cli/adapters/ynab/models/bulk_transactions.py +75 -0
  76. ynab_cli/adapters/ynab/models/categories_response.py +65 -0
  77. ynab_cli/adapters/ynab/models/categories_response_data.py +81 -0
  78. ynab_cli/adapters/ynab/models/category.py +519 -0
  79. ynab_cli/adapters/ynab/models/category_goal_type_type_1.py +15 -0
  80. ynab_cli/adapters/ynab/models/category_goal_type_type_2_type_1.py +15 -0
  81. ynab_cli/adapters/ynab/models/category_goal_type_type_3_type_1.py +15 -0
  82. ynab_cli/adapters/ynab/models/category_group.py +85 -0
  83. ynab_cli/adapters/ynab/models/category_group_with_categories.py +108 -0
  84. ynab_cli/adapters/ynab/models/category_response.py +65 -0
  85. ynab_cli/adapters/ynab/models/category_response_data.py +65 -0
  86. ynab_cli/adapters/ynab/models/currency_format_type_0.py +117 -0
  87. ynab_cli/adapters/ynab/models/date_format_type_0.py +61 -0
  88. ynab_cli/adapters/ynab/models/error_detail.py +75 -0
  89. ynab_cli/adapters/ynab/models/error_response.py +65 -0
  90. ynab_cli/adapters/ynab/models/existing_transaction.py +322 -0
  91. ynab_cli/adapters/ynab/models/get_transactions_by_account_type.py +12 -0
  92. ynab_cli/adapters/ynab/models/get_transactions_by_category_type.py +12 -0
  93. ynab_cli/adapters/ynab/models/get_transactions_by_month_type.py +12 -0
  94. ynab_cli/adapters/ynab/models/get_transactions_by_payee_type.py +12 -0
  95. ynab_cli/adapters/ynab/models/get_transactions_type.py +12 -0
  96. ynab_cli/adapters/ynab/models/hybrid_transaction.py +567 -0
  97. ynab_cli/adapters/ynab/models/hybrid_transaction_type.py +12 -0
  98. ynab_cli/adapters/ynab/models/hybrid_transactions_response.py +65 -0
  99. ynab_cli/adapters/ynab/models/hybrid_transactions_response_data.py +84 -0
  100. ynab_cli/adapters/ynab/models/loan_account_periodic_value_type_0.py +44 -0
  101. ynab_cli/adapters/ynab/models/month_detail.py +168 -0
  102. ynab_cli/adapters/ynab/models/month_detail_response.py +65 -0
  103. ynab_cli/adapters/ynab/models/month_detail_response_data.py +65 -0
  104. ynab_cli/adapters/ynab/models/month_summaries_response.py +65 -0
  105. ynab_cli/adapters/ynab/models/month_summaries_response_data.py +81 -0
  106. ynab_cli/adapters/ynab/models/month_summary.py +145 -0
  107. ynab_cli/adapters/ynab/models/new_transaction.py +352 -0
  108. ynab_cli/adapters/ynab/models/patch_category_wrapper.py +65 -0
  109. ynab_cli/adapters/ynab/models/patch_month_category_wrapper.py +65 -0
  110. ynab_cli/adapters/ynab/models/patch_payee_wrapper.py +65 -0
  111. ynab_cli/adapters/ynab/models/patch_transactions_wrapper.py +73 -0
  112. ynab_cli/adapters/ynab/models/payee.py +100 -0
  113. ynab_cli/adapters/ynab/models/payee_location.py +93 -0
  114. ynab_cli/adapters/ynab/models/payee_location_response.py +65 -0
  115. ynab_cli/adapters/ynab/models/payee_location_response_data.py +65 -0
  116. ynab_cli/adapters/ynab/models/payee_locations_response.py +65 -0
  117. ynab_cli/adapters/ynab/models/payee_locations_response_data.py +73 -0
  118. ynab_cli/adapters/ynab/models/payee_response.py +65 -0
  119. ynab_cli/adapters/ynab/models/payee_response_data.py +65 -0
  120. ynab_cli/adapters/ynab/models/payees_response.py +65 -0
  121. ynab_cli/adapters/ynab/models/payees_response_data.py +81 -0
  122. ynab_cli/adapters/ynab/models/post_account_wrapper.py +65 -0
  123. ynab_cli/adapters/ynab/models/post_scheduled_transaction_wrapper.py +65 -0
  124. ynab_cli/adapters/ynab/models/post_transactions_wrapper.py +91 -0
  125. ynab_cli/adapters/ynab/models/put_scheduled_transaction_wrapper.py +65 -0
  126. ynab_cli/adapters/ynab/models/put_transaction_wrapper.py +65 -0
  127. ynab_cli/adapters/ynab/models/save_account.py +77 -0
  128. ynab_cli/adapters/ynab/models/save_category.py +129 -0
  129. ynab_cli/adapters/ynab/models/save_category_response.py +65 -0
  130. ynab_cli/adapters/ynab/models/save_category_response_data.py +73 -0
  131. ynab_cli/adapters/ynab/models/save_month_category.py +59 -0
  132. ynab_cli/adapters/ynab/models/save_payee.py +59 -0
  133. ynab_cli/adapters/ynab/models/save_payee_response.py +65 -0
  134. ynab_cli/adapters/ynab/models/save_payee_response_data.py +73 -0
  135. ynab_cli/adapters/ynab/models/save_scheduled_transaction.py +269 -0
  136. ynab_cli/adapters/ynab/models/save_sub_transaction.py +166 -0
  137. ynab_cli/adapters/ynab/models/save_transaction_with_id_or_import_id.py +366 -0
  138. ynab_cli/adapters/ynab/models/save_transaction_with_optional_fields.py +322 -0
  139. ynab_cli/adapters/ynab/models/save_transactions_response.py +65 -0
  140. ynab_cli/adapters/ynab/models/save_transactions_response_data.py +123 -0
  141. ynab_cli/adapters/ynab/models/scheduled_sub_transaction.py +238 -0
  142. ynab_cli/adapters/ynab/models/scheduled_transaction_detail.py +381 -0
  143. ynab_cli/adapters/ynab/models/scheduled_transaction_frequency.py +23 -0
  144. ynab_cli/adapters/ynab/models/scheduled_transaction_response.py +65 -0
  145. ynab_cli/adapters/ynab/models/scheduled_transaction_response_data.py +65 -0
  146. ynab_cli/adapters/ynab/models/scheduled_transaction_summary.py +310 -0
  147. ynab_cli/adapters/ynab/models/scheduled_transaction_summary_frequency.py +23 -0
  148. ynab_cli/adapters/ynab/models/scheduled_transactions_response.py +65 -0
  149. ynab_cli/adapters/ynab/models/scheduled_transactions_response_data.py +81 -0
  150. ynab_cli/adapters/ynab/models/sub_transaction.py +259 -0
  151. ynab_cli/adapters/ynab/models/transaction_cleared_status.py +13 -0
  152. ynab_cli/adapters/ynab/models/transaction_detail.py +570 -0
  153. ynab_cli/adapters/ynab/models/transaction_flag_color_type_1.py +16 -0
  154. ynab_cli/adapters/ynab/models/transaction_flag_color_type_2_type_1.py +16 -0
  155. ynab_cli/adapters/ynab/models/transaction_flag_color_type_3_type_1.py +16 -0
  156. ynab_cli/adapters/ynab/models/transaction_response.py +65 -0
  157. ynab_cli/adapters/ynab/models/transaction_response_data.py +65 -0
  158. ynab_cli/adapters/ynab/models/transaction_summary.py +499 -0
  159. ynab_cli/adapters/ynab/models/transaction_summary_debt_transaction_type_type_1.py +18 -0
  160. ynab_cli/adapters/ynab/models/transaction_summary_debt_transaction_type_type_2_type_1.py +18 -0
  161. ynab_cli/adapters/ynab/models/transaction_summary_debt_transaction_type_type_3_type_1.py +18 -0
  162. ynab_cli/adapters/ynab/models/transactions_import_response.py +65 -0
  163. ynab_cli/adapters/ynab/models/transactions_import_response_data.py +59 -0
  164. ynab_cli/adapters/ynab/models/transactions_response.py +65 -0
  165. ynab_cli/adapters/ynab/models/transactions_response_data.py +81 -0
  166. ynab_cli/adapters/ynab/models/user.py +60 -0
  167. ynab_cli/adapters/ynab/models/user_response.py +65 -0
  168. ynab_cli/adapters/ynab/models/user_response_data.py +65 -0
  169. ynab_cli/adapters/ynab/types.py +46 -0
  170. ynab_cli/adapters/ynab/util.py +78 -0
  171. ynab_cli/domain/__init__.py +0 -0
  172. ynab_cli/domain/constants.py +3 -0
  173. ynab_cli/domain/models/__init__.py +0 -0
  174. ynab_cli/domain/models/rules.py +37 -0
  175. ynab_cli/domain/ports/__init__.py +5 -0
  176. ynab_cli/domain/ports/io.py +63 -0
  177. ynab_cli/domain/settings.py +16 -0
  178. ynab_cli/domain/use_cases/__init__.py +0 -0
  179. ynab_cli/domain/use_cases/categories.py +105 -0
  180. ynab_cli/domain/use_cases/payees.py +232 -0
  181. ynab_cli/domain/use_cases/transactions.py +93 -0
  182. ynab_cli/host/__init__.py +14 -0
  183. ynab_cli/host/cli.py +37 -0
  184. ynab_cli/host/click/__init__.py +0 -0
  185. ynab_cli/host/click/cli.py +44 -0
  186. ynab_cli/host/click/commands/__init__.py +0 -0
  187. ynab_cli/host/click/commands/categories.py +92 -0
  188. ynab_cli/host/click/commands/payees.py +157 -0
  189. ynab_cli/host/click/commands/rich/__init__.py +0 -0
  190. ynab_cli/host/click/commands/rich/progress_table.py +37 -0
  191. ynab_cli/host/click/commands/transactions.py +76 -0
  192. ynab_cli/host/constants.py +3 -0
  193. ynab_cli/host/textual/__init__.py +0 -0
  194. ynab_cli/host/textual/app.py +98 -0
  195. ynab_cli/host/textual/app.tcss +47 -0
  196. ynab_cli/host/textual/cli.py +42 -0
  197. ynab_cli/host/textual/widgets/__init__.py +58 -0
  198. ynab_cli/host/textual/widgets/categories.py +90 -0
  199. ynab_cli/host/textual/widgets/payees.py +154 -0
  200. ynab_cli/host/textual/widgets/transactions.py +89 -0
  201. ynab_cli/py.typed +0 -0
  202. ynab_cli-0.3.0.dist-info/METADATA +102 -0
  203. ynab_cli-0.3.0.dist-info/RECORD +206 -0
  204. ynab_cli-0.3.0.dist-info/WHEEL +4 -0
  205. ynab_cli-0.3.0.dist-info/entry_points.txt +2 -0
  206. ynab_cli-0.3.0.dist-info/licenses/LICENSE.md +21 -0
@@ -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_settings_response_data import BudgetSettingsResponseData
9
+
10
+
11
+ T = TypeVar("T", bound="BudgetSettingsResponse")
12
+
13
+
14
+ @_attrs_define
15
+ class BudgetSettingsResponse:
16
+ """
17
+ Attributes:
18
+ data (BudgetSettingsResponseData):
19
+ """
20
+
21
+ data: "BudgetSettingsResponseData"
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_settings_response_data import BudgetSettingsResponseData
40
+
41
+ d = dict(src_dict)
42
+ data = BudgetSettingsResponseData.from_dict(d.pop("data"))
43
+
44
+ budget_settings_response = cls(
45
+ data=data,
46
+ )
47
+
48
+ budget_settings_response.additional_properties = d
49
+ return budget_settings_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,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_settings import BudgetSettings
9
+
10
+
11
+ T = TypeVar("T", bound="BudgetSettingsResponseData")
12
+
13
+
14
+ @_attrs_define
15
+ class BudgetSettingsResponseData:
16
+ """
17
+ Attributes:
18
+ settings (BudgetSettings):
19
+ """
20
+
21
+ settings: "BudgetSettings"
22
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23
+
24
+ def to_dict(self) -> dict[str, Any]:
25
+ settings = self.settings.to_dict()
26
+
27
+ field_dict: dict[str, Any] = {}
28
+ field_dict.update(self.additional_properties)
29
+ field_dict.update(
30
+ {
31
+ "settings": settings,
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_settings import BudgetSettings
40
+
41
+ d = dict(src_dict)
42
+ settings = BudgetSettings.from_dict(d.pop("settings"))
43
+
44
+ budget_settings_response_data = cls(
45
+ settings=settings,
46
+ )
47
+
48
+ budget_settings_response_data.additional_properties = d
49
+ return budget_settings_response_data
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,216 @@
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.currency_format_type_0 import CurrencyFormatType0
15
+ from ynab_cli.adapters.ynab.models.date_format_type_0 import DateFormatType0
16
+
17
+
18
+ T = TypeVar("T", bound="BudgetSummary")
19
+
20
+
21
+ @_attrs_define
22
+ class BudgetSummary:
23
+ """
24
+ Attributes:
25
+ id (UUID):
26
+ name (str):
27
+ last_modified_on (Union[Unset, datetime.datetime]): The last time any changes were made to the budget from
28
+ either a web or mobile client
29
+ first_month (Union[Unset, datetime.date]): The earliest budget month
30
+ last_month (Union[Unset, datetime.date]): The latest budget month
31
+ date_format (Union['DateFormatType0', None, Unset]): The date format setting for the budget. In some cases the
32
+ format will not be available and will be specified as null.
33
+ currency_format (Union['CurrencyFormatType0', None, Unset]): The currency format setting for the budget. In
34
+ some cases the format will not be available and will be specified as null.
35
+ accounts (Union[Unset, list['Account']]): The budget accounts (only included if `include_accounts=true`
36
+ specified as query parameter)
37
+ """
38
+
39
+ id: UUID
40
+ name: str
41
+ last_modified_on: Unset | datetime.datetime = UNSET
42
+ first_month: Unset | datetime.date = UNSET
43
+ last_month: Unset | datetime.date = UNSET
44
+ date_format: Union["DateFormatType0", None, Unset] = UNSET
45
+ currency_format: Union["CurrencyFormatType0", None, Unset] = UNSET
46
+ accounts: Unset | list["Account"] = UNSET
47
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
48
+
49
+ def to_dict(self) -> dict[str, Any]:
50
+ from ynab_cli.adapters.ynab.models.currency_format_type_0 import CurrencyFormatType0
51
+ from ynab_cli.adapters.ynab.models.date_format_type_0 import DateFormatType0
52
+
53
+ id = str(self.id)
54
+
55
+ name = self.name
56
+
57
+ last_modified_on: Unset | str = UNSET
58
+ if not isinstance(self.last_modified_on, Unset):
59
+ last_modified_on = self.last_modified_on.isoformat()
60
+
61
+ first_month: Unset | str = UNSET
62
+ if not isinstance(self.first_month, Unset):
63
+ first_month = self.first_month.isoformat()
64
+
65
+ last_month: Unset | str = UNSET
66
+ if not isinstance(self.last_month, Unset):
67
+ last_month = self.last_month.isoformat()
68
+
69
+ date_format: None | Unset | dict[str, Any]
70
+ if isinstance(self.date_format, Unset):
71
+ date_format = UNSET
72
+ elif isinstance(self.date_format, DateFormatType0):
73
+ date_format = self.date_format.to_dict()
74
+ else:
75
+ date_format = self.date_format
76
+
77
+ currency_format: None | Unset | dict[str, Any]
78
+ if isinstance(self.currency_format, Unset):
79
+ currency_format = UNSET
80
+ elif isinstance(self.currency_format, CurrencyFormatType0):
81
+ currency_format = self.currency_format.to_dict()
82
+ else:
83
+ currency_format = self.currency_format
84
+
85
+ accounts: Unset | list[dict[str, Any]] = UNSET
86
+ if not isinstance(self.accounts, Unset):
87
+ accounts = []
88
+ for accounts_item_data in self.accounts:
89
+ accounts_item = accounts_item_data.to_dict()
90
+ accounts.append(accounts_item)
91
+
92
+ field_dict: dict[str, Any] = {}
93
+ field_dict.update(self.additional_properties)
94
+ field_dict.update(
95
+ {
96
+ "id": id,
97
+ "name": name,
98
+ }
99
+ )
100
+ if last_modified_on is not UNSET:
101
+ field_dict["last_modified_on"] = last_modified_on
102
+ if first_month is not UNSET:
103
+ field_dict["first_month"] = first_month
104
+ if last_month is not UNSET:
105
+ field_dict["last_month"] = last_month
106
+ if date_format is not UNSET:
107
+ field_dict["date_format"] = date_format
108
+ if currency_format is not UNSET:
109
+ field_dict["currency_format"] = currency_format
110
+ if accounts is not UNSET:
111
+ field_dict["accounts"] = accounts
112
+
113
+ return field_dict
114
+
115
+ @classmethod
116
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
117
+ from ynab_cli.adapters.ynab.models.account import Account
118
+ from ynab_cli.adapters.ynab.models.currency_format_type_0 import CurrencyFormatType0
119
+ from ynab_cli.adapters.ynab.models.date_format_type_0 import DateFormatType0
120
+
121
+ d = dict(src_dict)
122
+ id = UUID(d.pop("id"))
123
+
124
+ name = d.pop("name")
125
+
126
+ _last_modified_on = d.pop("last_modified_on", UNSET)
127
+ last_modified_on: Unset | datetime.datetime
128
+ if isinstance(_last_modified_on, Unset):
129
+ last_modified_on = UNSET
130
+ else:
131
+ last_modified_on = isoparse(_last_modified_on)
132
+
133
+ _first_month = d.pop("first_month", UNSET)
134
+ first_month: Unset | datetime.date
135
+ if isinstance(_first_month, Unset):
136
+ first_month = UNSET
137
+ else:
138
+ first_month = isoparse(_first_month).date()
139
+
140
+ _last_month = d.pop("last_month", UNSET)
141
+ last_month: Unset | datetime.date
142
+ if isinstance(_last_month, Unset):
143
+ last_month = UNSET
144
+ else:
145
+ last_month = isoparse(_last_month).date()
146
+
147
+ def _parse_date_format(data: object) -> Union["DateFormatType0", None, Unset]:
148
+ if data is None:
149
+ return data
150
+ if isinstance(data, Unset):
151
+ return data
152
+ try:
153
+ if not isinstance(data, dict):
154
+ raise TypeError()
155
+ componentsschemas_date_format_type_0 = DateFormatType0.from_dict(data)
156
+
157
+ return componentsschemas_date_format_type_0
158
+ except: # noqa: E722
159
+ pass
160
+ return cast(Union["DateFormatType0", None, Unset], data)
161
+
162
+ date_format = _parse_date_format(d.pop("date_format", UNSET))
163
+
164
+ def _parse_currency_format(data: object) -> Union["CurrencyFormatType0", None, Unset]:
165
+ if data is None:
166
+ return data
167
+ if isinstance(data, Unset):
168
+ return data
169
+ try:
170
+ if not isinstance(data, dict):
171
+ raise TypeError()
172
+ componentsschemas_currency_format_type_0 = CurrencyFormatType0.from_dict(data)
173
+
174
+ return componentsschemas_currency_format_type_0
175
+ except: # noqa: E722
176
+ pass
177
+ return cast(Union["CurrencyFormatType0", None, Unset], data)
178
+
179
+ currency_format = _parse_currency_format(d.pop("currency_format", UNSET))
180
+
181
+ accounts = []
182
+ _accounts = d.pop("accounts", UNSET)
183
+ for accounts_item_data in _accounts or []:
184
+ accounts_item = Account.from_dict(accounts_item_data)
185
+
186
+ accounts.append(accounts_item)
187
+
188
+ budget_summary = cls(
189
+ id=id,
190
+ name=name,
191
+ last_modified_on=last_modified_on,
192
+ first_month=first_month,
193
+ last_month=last_month,
194
+ date_format=date_format,
195
+ currency_format=currency_format,
196
+ accounts=accounts,
197
+ )
198
+
199
+ budget_summary.additional_properties = d
200
+ return budget_summary
201
+
202
+ @property
203
+ def additional_keys(self) -> list[str]:
204
+ return list(self.additional_properties.keys())
205
+
206
+ def __getitem__(self, key: str) -> Any:
207
+ return self.additional_properties[key]
208
+
209
+ def __setitem__(self, key: str, value: Any) -> None:
210
+ self.additional_properties[key] = value
211
+
212
+ def __delitem__(self, key: str) -> None:
213
+ del self.additional_properties[key]
214
+
215
+ def __contains__(self, key: str) -> bool:
216
+ 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_summary_response_data import BudgetSummaryResponseData
9
+
10
+
11
+ T = TypeVar("T", bound="BudgetSummaryResponse")
12
+
13
+
14
+ @_attrs_define
15
+ class BudgetSummaryResponse:
16
+ """
17
+ Attributes:
18
+ data (BudgetSummaryResponseData):
19
+ """
20
+
21
+ data: "BudgetSummaryResponseData"
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_summary_response_data import BudgetSummaryResponseData
40
+
41
+ d = dict(src_dict)
42
+ data = BudgetSummaryResponseData.from_dict(d.pop("data"))
43
+
44
+ budget_summary_response = cls(
45
+ data=data,
46
+ )
47
+
48
+ budget_summary_response.additional_properties = d
49
+ return budget_summary_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,91 @@
1
+ from collections.abc import Mapping
2
+ from typing import TYPE_CHECKING, Any, TypeVar, Union
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ from ynab_cli.adapters.ynab.types import UNSET, Unset
8
+
9
+ if TYPE_CHECKING:
10
+ from ynab_cli.adapters.ynab.models.budget_summary import BudgetSummary
11
+
12
+
13
+ T = TypeVar("T", bound="BudgetSummaryResponseData")
14
+
15
+
16
+ @_attrs_define
17
+ class BudgetSummaryResponseData:
18
+ """
19
+ Attributes:
20
+ budgets (list['BudgetSummary']):
21
+ default_budget (Union[Unset, BudgetSummary]):
22
+ """
23
+
24
+ budgets: list["BudgetSummary"]
25
+ default_budget: Union[Unset, "BudgetSummary"] = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ budgets = []
30
+ for budgets_item_data in self.budgets:
31
+ budgets_item = budgets_item_data.to_dict()
32
+ budgets.append(budgets_item)
33
+
34
+ default_budget: Unset | dict[str, Any] = UNSET
35
+ if not isinstance(self.default_budget, Unset):
36
+ default_budget = self.default_budget.to_dict()
37
+
38
+ field_dict: dict[str, Any] = {}
39
+ field_dict.update(self.additional_properties)
40
+ field_dict.update(
41
+ {
42
+ "budgets": budgets,
43
+ }
44
+ )
45
+ if default_budget is not UNSET:
46
+ field_dict["default_budget"] = default_budget
47
+
48
+ return field_dict
49
+
50
+ @classmethod
51
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
52
+ from ynab_cli.adapters.ynab.models.budget_summary import BudgetSummary
53
+
54
+ d = dict(src_dict)
55
+ budgets = []
56
+ _budgets = d.pop("budgets")
57
+ for budgets_item_data in _budgets:
58
+ budgets_item = BudgetSummary.from_dict(budgets_item_data)
59
+
60
+ budgets.append(budgets_item)
61
+
62
+ _default_budget = d.pop("default_budget", UNSET)
63
+ default_budget: Unset | BudgetSummary
64
+ if isinstance(_default_budget, Unset):
65
+ default_budget = UNSET
66
+ else:
67
+ default_budget = BudgetSummary.from_dict(_default_budget)
68
+
69
+ budget_summary_response_data = cls(
70
+ budgets=budgets,
71
+ default_budget=default_budget,
72
+ )
73
+
74
+ budget_summary_response_data.additional_properties = d
75
+ return budget_summary_response_data
76
+
77
+ @property
78
+ def additional_keys(self) -> list[str]:
79
+ return list(self.additional_properties.keys())
80
+
81
+ def __getitem__(self, key: str) -> Any:
82
+ return self.additional_properties[key]
83
+
84
+ def __setitem__(self, key: str, value: Any) -> None:
85
+ self.additional_properties[key] = value
86
+
87
+ def __delitem__(self, key: str) -> None:
88
+ del self.additional_properties[key]
89
+
90
+ def __contains__(self, key: str) -> bool:
91
+ 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.bulk_response_data import BulkResponseData
9
+
10
+
11
+ T = TypeVar("T", bound="BulkResponse")
12
+
13
+
14
+ @_attrs_define
15
+ class BulkResponse:
16
+ """
17
+ Attributes:
18
+ data (BulkResponseData):
19
+ """
20
+
21
+ data: "BulkResponseData"
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.bulk_response_data import BulkResponseData
40
+
41
+ d = dict(src_dict)
42
+ data = BulkResponseData.from_dict(d.pop("data"))
43
+
44
+ bulk_response = cls(
45
+ data=data,
46
+ )
47
+
48
+ bulk_response.additional_properties = d
49
+ return bulk_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,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.bulk_response_data_bulk import BulkResponseDataBulk
9
+
10
+
11
+ T = TypeVar("T", bound="BulkResponseData")
12
+
13
+
14
+ @_attrs_define
15
+ class BulkResponseData:
16
+ """
17
+ Attributes:
18
+ bulk (BulkResponseDataBulk):
19
+ """
20
+
21
+ bulk: "BulkResponseDataBulk"
22
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23
+
24
+ def to_dict(self) -> dict[str, Any]:
25
+ bulk = self.bulk.to_dict()
26
+
27
+ field_dict: dict[str, Any] = {}
28
+ field_dict.update(self.additional_properties)
29
+ field_dict.update(
30
+ {
31
+ "bulk": bulk,
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.bulk_response_data_bulk import BulkResponseDataBulk
40
+
41
+ d = dict(src_dict)
42
+ bulk = BulkResponseDataBulk.from_dict(d.pop("bulk"))
43
+
44
+ bulk_response_data = cls(
45
+ bulk=bulk,
46
+ )
47
+
48
+ bulk_response_data.additional_properties = d
49
+ return bulk_response_data
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,68 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar, cast
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ T = TypeVar("T", bound="BulkResponseDataBulk")
8
+
9
+
10
+ @_attrs_define
11
+ class BulkResponseDataBulk:
12
+ """
13
+ Attributes:
14
+ transaction_ids (list[str]): The list of Transaction ids that were created.
15
+ duplicate_import_ids (list[str]): If any Transactions were not created because they had an `import_id` matching
16
+ a transaction already on the same account, the specified import_id(s) will be included in this list.
17
+ """
18
+
19
+ transaction_ids: list[str]
20
+ duplicate_import_ids: list[str]
21
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
22
+
23
+ def to_dict(self) -> dict[str, Any]:
24
+ transaction_ids = self.transaction_ids
25
+
26
+ duplicate_import_ids = self.duplicate_import_ids
27
+
28
+ field_dict: dict[str, Any] = {}
29
+ field_dict.update(self.additional_properties)
30
+ field_dict.update(
31
+ {
32
+ "transaction_ids": transaction_ids,
33
+ "duplicate_import_ids": duplicate_import_ids,
34
+ }
35
+ )
36
+
37
+ return field_dict
38
+
39
+ @classmethod
40
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
41
+ d = dict(src_dict)
42
+ transaction_ids = cast(list[str], d.pop("transaction_ids"))
43
+
44
+ duplicate_import_ids = cast(list[str], d.pop("duplicate_import_ids"))
45
+
46
+ bulk_response_data_bulk = cls(
47
+ transaction_ids=transaction_ids,
48
+ duplicate_import_ids=duplicate_import_ids,
49
+ )
50
+
51
+ bulk_response_data_bulk.additional_properties = d
52
+ return bulk_response_data_bulk
53
+
54
+ @property
55
+ def additional_keys(self) -> list[str]:
56
+ return list(self.additional_properties.keys())
57
+
58
+ def __getitem__(self, key: str) -> Any:
59
+ return self.additional_properties[key]
60
+
61
+ def __setitem__(self, key: str, value: Any) -> None:
62
+ self.additional_properties[key] = value
63
+
64
+ def __delitem__(self, key: str) -> None:
65
+ del self.additional_properties[key]
66
+
67
+ def __contains__(self, key: str) -> bool:
68
+ return key in self.additional_properties