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.
Files changed (92) hide show
  1. lunchmoney/__init__.py +205 -0
  2. lunchmoney/api/__init__.py +16 -0
  3. lunchmoney/api/categories_api.py +1499 -0
  4. lunchmoney/api/manual_accounts_api.py +1479 -0
  5. lunchmoney/api/me_api.py +293 -0
  6. lunchmoney/api/plaid_accounts_api.py +909 -0
  7. lunchmoney/api/recurring_items_api.py +702 -0
  8. lunchmoney/api/summary_api.py +434 -0
  9. lunchmoney/api/tags_api.py +1465 -0
  10. lunchmoney/api/transactions_api.py +914 -0
  11. lunchmoney/api/transactions_bulk_api.py +1527 -0
  12. lunchmoney/api/transactions_files_api.py +891 -0
  13. lunchmoney/api/transactions_group_api.py +601 -0
  14. lunchmoney/api/transactions_split_api.py +616 -0
  15. lunchmoney/api_client.py +805 -0
  16. lunchmoney/api_response.py +21 -0
  17. lunchmoney/configuration.py +620 -0
  18. lunchmoney/exceptions.py +217 -0
  19. lunchmoney/models/__init__.py +84 -0
  20. lunchmoney/models/account_type_enum.py +46 -0
  21. lunchmoney/models/aligned_category_totals_object.py +108 -0
  22. lunchmoney/models/aligned_summary_category_object.py +110 -0
  23. lunchmoney/models/aligned_summary_response_object.py +104 -0
  24. lunchmoney/models/category_object.py +146 -0
  25. lunchmoney/models/child_category_object.py +141 -0
  26. lunchmoney/models/child_transaction_object.py +219 -0
  27. lunchmoney/models/create_category_request_object.py +137 -0
  28. lunchmoney/models/create_category_request_object_children_inner.py +159 -0
  29. lunchmoney/models/create_manual_account_request_object.py +138 -0
  30. lunchmoney/models/create_manual_account_request_object_balance.py +145 -0
  31. lunchmoney/models/create_new_transactions_request.py +103 -0
  32. lunchmoney/models/create_tag_request_object.py +112 -0
  33. lunchmoney/models/currency_enum.py +198 -0
  34. lunchmoney/models/delete_category_response_with_dependencies.py +94 -0
  35. lunchmoney/models/delete_category_response_with_dependencies_dependents.py +98 -0
  36. lunchmoney/models/delete_tag_response_with_dependencies.py +94 -0
  37. lunchmoney/models/delete_tag_response_with_dependencies_dependents.py +90 -0
  38. lunchmoney/models/delete_transactions_request.py +89 -0
  39. lunchmoney/models/error_response_object.py +98 -0
  40. lunchmoney/models/error_response_object_errors_inner.py +101 -0
  41. lunchmoney/models/get_all_categories200_response.py +96 -0
  42. lunchmoney/models/get_all_manual_accounts200_response.py +96 -0
  43. lunchmoney/models/get_all_plaid_accounts200_response.py +96 -0
  44. lunchmoney/models/get_all_recurring200_response.py +96 -0
  45. lunchmoney/models/get_all_tags200_response.py +96 -0
  46. lunchmoney/models/get_all_transactions200_response.py +100 -0
  47. lunchmoney/models/get_all_transactions_created_since_parameter.py +145 -0
  48. lunchmoney/models/get_budget_summary200_response.py +138 -0
  49. lunchmoney/models/get_transaction_attachment_url200_response.py +91 -0
  50. lunchmoney/models/group_transactions_request.py +122 -0
  51. lunchmoney/models/insert_transaction_object.py +164 -0
  52. lunchmoney/models/insert_transaction_object_amount.py +145 -0
  53. lunchmoney/models/insert_transactions_response_object.py +106 -0
  54. lunchmoney/models/manual_account_object.py +158 -0
  55. lunchmoney/models/non_aligned_category_totals_object.py +94 -0
  56. lunchmoney/models/non_aligned_summary_category_object.py +94 -0
  57. lunchmoney/models/non_aligned_summary_response_object.py +104 -0
  58. lunchmoney/models/plaid_account_object.py +168 -0
  59. lunchmoney/models/recurring_object.py +143 -0
  60. lunchmoney/models/recurring_object_matches.py +105 -0
  61. lunchmoney/models/recurring_object_matches_found_transactions_inner.py +91 -0
  62. lunchmoney/models/recurring_object_overrides.py +92 -0
  63. lunchmoney/models/recurring_object_transaction_criteria.py +149 -0
  64. lunchmoney/models/skipped_existing_external_id_object.py +108 -0
  65. lunchmoney/models/split_transaction_object.py +102 -0
  66. lunchmoney/models/split_transaction_object_amount.py +145 -0
  67. lunchmoney/models/split_transaction_request.py +97 -0
  68. lunchmoney/models/summary_category_occurrence_object.py +126 -0
  69. lunchmoney/models/summary_recurring_transaction_object.py +100 -0
  70. lunchmoney/models/summary_rollover_pool_adjustment_object.py +98 -0
  71. lunchmoney/models/summary_rollover_pool_object.py +98 -0
  72. lunchmoney/models/summary_totals_breakdown_object.py +98 -0
  73. lunchmoney/models/summary_totals_object.py +97 -0
  74. lunchmoney/models/tag_object.py +125 -0
  75. lunchmoney/models/transaction_attachment_object.py +106 -0
  76. lunchmoney/models/transaction_object.py +229 -0
  77. lunchmoney/models/update_category_request_object.py +156 -0
  78. lunchmoney/models/update_manual_account_request_object.py +156 -0
  79. lunchmoney/models/update_manual_account_request_object_balance.py +145 -0
  80. lunchmoney/models/update_tag_request_object.py +126 -0
  81. lunchmoney/models/update_transaction_object.py +228 -0
  82. lunchmoney/models/update_transaction_object_amount.py +145 -0
  83. lunchmoney/models/update_transactions200_response.py +96 -0
  84. lunchmoney/models/update_transactions_request.py +97 -0
  85. lunchmoney/models/update_transactions_request_transactions_inner.py +228 -0
  86. lunchmoney/models/user_object.py +106 -0
  87. lunchmoney/py.typed +0 -0
  88. lunchmoney/rest.py +259 -0
  89. lunchmoney_python-2.9.0.dist-info/METADATA +285 -0
  90. lunchmoney_python-2.9.0.dist-info/RECORD +92 -0
  91. lunchmoney_python-2.9.0.dist-info/WHEEL +5 -0
  92. 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
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from lunchmoney.models.summary_totals_breakdown_object import SummaryTotalsBreakdownObject
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class SummaryTotalsObject(BaseModel):
28
+ """
29
+ Total inflow and outflow for the given date range. This object is returned when the query parameter `include_totals` is set to `true`.
30
+ """ # noqa: E501
31
+ inflow: Optional[SummaryTotalsBreakdownObject] = None
32
+ outflow: Optional[SummaryTotalsBreakdownObject] = None
33
+ __properties: ClassVar[List[str]] = ["inflow", "outflow"]
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 SummaryTotalsObject 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 inflow
75
+ if self.inflow:
76
+ _dict['inflow'] = self.inflow.to_dict()
77
+ # override the default output from pydantic by calling `to_dict()` of outflow
78
+ if self.outflow:
79
+ _dict['outflow'] = self.outflow.to_dict()
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of SummaryTotalsObject 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
+ "inflow": SummaryTotalsBreakdownObject.from_dict(obj["inflow"]) if obj.get("inflow") is not None else None,
93
+ "outflow": SummaryTotalsBreakdownObject.from_dict(obj["outflow"]) if obj.get("outflow") is not None else None
94
+ })
95
+ return _obj
96
+
97
+
@@ -0,0 +1,125 @@
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 datetime
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
23
+ from typing import Any, ClassVar, Dict, List, Optional
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class TagObject(BaseModel):
28
+ """
29
+ TagObject
30
+ """ # noqa: E501
31
+ id: StrictInt = Field(description="Unique identifier for the tag.")
32
+ name: StrictStr = Field(description="Name of the tag.")
33
+ description: Optional[StrictStr] = Field(description="Description of the tag.")
34
+ text_color: Optional[StrictStr] = Field(description="The text color of the tag.")
35
+ background_color: Optional[StrictStr] = Field(description="The background color of the tag.")
36
+ updated_at: datetime = Field(description="The date and time of when the tag was last updated (in the ISO 8601 extended format).")
37
+ created_at: datetime = Field(description="The date and time of when the tag was created (in the ISO 8601 extended format).")
38
+ archived: StrictBool = Field(description="If `true`, the tag will not show up when creating or updating transactions in the Lunch Money app. **Can it be assigned via the API**")
39
+ archived_at: Optional[datetime] = Field(description="The date and time of when the tag was last archived or `null` if not archived")
40
+ __properties: ClassVar[List[str]] = ["id", "name", "description", "text_color", "background_color", "updated_at", "created_at", "archived", "archived_at"]
41
+
42
+ model_config = ConfigDict(
43
+ populate_by_name=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of TagObject from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ """
73
+ excluded_fields: Set[str] = set([
74
+ ])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # set to None if description (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.description is None and "description" in self.model_fields_set:
84
+ _dict['description'] = None
85
+
86
+ # set to None if text_color (nullable) is None
87
+ # and model_fields_set contains the field
88
+ if self.text_color is None and "text_color" in self.model_fields_set:
89
+ _dict['text_color'] = None
90
+
91
+ # set to None if background_color (nullable) is None
92
+ # and model_fields_set contains the field
93
+ if self.background_color is None and "background_color" in self.model_fields_set:
94
+ _dict['background_color'] = None
95
+
96
+ # set to None if archived_at (nullable) is None
97
+ # and model_fields_set contains the field
98
+ if self.archived_at is None and "archived_at" in self.model_fields_set:
99
+ _dict['archived_at'] = None
100
+
101
+ return _dict
102
+
103
+ @classmethod
104
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
105
+ """Create an instance of TagObject from a dict"""
106
+ if obj is None:
107
+ return None
108
+
109
+ if not isinstance(obj, dict):
110
+ return cls.model_validate(obj)
111
+
112
+ _obj = cls.model_validate({
113
+ "id": obj.get("id"),
114
+ "name": obj.get("name"),
115
+ "description": obj.get("description"),
116
+ "text_color": obj.get("text_color"),
117
+ "background_color": obj.get("background_color"),
118
+ "updated_at": obj.get("updated_at"),
119
+ "created_at": obj.get("created_at"),
120
+ "archived": obj.get("archived"),
121
+ "archived_at": obj.get("archived_at")
122
+ })
123
+ return _obj
124
+
125
+
@@ -0,0 +1,106 @@
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 datetime
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
23
+ from typing import Any, ClassVar, Dict, List, Optional
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class TransactionAttachmentObject(BaseModel):
28
+ """
29
+ TransactionAttachmentObject
30
+ """ # noqa: E501
31
+ id: Optional[StrictInt] = Field(default=None, description="The unique identifier of the attachment")
32
+ uploaded_by: Optional[StrictInt] = Field(default=None, description="The id of the user who uploaded the attachment")
33
+ name: Optional[StrictStr] = Field(default=None, description="The name of the file")
34
+ type: Optional[StrictStr] = Field(default=None, description="The MIME type of the file")
35
+ size: Optional[StrictInt] = Field(default=None, description="The size of the file in kilobytes")
36
+ notes: Optional[StrictStr] = Field(default=None, description="Optional notes about the attachment")
37
+ created_at: Optional[datetime] = Field(default=None, description="The date and time when the attachment was created in ISO 8601 format")
38
+ __properties: ClassVar[List[str]] = ["id", "uploaded_by", "name", "type", "size", "notes", "created_at"]
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 TransactionAttachmentObject 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
+ # set to None if notes (nullable) is None
80
+ # and model_fields_set contains the field
81
+ if self.notes is None and "notes" in self.model_fields_set:
82
+ _dict['notes'] = None
83
+
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of TransactionAttachmentObject from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate({
96
+ "id": obj.get("id"),
97
+ "uploaded_by": obj.get("uploaded_by"),
98
+ "name": obj.get("name"),
99
+ "type": obj.get("type"),
100
+ "size": obj.get("size"),
101
+ "notes": obj.get("notes"),
102
+ "created_at": obj.get("created_at")
103
+ })
104
+ return _obj
105
+
106
+
@@ -0,0 +1,229 @@
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.transaction_attachment_object import TransactionAttachmentObject
28
+ from typing import Optional, Set
29
+ from typing_extensions import Self
30
+
31
+ class TransactionObject(BaseModel):
32
+ """
33
+ TransactionObject
34
+ """ # noqa: E501
35
+ id: StrictInt = Field(description="System created unique identifier for transaction")
36
+ var_date: date = Field(description="Date of transaction in ISO 8601 format", alias="date")
37
+ amount: StrictStr = Field(description="Amount of the transaction in numeric format to 4 decimal places. Positive values indicate a debit transaction, negative values indicate a credit transaction.")
38
+ currency: CurrencyEnum = Field(description="Three-letter lowercase currency code of the transaction in ISO 4217 format.")
39
+ to_base: Union[StrictFloat, StrictInt] = Field(description="The amount converted to the user's primary currency. If the multi-currency feature is not being used, to_base and amount will be the same. Positive values indicate a debit transaction, negative values indicate a credit transaction.")
40
+ recurring_id: Optional[StrictInt] = Field(description="The unique identifier of the associated recurring item that this transaction matched.")
41
+ payee: Annotated[str, Field(min_length=0, strict=True, max_length=140)] = Field(description="Name of payee set by the user, the financial institution, or by a matched recurring item. This will match the value displayed in payee field on the transactions page in the GUI. ")
42
+ category_id: Optional[StrictInt] = Field(description="Unique identifier of associated category set by the user or by a matched recurring_item.<br> Category details can be obtained by passing the value of this property to the [Get A Single Category](../operations/getCategoryById) API")
43
+ plaid_account_id: Optional[StrictInt] = Field(description="The unique identifier of the plaid account associated with this transaction. This will always be null if this transaction is associated with a manual account or if this transaction has no associated account and appears as a \"Cash Transaction\" in the Lunch Money GUI.")
44
+ manual_account_id: Optional[StrictInt] = Field(description="The unique identifier of the manual account associated with this transaction. This will always be null if this transaction is associated with a synced account or if this transaction has no associated account and appears as a \"Cash Transaction\" in the Lunch Money GUI.")
45
+ external_id: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=75)]] = Field(description="A user-defined external ID for any transaction that was added via csv import, `POST /transactions` API call, or manually added via the Lunch Money GUI. No external ID exists for transactions associated with synced accounts, and they cannot be added. For transactions associated with manual accounts, the external ID must be unique as attempts to add a subsequent transaction with the same external_id and manual_account_id will be flagged as duplicates and fail.")
46
+ tag_ids: List[StrictInt] = Field(description="A list of tag_ids for the tags associated with this transaction. If the transaction has no tags this will be an empty list.<br> Tag details can be obtained by passing the value of this attribute as the `ids` query parameter to the [List Tags](../operations/getTags) API")
47
+ notes: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=350)]] = Field(description="Any transaction notes set by the user or by a matched recurring item. This will match the value displayed in notes field on the transactions page in the GUI. ")
48
+ status: StrictStr = Field(description="Status of the transaction: - `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. Note that any transactions where `is_pending` is true will be returned with a status of unreviewed. - `delete_pending`: The synced account deleted this transaction after it was updated by the user. Requires manual intervention. ")
49
+ is_pending: StrictBool = Field(description="Denotes if the transaction is pending (not posted). Applies only to transactions in synced accounts and will always be false for transactions associated with manual accounts.")
50
+ created_at: datetime = Field(description="The date and time of when the transaction was created (in the ISO 8601 extended format).")
51
+ updated_at: datetime = Field(description="The date and time of when the transaction was last updated (in the ISO 8601 extended format).")
52
+ is_split_parent: Optional[StrictBool] = Field(default=None, description="If `true`, this transaction has been split into two or more other transactions. By default, parent transactions are not returned in call to `GET /transactions` but they can be queried directly by their ID.")
53
+ split_parent_id: Optional[StrictInt] = Field(description="A transaction ID if this is a split transaction. Denotes the transaction ID of the original, or parent, transaction. Is null if this is not a split transaction")
54
+ is_group_parent: StrictBool = Field(description="`true` if this transaction represents a group of transactions. If so, amount and currency represent the totalled amount of transactions bearing this transaction's id as their group_parent_id. Amount is calculated based on the user's primary currency.")
55
+ group_parent_id: Optional[StrictInt] = Field(description="Is set if this transaction is part of a group. Denotes the ID of the grouped transaction this is now included in. By default the transactions that were grouped are not returned in a call to `GET /transactions` but they can be queried directly by calling the `GET /transactions/group/{id}`, where the id passed is associated with a transaction where the `is_group_parent` attribute is true")
56
+ children: Optional[List[ChildTransactionObject]] = Field(default=None, description="Exists only for transactions which are the parent of a split transaction or for transaction groups. It will not exist in the response unless the `include_children` query parameter is set to `true`.<br> For parents of split transactions, it contains a list of the associated transactions that it was split into. For transaction groups, it contains the transactions that were grouped together. Examine the `is_split_parent` and `is_group_parent` properties to determine which of these it is.")
57
+ plaid_metadata: Optional[Dict[str, Any]] = Field(default=None, description="If requested, the transaction's plaid_metadata that came when this transaction was obtained. This will be a json object, but the schema is variable. This is only present when the `include_metadata` query parameter is set to true.")
58
+ custom_metadata: Optional[Dict[str, Any]] = Field(default=None, description="If requested, the transaction's custom_metadata that was included when the transaction was inserted via the API. This will be a json object, but the schema is variable. This is only present when the `include_metadata` query parameter is set to true.")
59
+ files: Optional[List[TransactionAttachmentObject]] = Field(default=None, description="A list of objects that describe any attachments to the Transactions. This is only present when the `include_files` query parameter is set to true.")
60
+ source: Optional[StrictStr] = Field(description="Source of the transaction: - `api`: Transaction was added by a call to the [POST /transactions](../operations/createTransaction) API - `csv`: Transaction was added via a CSV Import - `manual`: Transaction was created via the \"Add to Cash\" button on the Transactions page - `merge`: Transactions were originally in an account that was merged into another account - `plaid`: Transaction came from a Financial Institution synced via Plaid - `recurring`: Transaction was created from the Recurring page - `rule`: Transaction was created by a rule to split a transaction - `split`: Transaction was created by splitting another transaction - `user`: This is a legacy value and is replaced by either csv or manual ")
61
+ __properties: ClassVar[List[str]] = ["id", "date", "amount", "currency", "to_base", "recurring_id", "payee", "category_id", "plaid_account_id", "manual_account_id", "external_id", "tag_ids", "notes", "status", "is_pending", "created_at", "updated_at", "is_split_parent", "split_parent_id", "is_group_parent", "group_parent_id", "children", "plaid_metadata", "custom_metadata", "files", "source"]
62
+
63
+ @field_validator('status')
64
+ def status_validate_enum(cls, value):
65
+ """Validates the enum"""
66
+ if value not in set(['reviewed', 'unreviewed', 'delete_pending']):
67
+ raise ValueError("must be one of enum values ('reviewed', 'unreviewed', 'delete_pending')")
68
+ return value
69
+
70
+ @field_validator('source')
71
+ def source_validate_enum(cls, value):
72
+ """Validates the enum"""
73
+ if value is None:
74
+ return value
75
+
76
+ if value not in set(['api', 'csv', 'manual', 'merge', 'plaid', 'recurring', 'rule', 'split', 'user']):
77
+ raise ValueError("must be one of enum values ('api', 'csv', 'manual', 'merge', 'plaid', 'recurring', 'rule', 'split', 'user')")
78
+ return value
79
+
80
+ model_config = ConfigDict(
81
+ populate_by_name=True,
82
+ validate_assignment=True,
83
+ protected_namespaces=(),
84
+ )
85
+
86
+
87
+ def to_str(self) -> str:
88
+ """Returns the string representation of the model using alias"""
89
+ return pprint.pformat(self.model_dump(by_alias=True))
90
+
91
+ def to_json(self) -> str:
92
+ """Returns the JSON representation of the model using alias"""
93
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
94
+ return json.dumps(self.to_dict())
95
+
96
+ @classmethod
97
+ def from_json(cls, json_str: str) -> Optional[Self]:
98
+ """Create an instance of TransactionObject from a JSON string"""
99
+ return cls.from_dict(json.loads(json_str))
100
+
101
+ def to_dict(self) -> Dict[str, Any]:
102
+ """Return the dictionary representation of the model using alias.
103
+
104
+ This has the following differences from calling pydantic's
105
+ `self.model_dump(by_alias=True)`:
106
+
107
+ * `None` is only added to the output dict for nullable fields that
108
+ were set at model initialization. Other fields with value `None`
109
+ are ignored.
110
+ """
111
+ excluded_fields: Set[str] = set([
112
+ ])
113
+
114
+ _dict = self.model_dump(
115
+ by_alias=True,
116
+ exclude=excluded_fields,
117
+ exclude_none=True,
118
+ )
119
+ # override the default output from pydantic by calling `to_dict()` of each item in children (list)
120
+ _items = []
121
+ if self.children:
122
+ for _item_children in self.children:
123
+ if _item_children:
124
+ _items.append(_item_children.to_dict())
125
+ _dict['children'] = _items
126
+ # override the default output from pydantic by calling `to_dict()` of each item in files (list)
127
+ _items = []
128
+ if self.files:
129
+ for _item_files in self.files:
130
+ if _item_files:
131
+ _items.append(_item_files.to_dict())
132
+ _dict['files'] = _items
133
+ # set to None if recurring_id (nullable) is None
134
+ # and model_fields_set contains the field
135
+ if self.recurring_id is None and "recurring_id" in self.model_fields_set:
136
+ _dict['recurring_id'] = None
137
+
138
+ # set to None if category_id (nullable) is None
139
+ # and model_fields_set contains the field
140
+ if self.category_id is None and "category_id" in self.model_fields_set:
141
+ _dict['category_id'] = None
142
+
143
+ # set to None if plaid_account_id (nullable) is None
144
+ # and model_fields_set contains the field
145
+ if self.plaid_account_id is None and "plaid_account_id" in self.model_fields_set:
146
+ _dict['plaid_account_id'] = None
147
+
148
+ # set to None if manual_account_id (nullable) is None
149
+ # and model_fields_set contains the field
150
+ if self.manual_account_id is None and "manual_account_id" in self.model_fields_set:
151
+ _dict['manual_account_id'] = None
152
+
153
+ # set to None if external_id (nullable) is None
154
+ # and model_fields_set contains the field
155
+ if self.external_id is None and "external_id" in self.model_fields_set:
156
+ _dict['external_id'] = None
157
+
158
+ # set to None if notes (nullable) is None
159
+ # and model_fields_set contains the field
160
+ if self.notes is None and "notes" in self.model_fields_set:
161
+ _dict['notes'] = None
162
+
163
+ # set to None if split_parent_id (nullable) is None
164
+ # and model_fields_set contains the field
165
+ if self.split_parent_id is None and "split_parent_id" in self.model_fields_set:
166
+ _dict['split_parent_id'] = None
167
+
168
+ # set to None if group_parent_id (nullable) is None
169
+ # and model_fields_set contains the field
170
+ if self.group_parent_id is None and "group_parent_id" in self.model_fields_set:
171
+ _dict['group_parent_id'] = None
172
+
173
+ # set to None if plaid_metadata (nullable) is None
174
+ # and model_fields_set contains the field
175
+ if self.plaid_metadata is None and "plaid_metadata" in self.model_fields_set:
176
+ _dict['plaid_metadata'] = None
177
+
178
+ # set to None if custom_metadata (nullable) is None
179
+ # and model_fields_set contains the field
180
+ if self.custom_metadata is None and "custom_metadata" in self.model_fields_set:
181
+ _dict['custom_metadata'] = None
182
+
183
+ # set to None if source (nullable) is None
184
+ # and model_fields_set contains the field
185
+ if self.source is None and "source" in self.model_fields_set:
186
+ _dict['source'] = None
187
+
188
+ return _dict
189
+
190
+ @classmethod
191
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
192
+ """Create an instance of TransactionObject from a dict"""
193
+ if obj is None:
194
+ return None
195
+
196
+ if not isinstance(obj, dict):
197
+ return cls.model_validate(obj)
198
+
199
+ _obj = cls.model_validate({
200
+ "id": obj.get("id"),
201
+ "date": obj.get("date"),
202
+ "amount": obj.get("amount"),
203
+ "currency": obj.get("currency"),
204
+ "to_base": obj.get("to_base"),
205
+ "recurring_id": obj.get("recurring_id"),
206
+ "payee": obj.get("payee"),
207
+ "category_id": obj.get("category_id"),
208
+ "plaid_account_id": obj.get("plaid_account_id"),
209
+ "manual_account_id": obj.get("manual_account_id"),
210
+ "external_id": obj.get("external_id"),
211
+ "tag_ids": obj.get("tag_ids"),
212
+ "notes": obj.get("notes"),
213
+ "status": obj.get("status"),
214
+ "is_pending": obj.get("is_pending"),
215
+ "created_at": obj.get("created_at"),
216
+ "updated_at": obj.get("updated_at"),
217
+ "is_split_parent": obj.get("is_split_parent"),
218
+ "split_parent_id": obj.get("split_parent_id"),
219
+ "is_group_parent": obj.get("is_group_parent"),
220
+ "group_parent_id": obj.get("group_parent_id"),
221
+ "children": [ChildTransactionObject.from_dict(_item) for _item in obj["children"]] if obj.get("children") is not None else None,
222
+ "plaid_metadata": obj.get("plaid_metadata"),
223
+ "custom_metadata": obj.get("custom_metadata"),
224
+ "files": [TransactionAttachmentObject.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None,
225
+ "source": obj.get("source")
226
+ })
227
+ return _obj
228
+
229
+