lunchmoney-python 2.9.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.
- lunchmoney/__init__.py +205 -0
- lunchmoney/api/__init__.py +16 -0
- lunchmoney/api/categories_api.py +1499 -0
- lunchmoney/api/manual_accounts_api.py +1479 -0
- lunchmoney/api/me_api.py +293 -0
- lunchmoney/api/plaid_accounts_api.py +909 -0
- lunchmoney/api/recurring_items_api.py +702 -0
- lunchmoney/api/summary_api.py +434 -0
- lunchmoney/api/tags_api.py +1465 -0
- lunchmoney/api/transactions_api.py +914 -0
- lunchmoney/api/transactions_bulk_api.py +1527 -0
- lunchmoney/api/transactions_files_api.py +891 -0
- lunchmoney/api/transactions_group_api.py +601 -0
- lunchmoney/api/transactions_split_api.py +616 -0
- lunchmoney/api_client.py +805 -0
- lunchmoney/api_response.py +21 -0
- lunchmoney/configuration.py +620 -0
- lunchmoney/exceptions.py +217 -0
- lunchmoney/models/__init__.py +84 -0
- lunchmoney/models/account_type_enum.py +46 -0
- lunchmoney/models/aligned_category_totals_object.py +108 -0
- lunchmoney/models/aligned_summary_category_object.py +110 -0
- lunchmoney/models/aligned_summary_response_object.py +104 -0
- lunchmoney/models/category_object.py +146 -0
- lunchmoney/models/child_category_object.py +141 -0
- lunchmoney/models/child_transaction_object.py +219 -0
- lunchmoney/models/create_category_request_object.py +137 -0
- lunchmoney/models/create_category_request_object_children_inner.py +159 -0
- lunchmoney/models/create_manual_account_request_object.py +138 -0
- lunchmoney/models/create_manual_account_request_object_balance.py +145 -0
- lunchmoney/models/create_new_transactions_request.py +103 -0
- lunchmoney/models/create_tag_request_object.py +112 -0
- lunchmoney/models/currency_enum.py +198 -0
- lunchmoney/models/delete_category_response_with_dependencies.py +94 -0
- lunchmoney/models/delete_category_response_with_dependencies_dependents.py +98 -0
- lunchmoney/models/delete_tag_response_with_dependencies.py +94 -0
- lunchmoney/models/delete_tag_response_with_dependencies_dependents.py +90 -0
- lunchmoney/models/delete_transactions_request.py +89 -0
- lunchmoney/models/error_response_object.py +98 -0
- lunchmoney/models/error_response_object_errors_inner.py +101 -0
- lunchmoney/models/get_all_categories200_response.py +96 -0
- lunchmoney/models/get_all_manual_accounts200_response.py +96 -0
- lunchmoney/models/get_all_plaid_accounts200_response.py +96 -0
- lunchmoney/models/get_all_recurring200_response.py +96 -0
- lunchmoney/models/get_all_tags200_response.py +96 -0
- lunchmoney/models/get_all_transactions200_response.py +100 -0
- lunchmoney/models/get_all_transactions_created_since_parameter.py +145 -0
- lunchmoney/models/get_budget_summary200_response.py +138 -0
- lunchmoney/models/get_transaction_attachment_url200_response.py +91 -0
- lunchmoney/models/group_transactions_request.py +122 -0
- lunchmoney/models/insert_transaction_object.py +164 -0
- lunchmoney/models/insert_transaction_object_amount.py +145 -0
- lunchmoney/models/insert_transactions_response_object.py +106 -0
- lunchmoney/models/manual_account_object.py +158 -0
- lunchmoney/models/non_aligned_category_totals_object.py +94 -0
- lunchmoney/models/non_aligned_summary_category_object.py +94 -0
- lunchmoney/models/non_aligned_summary_response_object.py +104 -0
- lunchmoney/models/plaid_account_object.py +168 -0
- lunchmoney/models/recurring_object.py +143 -0
- lunchmoney/models/recurring_object_matches.py +105 -0
- lunchmoney/models/recurring_object_matches_found_transactions_inner.py +91 -0
- lunchmoney/models/recurring_object_overrides.py +92 -0
- lunchmoney/models/recurring_object_transaction_criteria.py +149 -0
- lunchmoney/models/skipped_existing_external_id_object.py +108 -0
- lunchmoney/models/split_transaction_object.py +102 -0
- lunchmoney/models/split_transaction_object_amount.py +145 -0
- lunchmoney/models/split_transaction_request.py +97 -0
- lunchmoney/models/summary_category_occurrence_object.py +126 -0
- lunchmoney/models/summary_recurring_transaction_object.py +100 -0
- lunchmoney/models/summary_rollover_pool_adjustment_object.py +98 -0
- lunchmoney/models/summary_rollover_pool_object.py +98 -0
- lunchmoney/models/summary_totals_breakdown_object.py +98 -0
- lunchmoney/models/summary_totals_object.py +97 -0
- lunchmoney/models/tag_object.py +125 -0
- lunchmoney/models/transaction_attachment_object.py +106 -0
- lunchmoney/models/transaction_object.py +229 -0
- lunchmoney/models/update_category_request_object.py +156 -0
- lunchmoney/models/update_manual_account_request_object.py +156 -0
- lunchmoney/models/update_manual_account_request_object_balance.py +145 -0
- lunchmoney/models/update_tag_request_object.py +126 -0
- lunchmoney/models/update_transaction_object.py +228 -0
- lunchmoney/models/update_transaction_object_amount.py +145 -0
- lunchmoney/models/update_transactions200_response.py +96 -0
- lunchmoney/models/update_transactions_request.py +97 -0
- lunchmoney/models/update_transactions_request_transactions_inner.py +228 -0
- lunchmoney/models/user_object.py +106 -0
- lunchmoney/py.typed +0 -0
- lunchmoney/rest.py +259 -0
- lunchmoney_python-2.9.0.dist-info/METADATA +285 -0
- lunchmoney_python-2.9.0.dist-info/RECORD +92 -0
- lunchmoney_python-2.9.0.dist-info/WHEEL +5 -0
- lunchmoney_python-2.9.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Lunch Money API - v2
|
|
5
|
+
|
|
6
|
+
Welcome to the Lunch Money v2 API. A working version of this API is now available through these docs, or directly at: `https://api.lunchmoney.dev/v2` <span class=\"red-text\"><strong>This is in alpha launch of a major API update. It is still subject to change during this alpha review period and bugs may still exist. Users are strongly encouraged to use the mock service or to create a test budget with example data as the first step to interacting with the v2 API.</strong></span> See the [Getting Started Guide](https://alpha.lunchmoney.dev/v2/getting-started) for more information on using a test budget.<br<br> If you are new to the v2 API, you may wish to review the [v2 API Overview of Changes](https://alpha.lunchmoney.dev/v2/changelog). ### Static Mock Server You may also use these docs to explore the API using a static mock server endpoint.<p> This enables users to become familiar with the API without having to create an access token, and eliminates the possibility of modifying real data. <p> To access this endpoint select the second endpoint in the the \"Server\" dropdown to the right. When selected you should see \"Static Mock v2 Lunch Money API Server\".<br> When using this server, set your Bearer token to any string with 11 or more characters. ### Migrating from V1 The v2 API is NOT backwards compatible with the v1 API. Developers are encouraged to review the [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) to understand the changes and plan their migration. ### Acknowledgments If you have been providing feedback on the API during our iterative design process, **THANK YOU**. We are happy to provide the opportunity to finally interact with the working API that was built based on your feedback. ### Useful links: - [Getting Started](https://alpha.lunchmoney.dev/v2/getting-started) - [v2 API Changelog](https://alpha.lunchmoney.dev/v2/changelog) - [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) - [Rate Limits](https://alpha.lunchmoney.dev/v2/rate-limits) - [Current v1 Lunch Money API Documentation](https://lunchmoney.dev) - [Awesome Lunch Money Projects](https://github.com/lunch-money/awesome-lunchmoney?tab=readme-ov-file)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.8.4
|
|
9
|
+
Contact: devsupport@lunchmoney.app
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from lunchmoney.models.split_transaction_object import SplitTransactionObject
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class SplitTransactionRequest(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
SplitTransactionRequest
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
child_transactions: Annotated[List[SplitTransactionObject], Field(min_length=2, max_length=500)] = Field(description="List of child transactions to create. The sum of the `amounts` must match the split transaction amount.")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["child_transactions"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of SplitTransactionRequest from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in child_transactions (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.child_transactions:
|
|
77
|
+
for _item_child_transactions in self.child_transactions:
|
|
78
|
+
if _item_child_transactions:
|
|
79
|
+
_items.append(_item_child_transactions.to_dict())
|
|
80
|
+
_dict['child_transactions'] = _items
|
|
81
|
+
return _dict
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
85
|
+
"""Create an instance of SplitTransactionRequest from a dict"""
|
|
86
|
+
if obj is None:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
if not isinstance(obj, dict):
|
|
90
|
+
return cls.model_validate(obj)
|
|
91
|
+
|
|
92
|
+
_obj = cls.model_validate({
|
|
93
|
+
"child_transactions": [SplitTransactionObject.from_dict(_item) for _item in obj["child_transactions"]] if obj.get("child_transactions") is not None else None
|
|
94
|
+
})
|
|
95
|
+
return _obj
|
|
96
|
+
|
|
97
|
+
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Lunch Money API - v2
|
|
5
|
+
|
|
6
|
+
Welcome to the Lunch Money v2 API. A working version of this API is now available through these docs, or directly at: `https://api.lunchmoney.dev/v2` <span class=\"red-text\"><strong>This is in alpha launch of a major API update. It is still subject to change during this alpha review period and bugs may still exist. Users are strongly encouraged to use the mock service or to create a test budget with example data as the first step to interacting with the v2 API.</strong></span> See the [Getting Started Guide](https://alpha.lunchmoney.dev/v2/getting-started) for more information on using a test budget.<br<br> If you are new to the v2 API, you may wish to review the [v2 API Overview of Changes](https://alpha.lunchmoney.dev/v2/changelog). ### Static Mock Server You may also use these docs to explore the API using a static mock server endpoint.<p> This enables users to become familiar with the API without having to create an access token, and eliminates the possibility of modifying real data. <p> To access this endpoint select the second endpoint in the the \"Server\" dropdown to the right. When selected you should see \"Static Mock v2 Lunch Money API Server\".<br> When using this server, set your Bearer token to any string with 11 or more characters. ### Migrating from V1 The v2 API is NOT backwards compatible with the v1 API. Developers are encouraged to review the [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) to understand the changes and plan their migration. ### Acknowledgments If you have been providing feedback on the API during our iterative design process, **THANK YOU**. We are happy to provide the opportunity to finally interact with the working API that was built based on your feedback. ### Useful links: - [Getting Started](https://alpha.lunchmoney.dev/v2/getting-started) - [v2 API Changelog](https://alpha.lunchmoney.dev/v2/changelog) - [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) - [Rate Limits](https://alpha.lunchmoney.dev/v2/rate-limits) - [Current v1 Lunch Money API Documentation](https://lunchmoney.dev) - [Awesome Lunch Money Projects](https://github.com/lunch-money/awesome-lunchmoney?tab=readme-ov-file)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.8.4
|
|
9
|
+
Contact: devsupport@lunchmoney.app
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from datetime import date
|
|
22
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
|
|
23
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
24
|
+
from lunchmoney.models.currency_enum import CurrencyEnum
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class SummaryCategoryOccurrenceObject(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Per period budget activity for the each budget period within the given date range.<br> This is only returned if the query parameter `include_occurrences` is set to `true`.
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
in_range: StrictBool = Field(description="true if this occurrence is within the given date range.")
|
|
33
|
+
start_date: date = Field(description="The start date of the budget period.")
|
|
34
|
+
end_date: date = Field(description="The end date of the budget period.")
|
|
35
|
+
other_activity: Union[StrictFloat, StrictInt] = Field(description="Total non recurring activity, in the user's default currency, for the category within the given date range. The total activity for the category is the sum of this and the recurring_activity.")
|
|
36
|
+
recurring_activity: Union[StrictFloat, StrictInt] = Field(description="Total recurring activity, in the user's default currency, for the category within the given date range. The total activity for the category is the sum of this and the other_activity.")
|
|
37
|
+
budgeted: Optional[Union[StrictFloat, StrictInt]] = Field(description="Total budgeted amount, in the user's default currency, for the category within the given date range, or null if the category is not budgeted.")
|
|
38
|
+
budgeted_amount: Optional[StrictStr] = Field(description="Total budgeted amount in the budgeted currency for the category within the given date or null if the category is not budgeted.")
|
|
39
|
+
budgeted_currency: Optional[CurrencyEnum] = Field(description="Currency of the budgeted amount.")
|
|
40
|
+
notes: Optional[StrictStr] = Field(description="Any notes added in the Web UI for the budget period.")
|
|
41
|
+
__properties: ClassVar[List[str]] = ["in_range", "start_date", "end_date", "other_activity", "recurring_activity", "budgeted", "budgeted_amount", "budgeted_currency", "notes"]
|
|
42
|
+
|
|
43
|
+
model_config = ConfigDict(
|
|
44
|
+
populate_by_name=True,
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def to_str(self) -> str:
|
|
51
|
+
"""Returns the string representation of the model using alias"""
|
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
57
|
+
return json.dumps(self.to_dict())
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
|
+
"""Create an instance of SummaryCategoryOccurrenceObject from a JSON string"""
|
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
|
66
|
+
|
|
67
|
+
This has the following differences from calling pydantic's
|
|
68
|
+
`self.model_dump(by_alias=True)`:
|
|
69
|
+
|
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
|
71
|
+
were set at model initialization. Other fields with value `None`
|
|
72
|
+
are ignored.
|
|
73
|
+
"""
|
|
74
|
+
excluded_fields: Set[str] = set([
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
# set to None if budgeted (nullable) is None
|
|
83
|
+
# and model_fields_set contains the field
|
|
84
|
+
if self.budgeted is None and "budgeted" in self.model_fields_set:
|
|
85
|
+
_dict['budgeted'] = None
|
|
86
|
+
|
|
87
|
+
# set to None if budgeted_amount (nullable) is None
|
|
88
|
+
# and model_fields_set contains the field
|
|
89
|
+
if self.budgeted_amount is None and "budgeted_amount" in self.model_fields_set:
|
|
90
|
+
_dict['budgeted_amount'] = None
|
|
91
|
+
|
|
92
|
+
# set to None if budgeted_currency (nullable) is None
|
|
93
|
+
# and model_fields_set contains the field
|
|
94
|
+
if self.budgeted_currency is None and "budgeted_currency" in self.model_fields_set:
|
|
95
|
+
_dict['budgeted_currency'] = None
|
|
96
|
+
|
|
97
|
+
# set to None if notes (nullable) is None
|
|
98
|
+
# and model_fields_set contains the field
|
|
99
|
+
if self.notes is None and "notes" in self.model_fields_set:
|
|
100
|
+
_dict['notes'] = None
|
|
101
|
+
|
|
102
|
+
return _dict
|
|
103
|
+
|
|
104
|
+
@classmethod
|
|
105
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
106
|
+
"""Create an instance of SummaryCategoryOccurrenceObject from a dict"""
|
|
107
|
+
if obj is None:
|
|
108
|
+
return None
|
|
109
|
+
|
|
110
|
+
if not isinstance(obj, dict):
|
|
111
|
+
return cls.model_validate(obj)
|
|
112
|
+
|
|
113
|
+
_obj = cls.model_validate({
|
|
114
|
+
"in_range": obj.get("in_range"),
|
|
115
|
+
"start_date": obj.get("start_date"),
|
|
116
|
+
"end_date": obj.get("end_date"),
|
|
117
|
+
"other_activity": obj.get("other_activity"),
|
|
118
|
+
"recurring_activity": obj.get("recurring_activity"),
|
|
119
|
+
"budgeted": obj.get("budgeted"),
|
|
120
|
+
"budgeted_amount": obj.get("budgeted_amount"),
|
|
121
|
+
"budgeted_currency": obj.get("budgeted_currency"),
|
|
122
|
+
"notes": obj.get("notes")
|
|
123
|
+
})
|
|
124
|
+
return _obj
|
|
125
|
+
|
|
126
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Lunch Money API - v2
|
|
5
|
+
|
|
6
|
+
Welcome to the Lunch Money v2 API. A working version of this API is now available through these docs, or directly at: `https://api.lunchmoney.dev/v2` <span class=\"red-text\"><strong>This is in alpha launch of a major API update. It is still subject to change during this alpha review period and bugs may still exist. Users are strongly encouraged to use the mock service or to create a test budget with example data as the first step to interacting with the v2 API.</strong></span> See the [Getting Started Guide](https://alpha.lunchmoney.dev/v2/getting-started) for more information on using a test budget.<br<br> If you are new to the v2 API, you may wish to review the [v2 API Overview of Changes](https://alpha.lunchmoney.dev/v2/changelog). ### Static Mock Server You may also use these docs to explore the API using a static mock server endpoint.<p> This enables users to become familiar with the API without having to create an access token, and eliminates the possibility of modifying real data. <p> To access this endpoint select the second endpoint in the the \"Server\" dropdown to the right. When selected you should see \"Static Mock v2 Lunch Money API Server\".<br> When using this server, set your Bearer token to any string with 11 or more characters. ### Migrating from V1 The v2 API is NOT backwards compatible with the v1 API. Developers are encouraged to review the [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) to understand the changes and plan their migration. ### Acknowledgments If you have been providing feedback on the API during our iterative design process, **THANK YOU**. We are happy to provide the opportunity to finally interact with the working API that was built based on your feedback. ### Useful links: - [Getting Started](https://alpha.lunchmoney.dev/v2/getting-started) - [v2 API Changelog](https://alpha.lunchmoney.dev/v2/changelog) - [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) - [Rate Limits](https://alpha.lunchmoney.dev/v2/rate-limits) - [Current v1 Lunch Money API Documentation](https://lunchmoney.dev) - [Awesome Lunch Money Projects](https://github.com/lunch-money/awesome-lunchmoney?tab=readme-ov-file)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.8.4
|
|
9
|
+
Contact: devsupport@lunchmoney.app
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from datetime import date
|
|
22
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
|
|
23
|
+
from typing import Any, ClassVar, Dict, List, Union
|
|
24
|
+
from lunchmoney.models.currency_enum import CurrencyEnum
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class SummaryRecurringTransactionObject(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
A single transaction associated with a recurring item. I don't think we will expose this in the summary since it's gettable by querying the recurring_id
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
var_date: date = Field(alias="date")
|
|
33
|
+
category_id: StrictInt
|
|
34
|
+
payee: StrictStr
|
|
35
|
+
to_base: Union[StrictFloat, StrictInt]
|
|
36
|
+
amount: StrictStr
|
|
37
|
+
currency: CurrencyEnum
|
|
38
|
+
__properties: ClassVar[List[str]] = ["date", "category_id", "payee", "to_base", "amount", "currency"]
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
populate_by_name=True,
|
|
42
|
+
validate_assignment=True,
|
|
43
|
+
protected_namespaces=(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of SummaryRecurringTransactionObject from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of SummaryRecurringTransactionObject from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate({
|
|
91
|
+
"date": obj.get("date"),
|
|
92
|
+
"category_id": obj.get("category_id"),
|
|
93
|
+
"payee": obj.get("payee"),
|
|
94
|
+
"to_base": obj.get("to_base"),
|
|
95
|
+
"amount": obj.get("amount"),
|
|
96
|
+
"currency": obj.get("currency")
|
|
97
|
+
})
|
|
98
|
+
return _obj
|
|
99
|
+
|
|
100
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Lunch Money API - v2
|
|
5
|
+
|
|
6
|
+
Welcome to the Lunch Money v2 API. A working version of this API is now available through these docs, or directly at: `https://api.lunchmoney.dev/v2` <span class=\"red-text\"><strong>This is in alpha launch of a major API update. It is still subject to change during this alpha review period and bugs may still exist. Users are strongly encouraged to use the mock service or to create a test budget with example data as the first step to interacting with the v2 API.</strong></span> See the [Getting Started Guide](https://alpha.lunchmoney.dev/v2/getting-started) for more information on using a test budget.<br<br> If you are new to the v2 API, you may wish to review the [v2 API Overview of Changes](https://alpha.lunchmoney.dev/v2/changelog). ### Static Mock Server You may also use these docs to explore the API using a static mock server endpoint.<p> This enables users to become familiar with the API without having to create an access token, and eliminates the possibility of modifying real data. <p> To access this endpoint select the second endpoint in the the \"Server\" dropdown to the right. When selected you should see \"Static Mock v2 Lunch Money API Server\".<br> When using this server, set your Bearer token to any string with 11 or more characters. ### Migrating from V1 The v2 API is NOT backwards compatible with the v1 API. Developers are encouraged to review the [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) to understand the changes and plan their migration. ### Acknowledgments If you have been providing feedback on the API during our iterative design process, **THANK YOU**. We are happy to provide the opportunity to finally interact with the working API that was built based on your feedback. ### Useful links: - [Getting Started](https://alpha.lunchmoney.dev/v2/getting-started) - [v2 API Changelog](https://alpha.lunchmoney.dev/v2/changelog) - [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) - [Rate Limits](https://alpha.lunchmoney.dev/v2/rate-limits) - [Current v1 Lunch Money API Documentation](https://lunchmoney.dev) - [Awesome Lunch Money Projects](https://github.com/lunch-money/awesome-lunchmoney?tab=readme-ov-file)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.8.4
|
|
9
|
+
Contact: devsupport@lunchmoney.app
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from datetime import date
|
|
22
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
|
|
23
|
+
from typing import Any, ClassVar, Dict, List, Union
|
|
24
|
+
from lunchmoney.models.currency_enum import CurrencyEnum
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class SummaryRolloverPoolAdjustmentObject(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
The date and adjusted balance of the rollover pool at the time of the adjustment.
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
in_range: StrictBool = Field(description="true if this rollover pool adjustment is for a budget period that falls within the given date range.")
|
|
33
|
+
var_date: date = Field(alias="date")
|
|
34
|
+
amount: StrictStr = Field(description="Amount of the rollover pool at the time of the adjustment.")
|
|
35
|
+
currency: CurrencyEnum = Field(description="Currency of the rollover pool at the time of the adjustment.")
|
|
36
|
+
to_base: Union[StrictFloat, StrictInt] = Field(description="Amount of the rollover pool converted to the user's default currency.")
|
|
37
|
+
__properties: ClassVar[List[str]] = ["in_range", "date", "amount", "currency", "to_base"]
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
populate_by_name=True,
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
53
|
+
return json.dumps(self.to_dict())
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
|
+
"""Create an instance of SummaryRolloverPoolAdjustmentObject from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
|
62
|
+
|
|
63
|
+
This has the following differences from calling pydantic's
|
|
64
|
+
`self.model_dump(by_alias=True)`:
|
|
65
|
+
|
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
|
67
|
+
were set at model initialization. Other fields with value `None`
|
|
68
|
+
are ignored.
|
|
69
|
+
"""
|
|
70
|
+
excluded_fields: Set[str] = set([
|
|
71
|
+
])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of SummaryRolloverPoolAdjustmentObject from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate({
|
|
90
|
+
"in_range": obj.get("in_range"),
|
|
91
|
+
"date": obj.get("date"),
|
|
92
|
+
"amount": obj.get("amount"),
|
|
93
|
+
"currency": obj.get("currency"),
|
|
94
|
+
"to_base": obj.get("to_base")
|
|
95
|
+
})
|
|
96
|
+
return _obj
|
|
97
|
+
|
|
98
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Lunch Money API - v2
|
|
5
|
+
|
|
6
|
+
Welcome to the Lunch Money v2 API. A working version of this API is now available through these docs, or directly at: `https://api.lunchmoney.dev/v2` <span class=\"red-text\"><strong>This is in alpha launch of a major API update. It is still subject to change during this alpha review period and bugs may still exist. Users are strongly encouraged to use the mock service or to create a test budget with example data as the first step to interacting with the v2 API.</strong></span> See the [Getting Started Guide](https://alpha.lunchmoney.dev/v2/getting-started) for more information on using a test budget.<br<br> If you are new to the v2 API, you may wish to review the [v2 API Overview of Changes](https://alpha.lunchmoney.dev/v2/changelog). ### Static Mock Server You may also use these docs to explore the API using a static mock server endpoint.<p> This enables users to become familiar with the API without having to create an access token, and eliminates the possibility of modifying real data. <p> To access this endpoint select the second endpoint in the the \"Server\" dropdown to the right. When selected you should see \"Static Mock v2 Lunch Money API Server\".<br> When using this server, set your Bearer token to any string with 11 or more characters. ### Migrating from V1 The v2 API is NOT backwards compatible with the v1 API. Developers are encouraged to review the [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) to understand the changes and plan their migration. ### Acknowledgments If you have been providing feedback on the API during our iterative design process, **THANK YOU**. We are happy to provide the opportunity to finally interact with the working API that was built based on your feedback. ### Useful links: - [Getting Started](https://alpha.lunchmoney.dev/v2/getting-started) - [v2 API Changelog](https://alpha.lunchmoney.dev/v2/changelog) - [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) - [Rate Limits](https://alpha.lunchmoney.dev/v2/rate-limits) - [Current v1 Lunch Money API Documentation](https://lunchmoney.dev) - [Awesome Lunch Money Projects](https://github.com/lunch-money/awesome-lunchmoney?tab=readme-ov-file)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.8.4
|
|
9
|
+
Contact: devsupport@lunchmoney.app
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Union
|
|
23
|
+
from lunchmoney.models.summary_rollover_pool_adjustment_object import SummaryRolloverPoolAdjustmentObject
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class SummaryRolloverPoolObject(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
Summary of the current rollover pool balance and all previous adjustments.<br> Only present if the `include_rollover_pool` query parameter is set to `true`.
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
budgeted_to_base: Union[StrictFloat, StrictInt] = Field(description="Amount of funds, in the user's default currency, currently available to rollover.")
|
|
32
|
+
all_adjustments: List[SummaryRolloverPoolAdjustmentObject] = Field(description="List of previous adjustments to the rollover pool.")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["budgeted_to_base", "all_adjustments"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of SummaryRolloverPoolObject from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in all_adjustments (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.all_adjustments:
|
|
77
|
+
for _item_all_adjustments in self.all_adjustments:
|
|
78
|
+
if _item_all_adjustments:
|
|
79
|
+
_items.append(_item_all_adjustments.to_dict())
|
|
80
|
+
_dict['all_adjustments'] = _items
|
|
81
|
+
return _dict
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
85
|
+
"""Create an instance of SummaryRolloverPoolObject from a dict"""
|
|
86
|
+
if obj is None:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
if not isinstance(obj, dict):
|
|
90
|
+
return cls.model_validate(obj)
|
|
91
|
+
|
|
92
|
+
_obj = cls.model_validate({
|
|
93
|
+
"budgeted_to_base": obj.get("budgeted_to_base"),
|
|
94
|
+
"all_adjustments": [SummaryRolloverPoolAdjustmentObject.from_dict(_item) for _item in obj["all_adjustments"]] if obj.get("all_adjustments") is not None else None
|
|
95
|
+
})
|
|
96
|
+
return _obj
|
|
97
|
+
|
|
98
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Lunch Money API - v2
|
|
5
|
+
|
|
6
|
+
Welcome to the Lunch Money v2 API. A working version of this API is now available through these docs, or directly at: `https://api.lunchmoney.dev/v2` <span class=\"red-text\"><strong>This is in alpha launch of a major API update. It is still subject to change during this alpha review period and bugs may still exist. Users are strongly encouraged to use the mock service or to create a test budget with example data as the first step to interacting with the v2 API.</strong></span> See the [Getting Started Guide](https://alpha.lunchmoney.dev/v2/getting-started) for more information on using a test budget.<br<br> If you are new to the v2 API, you may wish to review the [v2 API Overview of Changes](https://alpha.lunchmoney.dev/v2/changelog). ### Static Mock Server You may also use these docs to explore the API using a static mock server endpoint.<p> This enables users to become familiar with the API without having to create an access token, and eliminates the possibility of modifying real data. <p> To access this endpoint select the second endpoint in the the \"Server\" dropdown to the right. When selected you should see \"Static Mock v2 Lunch Money API Server\".<br> When using this server, set your Bearer token to any string with 11 or more characters. ### Migrating from V1 The v2 API is NOT backwards compatible with the v1 API. Developers are encouraged to review the [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) to understand the changes and plan their migration. ### Acknowledgments If you have been providing feedback on the API during our iterative design process, **THANK YOU**. We are happy to provide the opportunity to finally interact with the working API that was built based on your feedback. ### Useful links: - [Getting Started](https://alpha.lunchmoney.dev/v2/getting-started) - [v2 API Changelog](https://alpha.lunchmoney.dev/v2/changelog) - [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) - [Rate Limits](https://alpha.lunchmoney.dev/v2/rate-limits) - [Current v1 Lunch Money API Documentation](https://lunchmoney.dev) - [Awesome Lunch Money Projects](https://github.com/lunch-money/awesome-lunchmoney?tab=readme-ov-file)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.8.4
|
|
9
|
+
Contact: devsupport@lunchmoney.app
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class SummaryTotalsBreakdownObject(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
SummaryTotalsBreakdownObject
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
other_activity: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Total amount, in the user's default currency, of non recurring activity for the given date range.")
|
|
31
|
+
recurring_activity: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Total amount, in the user's default currency, of recurring activity that has occurred for the given date range.")
|
|
32
|
+
recurring_remaining: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Total amount, in the user's default currency, of expected recurring activity that has not yet occurred.")
|
|
33
|
+
uncategorized: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Total amount, in the user's default currency, of non recurring activity coming from un-categorized transactions.")
|
|
34
|
+
uncategorized_count: Optional[StrictInt] = Field(default=None, description="Number of un-categorized transactions for the given date range.")
|
|
35
|
+
uncategorized_recurring: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Total amount, in the user's default currency, of recurring activity coming from un-categorized transactions.")
|
|
36
|
+
__properties: ClassVar[List[str]] = ["other_activity", "recurring_activity", "recurring_remaining", "uncategorized", "uncategorized_count", "uncategorized_recurring"]
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
populate_by_name=True,
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
52
|
+
return json.dumps(self.to_dict())
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
56
|
+
"""Create an instance of SummaryTotalsBreakdownObject from a JSON string"""
|
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
|
58
|
+
|
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
|
61
|
+
|
|
62
|
+
This has the following differences from calling pydantic's
|
|
63
|
+
`self.model_dump(by_alias=True)`:
|
|
64
|
+
|
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
|
66
|
+
were set at model initialization. Other fields with value `None`
|
|
67
|
+
are ignored.
|
|
68
|
+
"""
|
|
69
|
+
excluded_fields: Set[str] = set([
|
|
70
|
+
])
|
|
71
|
+
|
|
72
|
+
_dict = self.model_dump(
|
|
73
|
+
by_alias=True,
|
|
74
|
+
exclude=excluded_fields,
|
|
75
|
+
exclude_none=True,
|
|
76
|
+
)
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of SummaryTotalsBreakdownObject from a dict"""
|
|
82
|
+
if obj is None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if not isinstance(obj, dict):
|
|
86
|
+
return cls.model_validate(obj)
|
|
87
|
+
|
|
88
|
+
_obj = cls.model_validate({
|
|
89
|
+
"other_activity": obj.get("other_activity"),
|
|
90
|
+
"recurring_activity": obj.get("recurring_activity"),
|
|
91
|
+
"recurring_remaining": obj.get("recurring_remaining"),
|
|
92
|
+
"uncategorized": obj.get("uncategorized"),
|
|
93
|
+
"uncategorized_count": obj.get("uncategorized_count"),
|
|
94
|
+
"uncategorized_recurring": obj.get("uncategorized_recurring")
|
|
95
|
+
})
|
|
96
|
+
return _obj
|
|
97
|
+
|
|
98
|
+
|