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,228 @@
|
|
|
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, datetime
|
|
22
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
|
|
23
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
24
|
+
from typing_extensions import Annotated
|
|
25
|
+
from lunchmoney.models.child_transaction_object import ChildTransactionObject
|
|
26
|
+
from lunchmoney.models.currency_enum import CurrencyEnum
|
|
27
|
+
from lunchmoney.models.update_transaction_object_amount import UpdateTransactionObjectAmount
|
|
28
|
+
from typing import Optional, Set
|
|
29
|
+
from typing_extensions import Self
|
|
30
|
+
|
|
31
|
+
class UpdateTransactionObject(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
UpdateTransactionObject
|
|
34
|
+
""" # noqa: E501
|
|
35
|
+
id: Optional[StrictInt] = Field(default=None, description="System defined unique identifier of this transaction. Ignored if set.")
|
|
36
|
+
var_date: Optional[date] = Field(default=None, description="Date of transaction in ISO 8601 format", alias="date")
|
|
37
|
+
amount: Optional[UpdateTransactionObjectAmount] = None
|
|
38
|
+
currency: Optional[CurrencyEnum] = Field(default=None, description="Three-letter lowercase currency code of the transaction in ISO 4217 format.<br> May not be updated on transactions that belong to a synced account with the \"Allow Modifications to Transactions\" property disabled.")
|
|
39
|
+
recurring_id: Optional[StrictInt] = Field(default=None, description="The unique identifier of the associated recurring item that this transaction matches.")
|
|
40
|
+
payee: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=140)]] = Field(default=None, description="The new payee for the transaction. ")
|
|
41
|
+
category_id: Optional[StrictInt] = Field(default=None, description="Unique identifier of the category for this transaction. Set this to null to clear the transaction's category.")
|
|
42
|
+
notes: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=350)]] = Field(default=None, description="New notes for the transaction. Set this to an empty string to clear the existing notes. ")
|
|
43
|
+
manual_account_id: Optional[StrictInt] = Field(default=None, description="The unique identifier of the manual account associated with this transaction. Set this to null to disassociate the transaction with an account. If set `plaid_account_id` may not also be set to a non null value. Moving an existing transaction to to another account will not work if the transaction belongs to a synced account who's \"Allow Modifications to Transactions\" property is not set.")
|
|
44
|
+
plaid_account_id: Optional[StrictInt] = Field(default=None, description="The unique identifier of the plaid account associated with this transaction. If set `manual_account_id` may not also be set to a non null value. Attempting to modify this on a transaction associated with a Plaid account will not work if the account's \"Allow Modifications to Transactions\" property is not set. Similarly, this cannot be set to an id associated with this type of locked Plaid account.")
|
|
45
|
+
tag_ids: Optional[List[StrictInt]] = Field(default=None, description="A list of tag_ids for the tags associated with this transaction. If set, this property will overwrite any existing tags. Use `additional_tag_ids` to add tags to the existing transaction's tags. Set this to an empty array to remove all tags from a transaction. If set `additional_tag_ids` may not be set.")
|
|
46
|
+
additional_tag_ids: Optional[List[StrictInt]] = Field(default=None, description="A list of tag_ids for the tags associated with this transaction. If set, the tags listed in this property be added to any existing transaction tags. Use `tag_ids` to overwrite or clear transaction tags. If set `tag_ids` may not be set.")
|
|
47
|
+
external_id: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=75)]] = Field(default=None, description="A user-defined external ID for the transaction. The update will fail if the transaction does not also have a `manual_account_id` or if there is already an existing transaction with the same `manual_account_id`/`external_id` combination.")
|
|
48
|
+
custom_metadata: Optional[Dict[str, Any]] = Field(default=None, description="User defined JSON data that can be set or cleared via the API.")
|
|
49
|
+
status: Optional[StrictStr] = Field(default=None, description="Status of the transaction, may be one of: - `reviewed`: User has reviewed the transaction, or it was automatically marked as reviewed due to reviewed recurring_item logic - `unreviewed`: User has not reviewed the transaction and it does not match any reviewed recurring_items. ")
|
|
50
|
+
to_base: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="System defined amount of this transaction in the user's primary currency. Ignored if set. Use `amount` to update the amount in the transaction.")
|
|
51
|
+
is_pending: Optional[StrictBool] = Field(default=None, description="System defined flag set for pending transactions. Ignored if set.")
|
|
52
|
+
plaid_metadata: Optional[Dict[str, Any]] = Field(default=None, description="System set metadata from a Plaid account sync. Ignored if set.")
|
|
53
|
+
created_at: Optional[datetime] = Field(default=None, description="System defined date and time of when the transaction was created. Ignored if set.")
|
|
54
|
+
updated_at: Optional[datetime] = Field(default=None, description="System defined date and time of when the transaction was last updated. Ignored if set.")
|
|
55
|
+
is_split_parent: Optional[StrictBool] = Field(default=None, description="System defined boolean indicating if this transaction was split. To split or unsplit a transaction use the `/transactions/split` endpoint. Ignored if set.")
|
|
56
|
+
children: Optional[List[ChildTransactionObject]] = Field(default=None, description="An array of child transactions that exists when a transaction has been split or if the transaction is a group. Split")
|
|
57
|
+
split_parent_id: Optional[StrictInt] = Field(default=None, description="A transaction ID if this is a split transaction. Split transactions may not be modified this API. Use the `transactions/split` endpoint instead. Ignored if set.")
|
|
58
|
+
is_group_parent: Optional[StrictBool] = Field(default=None, description="System defined boolean indicating if this transaction represents a group of transactions. Grouped transactions may not be modified with this API. Use the `transactions/group` endpoint instead. Ignored if set.")
|
|
59
|
+
group_parent_id: Optional[StrictInt] = Field(default=None, description="A transaction group ID if this transaction is part of a group. Grouped transactions may not be modified with this API. Use the `transactions/group` endpoint instead. Ignored if set.")
|
|
60
|
+
source: Optional[StrictStr] = Field(default=None, description="System defined original source of the transaction. Ignored if set. ")
|
|
61
|
+
__properties: ClassVar[List[str]] = ["id", "date", "amount", "currency", "recurring_id", "payee", "category_id", "notes", "manual_account_id", "plaid_account_id", "tag_ids", "additional_tag_ids", "external_id", "custom_metadata", "status", "to_base", "is_pending", "plaid_metadata", "created_at", "updated_at", "is_split_parent", "children", "split_parent_id", "is_group_parent", "group_parent_id", "source"]
|
|
62
|
+
|
|
63
|
+
@field_validator('status')
|
|
64
|
+
def status_validate_enum(cls, value):
|
|
65
|
+
"""Validates the enum"""
|
|
66
|
+
if value is None:
|
|
67
|
+
return value
|
|
68
|
+
|
|
69
|
+
if value not in set(['reviewed', 'unreviewed']):
|
|
70
|
+
raise ValueError("must be one of enum values ('reviewed', 'unreviewed')")
|
|
71
|
+
return value
|
|
72
|
+
|
|
73
|
+
@field_validator('source')
|
|
74
|
+
def source_validate_enum(cls, value):
|
|
75
|
+
"""Validates the enum"""
|
|
76
|
+
if value is None:
|
|
77
|
+
return value
|
|
78
|
+
|
|
79
|
+
if value not in set(['api', 'csv', 'manual', 'merge', 'plaid', 'recurring', 'rule', 'split', 'user']):
|
|
80
|
+
raise ValueError("must be one of enum values ('api', 'csv', 'manual', 'merge', 'plaid', 'recurring', 'rule', 'split', 'user')")
|
|
81
|
+
return value
|
|
82
|
+
|
|
83
|
+
model_config = ConfigDict(
|
|
84
|
+
populate_by_name=True,
|
|
85
|
+
validate_assignment=True,
|
|
86
|
+
protected_namespaces=(),
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def to_str(self) -> str:
|
|
91
|
+
"""Returns the string representation of the model using alias"""
|
|
92
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
93
|
+
|
|
94
|
+
def to_json(self) -> str:
|
|
95
|
+
"""Returns the JSON representation of the model using alias"""
|
|
96
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
97
|
+
return json.dumps(self.to_dict())
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
101
|
+
"""Create an instance of UpdateTransactionObject from a JSON string"""
|
|
102
|
+
return cls.from_dict(json.loads(json_str))
|
|
103
|
+
|
|
104
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
105
|
+
"""Return the dictionary representation of the model using alias.
|
|
106
|
+
|
|
107
|
+
This has the following differences from calling pydantic's
|
|
108
|
+
`self.model_dump(by_alias=True)`:
|
|
109
|
+
|
|
110
|
+
* `None` is only added to the output dict for nullable fields that
|
|
111
|
+
were set at model initialization. Other fields with value `None`
|
|
112
|
+
are ignored.
|
|
113
|
+
"""
|
|
114
|
+
excluded_fields: Set[str] = set([
|
|
115
|
+
])
|
|
116
|
+
|
|
117
|
+
_dict = self.model_dump(
|
|
118
|
+
by_alias=True,
|
|
119
|
+
exclude=excluded_fields,
|
|
120
|
+
exclude_none=True,
|
|
121
|
+
)
|
|
122
|
+
# override the default output from pydantic by calling `to_dict()` of amount
|
|
123
|
+
if self.amount:
|
|
124
|
+
_dict['amount'] = self.amount.to_dict()
|
|
125
|
+
# override the default output from pydantic by calling `to_dict()` of each item in children (list)
|
|
126
|
+
_items = []
|
|
127
|
+
if self.children:
|
|
128
|
+
for _item_children in self.children:
|
|
129
|
+
if _item_children:
|
|
130
|
+
_items.append(_item_children.to_dict())
|
|
131
|
+
_dict['children'] = _items
|
|
132
|
+
# set to None if recurring_id (nullable) is None
|
|
133
|
+
# and model_fields_set contains the field
|
|
134
|
+
if self.recurring_id is None and "recurring_id" in self.model_fields_set:
|
|
135
|
+
_dict['recurring_id'] = None
|
|
136
|
+
|
|
137
|
+
# set to None if category_id (nullable) is None
|
|
138
|
+
# and model_fields_set contains the field
|
|
139
|
+
if self.category_id is None and "category_id" in self.model_fields_set:
|
|
140
|
+
_dict['category_id'] = None
|
|
141
|
+
|
|
142
|
+
# set to None if notes (nullable) is None
|
|
143
|
+
# and model_fields_set contains the field
|
|
144
|
+
if self.notes is None and "notes" in self.model_fields_set:
|
|
145
|
+
_dict['notes'] = None
|
|
146
|
+
|
|
147
|
+
# set to None if manual_account_id (nullable) is None
|
|
148
|
+
# and model_fields_set contains the field
|
|
149
|
+
if self.manual_account_id is None and "manual_account_id" in self.model_fields_set:
|
|
150
|
+
_dict['manual_account_id'] = None
|
|
151
|
+
|
|
152
|
+
# set to None if plaid_account_id (nullable) is None
|
|
153
|
+
# and model_fields_set contains the field
|
|
154
|
+
if self.plaid_account_id is None and "plaid_account_id" in self.model_fields_set:
|
|
155
|
+
_dict['plaid_account_id'] = None
|
|
156
|
+
|
|
157
|
+
# set to None if external_id (nullable) is None
|
|
158
|
+
# and model_fields_set contains the field
|
|
159
|
+
if self.external_id is None and "external_id" in self.model_fields_set:
|
|
160
|
+
_dict['external_id'] = None
|
|
161
|
+
|
|
162
|
+
# set to None if custom_metadata (nullable) is None
|
|
163
|
+
# and model_fields_set contains the field
|
|
164
|
+
if self.custom_metadata is None and "custom_metadata" in self.model_fields_set:
|
|
165
|
+
_dict['custom_metadata'] = None
|
|
166
|
+
|
|
167
|
+
# set to None if plaid_metadata (nullable) is None
|
|
168
|
+
# and model_fields_set contains the field
|
|
169
|
+
if self.plaid_metadata is None and "plaid_metadata" in self.model_fields_set:
|
|
170
|
+
_dict['plaid_metadata'] = None
|
|
171
|
+
|
|
172
|
+
# set to None if split_parent_id (nullable) is None
|
|
173
|
+
# and model_fields_set contains the field
|
|
174
|
+
if self.split_parent_id is None and "split_parent_id" in self.model_fields_set:
|
|
175
|
+
_dict['split_parent_id'] = None
|
|
176
|
+
|
|
177
|
+
# set to None if group_parent_id (nullable) is None
|
|
178
|
+
# and model_fields_set contains the field
|
|
179
|
+
if self.group_parent_id is None and "group_parent_id" in self.model_fields_set:
|
|
180
|
+
_dict['group_parent_id'] = None
|
|
181
|
+
|
|
182
|
+
# set to None if source (nullable) is None
|
|
183
|
+
# and model_fields_set contains the field
|
|
184
|
+
if self.source is None and "source" in self.model_fields_set:
|
|
185
|
+
_dict['source'] = None
|
|
186
|
+
|
|
187
|
+
return _dict
|
|
188
|
+
|
|
189
|
+
@classmethod
|
|
190
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
191
|
+
"""Create an instance of UpdateTransactionObject from a dict"""
|
|
192
|
+
if obj is None:
|
|
193
|
+
return None
|
|
194
|
+
|
|
195
|
+
if not isinstance(obj, dict):
|
|
196
|
+
return cls.model_validate(obj)
|
|
197
|
+
|
|
198
|
+
_obj = cls.model_validate({
|
|
199
|
+
"id": obj.get("id"),
|
|
200
|
+
"date": obj.get("date"),
|
|
201
|
+
"amount": UpdateTransactionObjectAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None,
|
|
202
|
+
"currency": obj.get("currency"),
|
|
203
|
+
"recurring_id": obj.get("recurring_id"),
|
|
204
|
+
"payee": obj.get("payee"),
|
|
205
|
+
"category_id": obj.get("category_id"),
|
|
206
|
+
"notes": obj.get("notes"),
|
|
207
|
+
"manual_account_id": obj.get("manual_account_id"),
|
|
208
|
+
"plaid_account_id": obj.get("plaid_account_id"),
|
|
209
|
+
"tag_ids": obj.get("tag_ids"),
|
|
210
|
+
"additional_tag_ids": obj.get("additional_tag_ids"),
|
|
211
|
+
"external_id": obj.get("external_id"),
|
|
212
|
+
"custom_metadata": obj.get("custom_metadata"),
|
|
213
|
+
"status": obj.get("status"),
|
|
214
|
+
"to_base": obj.get("to_base"),
|
|
215
|
+
"is_pending": obj.get("is_pending"),
|
|
216
|
+
"plaid_metadata": obj.get("plaid_metadata"),
|
|
217
|
+
"created_at": obj.get("created_at"),
|
|
218
|
+
"updated_at": obj.get("updated_at"),
|
|
219
|
+
"is_split_parent": obj.get("is_split_parent"),
|
|
220
|
+
"children": [ChildTransactionObject.from_dict(_item) for _item in obj["children"]] if obj.get("children") is not None else None,
|
|
221
|
+
"split_parent_id": obj.get("split_parent_id"),
|
|
222
|
+
"is_group_parent": obj.get("is_group_parent"),
|
|
223
|
+
"group_parent_id": obj.get("group_parent_id"),
|
|
224
|
+
"source": obj.get("source")
|
|
225
|
+
})
|
|
226
|
+
return _obj
|
|
227
|
+
|
|
228
|
+
|
|
@@ -0,0 +1,145 @@
|
|
|
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 json
|
|
18
|
+
import pprint
|
|
19
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator
|
|
20
|
+
from typing import Any, List, Optional, Union
|
|
21
|
+
from typing_extensions import Annotated
|
|
22
|
+
from pydantic import StrictStr, Field
|
|
23
|
+
from typing import Union, List, Set, Optional, Dict
|
|
24
|
+
from typing_extensions import Literal, Self
|
|
25
|
+
|
|
26
|
+
UPDATETRANSACTIONOBJECTAMOUNT_ONE_OF_SCHEMAS = ["float", "str"]
|
|
27
|
+
|
|
28
|
+
class UpdateTransactionObjectAmount(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Numeric value of amount without currency symbol. i.e. $4.25 should be denoted as 4.25. May be a string or a number in double format. Positive values indicate a debit transaction, negative values indicate a credit transaction. <br> May not be updated on transactions that belong to a synced account with the \"Allow Modifications to Transactions\" property disabled.
|
|
31
|
+
"""
|
|
32
|
+
# data type: float
|
|
33
|
+
oneof_schema_1_validator: Optional[Union[StrictFloat, StrictInt]] = None
|
|
34
|
+
# data type: str
|
|
35
|
+
oneof_schema_2_validator: Optional[Annotated[str, Field(strict=True)]] = None
|
|
36
|
+
actual_instance: Optional[Union[float, str]] = None
|
|
37
|
+
one_of_schemas: Set[str] = { "float", "str" }
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
46
|
+
if args:
|
|
47
|
+
if len(args) > 1:
|
|
48
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
49
|
+
if kwargs:
|
|
50
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
51
|
+
super().__init__(actual_instance=args[0])
|
|
52
|
+
else:
|
|
53
|
+
super().__init__(**kwargs)
|
|
54
|
+
|
|
55
|
+
@field_validator('actual_instance')
|
|
56
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
57
|
+
instance = UpdateTransactionObjectAmount.model_construct()
|
|
58
|
+
error_messages = []
|
|
59
|
+
match = 0
|
|
60
|
+
# validate data type: float
|
|
61
|
+
try:
|
|
62
|
+
instance.oneof_schema_1_validator = v
|
|
63
|
+
match += 1
|
|
64
|
+
except (ValidationError, ValueError) as e:
|
|
65
|
+
error_messages.append(str(e))
|
|
66
|
+
# validate data type: str
|
|
67
|
+
try:
|
|
68
|
+
instance.oneof_schema_2_validator = v
|
|
69
|
+
match += 1
|
|
70
|
+
except (ValidationError, ValueError) as e:
|
|
71
|
+
error_messages.append(str(e))
|
|
72
|
+
if match > 1:
|
|
73
|
+
# more than 1 match
|
|
74
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in UpdateTransactionObjectAmount with oneOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
75
|
+
elif match == 0:
|
|
76
|
+
# no match
|
|
77
|
+
raise ValueError("No match found when setting `actual_instance` in UpdateTransactionObjectAmount with oneOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
78
|
+
else:
|
|
79
|
+
return v
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
83
|
+
return cls.from_json(json.dumps(obj))
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_json(cls, json_str: str) -> Self:
|
|
87
|
+
"""Returns the object represented by the json string"""
|
|
88
|
+
instance = cls.model_construct()
|
|
89
|
+
error_messages = []
|
|
90
|
+
match = 0
|
|
91
|
+
|
|
92
|
+
# deserialize data into float
|
|
93
|
+
try:
|
|
94
|
+
# validation
|
|
95
|
+
instance.oneof_schema_1_validator = json.loads(json_str)
|
|
96
|
+
# assign value to actual_instance
|
|
97
|
+
instance.actual_instance = instance.oneof_schema_1_validator
|
|
98
|
+
match += 1
|
|
99
|
+
except (ValidationError, ValueError) as e:
|
|
100
|
+
error_messages.append(str(e))
|
|
101
|
+
# deserialize data into str
|
|
102
|
+
try:
|
|
103
|
+
# validation
|
|
104
|
+
instance.oneof_schema_2_validator = json.loads(json_str)
|
|
105
|
+
# assign value to actual_instance
|
|
106
|
+
instance.actual_instance = instance.oneof_schema_2_validator
|
|
107
|
+
match += 1
|
|
108
|
+
except (ValidationError, ValueError) as e:
|
|
109
|
+
error_messages.append(str(e))
|
|
110
|
+
|
|
111
|
+
if match > 1:
|
|
112
|
+
# more than 1 match
|
|
113
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into UpdateTransactionObjectAmount with oneOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
114
|
+
elif match == 0:
|
|
115
|
+
# no match
|
|
116
|
+
raise ValueError("No match found when deserializing the JSON string into UpdateTransactionObjectAmount with oneOf schemas: float, str. Details: " + ", ".join(error_messages))
|
|
117
|
+
else:
|
|
118
|
+
return instance
|
|
119
|
+
|
|
120
|
+
def to_json(self) -> str:
|
|
121
|
+
"""Returns the JSON representation of the actual instance"""
|
|
122
|
+
if self.actual_instance is None:
|
|
123
|
+
return "null"
|
|
124
|
+
|
|
125
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
126
|
+
return self.actual_instance.to_json()
|
|
127
|
+
else:
|
|
128
|
+
return json.dumps(self.actual_instance)
|
|
129
|
+
|
|
130
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], float, str]]:
|
|
131
|
+
"""Returns the dict representation of the actual instance"""
|
|
132
|
+
if self.actual_instance is None:
|
|
133
|
+
return None
|
|
134
|
+
|
|
135
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
136
|
+
return self.actual_instance.to_dict()
|
|
137
|
+
else:
|
|
138
|
+
# primitive type
|
|
139
|
+
return self.actual_instance
|
|
140
|
+
|
|
141
|
+
def to_str(self) -> str:
|
|
142
|
+
"""Returns the string representation of the actual instance"""
|
|
143
|
+
return pprint.pformat(self.model_dump())
|
|
144
|
+
|
|
145
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from lunchmoney.models.transaction_object import TransactionObject
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class UpdateTransactions200Response(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
UpdateTransactions200Response
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
transactions: List[TransactionObject]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["transactions"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of UpdateTransactions200Response from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
# override the default output from pydantic by calling `to_dict()` of each item in transactions (list)
|
|
74
|
+
_items = []
|
|
75
|
+
if self.transactions:
|
|
76
|
+
for _item_transactions in self.transactions:
|
|
77
|
+
if _item_transactions:
|
|
78
|
+
_items.append(_item_transactions.to_dict())
|
|
79
|
+
_dict['transactions'] = _items
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of UpdateTransactions200Response from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({
|
|
92
|
+
"transactions": [TransactionObject.from_dict(_item) for _item in obj["transactions"]] if obj.get("transactions") is not None else None
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -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.update_transactions_request_transactions_inner import UpdateTransactionsRequestTransactionsInner
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class UpdateTransactionsRequest(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
UpdateTransactionsRequest
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
transactions: Annotated[List[UpdateTransactionsRequestTransactionsInner], Field(min_length=1, max_length=500)] = Field(description="List of transactions to update. Each transaction must have an `id` property and at least one other property to update.")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["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 UpdateTransactionsRequest 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 transactions (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.transactions:
|
|
77
|
+
for _item_transactions in self.transactions:
|
|
78
|
+
if _item_transactions:
|
|
79
|
+
_items.append(_item_transactions.to_dict())
|
|
80
|
+
_dict['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 UpdateTransactionsRequest 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
|
+
"transactions": [UpdateTransactionsRequestTransactionsInner.from_dict(_item) for _item in obj["transactions"]] if obj.get("transactions") is not None else None
|
|
94
|
+
})
|
|
95
|
+
return _obj
|
|
96
|
+
|
|
97
|
+
|