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,138 @@
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, StrictStr, ValidationError, field_validator
20
+ from typing import Any, List, Optional
21
+ from lunchmoney.models.aligned_summary_response_object import AlignedSummaryResponseObject
22
+ from lunchmoney.models.non_aligned_summary_response_object import NonAlignedSummaryResponseObject
23
+ from pydantic import StrictStr, Field
24
+ from typing import Union, List, Set, Optional, Dict
25
+ from typing_extensions import Literal, Self
26
+
27
+ GETBUDGETSUMMARY200RESPONSE_ONE_OF_SCHEMAS = ["AlignedSummaryResponseObject", "NonAlignedSummaryResponseObject"]
28
+
29
+ class GetBudgetSummary200Response(BaseModel):
30
+ """
31
+ GetBudgetSummary200Response
32
+ """
33
+ # data type: AlignedSummaryResponseObject
34
+ oneof_schema_1_validator: Optional[AlignedSummaryResponseObject] = None
35
+ # data type: NonAlignedSummaryResponseObject
36
+ oneof_schema_2_validator: Optional[NonAlignedSummaryResponseObject] = None
37
+ actual_instance: Optional[Union[AlignedSummaryResponseObject, NonAlignedSummaryResponseObject]] = None
38
+ one_of_schemas: Set[str] = { "AlignedSummaryResponseObject", "NonAlignedSummaryResponseObject" }
39
+
40
+ model_config = ConfigDict(
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+
46
+ def __init__(self, *args, **kwargs) -> None:
47
+ if args:
48
+ if len(args) > 1:
49
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
50
+ if kwargs:
51
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
52
+ super().__init__(actual_instance=args[0])
53
+ else:
54
+ super().__init__(**kwargs)
55
+
56
+ @field_validator('actual_instance')
57
+ def actual_instance_must_validate_oneof(cls, v):
58
+ instance = GetBudgetSummary200Response.model_construct()
59
+ error_messages = []
60
+ match = 0
61
+ # validate data type: AlignedSummaryResponseObject
62
+ if not isinstance(v, AlignedSummaryResponseObject):
63
+ error_messages.append(f"Error! Input type `{type(v)}` is not `AlignedSummaryResponseObject`")
64
+ else:
65
+ match += 1
66
+ # validate data type: NonAlignedSummaryResponseObject
67
+ if not isinstance(v, NonAlignedSummaryResponseObject):
68
+ error_messages.append(f"Error! Input type `{type(v)}` is not `NonAlignedSummaryResponseObject`")
69
+ else:
70
+ match += 1
71
+ if match > 1:
72
+ # more than 1 match
73
+ raise ValueError("Multiple matches found when setting `actual_instance` in GetBudgetSummary200Response with oneOf schemas: AlignedSummaryResponseObject, NonAlignedSummaryResponseObject. Details: " + ", ".join(error_messages))
74
+ elif match == 0:
75
+ # no match
76
+ raise ValueError("No match found when setting `actual_instance` in GetBudgetSummary200Response with oneOf schemas: AlignedSummaryResponseObject, NonAlignedSummaryResponseObject. Details: " + ", ".join(error_messages))
77
+ else:
78
+ return v
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
82
+ return cls.from_json(json.dumps(obj))
83
+
84
+ @classmethod
85
+ def from_json(cls, json_str: str) -> Self:
86
+ """Returns the object represented by the json string"""
87
+ instance = cls.model_construct()
88
+ error_messages = []
89
+ match = 0
90
+
91
+ # deserialize data into AlignedSummaryResponseObject
92
+ try:
93
+ instance.actual_instance = AlignedSummaryResponseObject.from_json(json_str)
94
+ match += 1
95
+ except (ValidationError, ValueError) as e:
96
+ error_messages.append(str(e))
97
+ # deserialize data into NonAlignedSummaryResponseObject
98
+ try:
99
+ instance.actual_instance = NonAlignedSummaryResponseObject.from_json(json_str)
100
+ match += 1
101
+ except (ValidationError, ValueError) as e:
102
+ error_messages.append(str(e))
103
+
104
+ if match > 1:
105
+ # more than 1 match
106
+ raise ValueError("Multiple matches found when deserializing the JSON string into GetBudgetSummary200Response with oneOf schemas: AlignedSummaryResponseObject, NonAlignedSummaryResponseObject. Details: " + ", ".join(error_messages))
107
+ elif match == 0:
108
+ # no match
109
+ raise ValueError("No match found when deserializing the JSON string into GetBudgetSummary200Response with oneOf schemas: AlignedSummaryResponseObject, NonAlignedSummaryResponseObject. Details: " + ", ".join(error_messages))
110
+ else:
111
+ return instance
112
+
113
+ def to_json(self) -> str:
114
+ """Returns the JSON representation of the actual instance"""
115
+ if self.actual_instance is None:
116
+ return "null"
117
+
118
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
119
+ return self.actual_instance.to_json()
120
+ else:
121
+ return json.dumps(self.actual_instance)
122
+
123
+ def to_dict(self) -> Optional[Union[Dict[str, Any], AlignedSummaryResponseObject, NonAlignedSummaryResponseObject]]:
124
+ """Returns the dict representation of the actual instance"""
125
+ if self.actual_instance is None:
126
+ return None
127
+
128
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
129
+ return self.actual_instance.to_dict()
130
+ else:
131
+ # primitive type
132
+ return self.actual_instance
133
+
134
+ def to_str(self) -> str:
135
+ """Returns the string representation of the actual instance"""
136
+ return pprint.pformat(self.model_dump())
137
+
138
+
@@ -0,0 +1,91 @@
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, StrictStr
23
+ from typing import Any, ClassVar, Dict, List
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class GetTransactionAttachmentUrl200Response(BaseModel):
28
+ """
29
+ GetTransactionAttachmentUrl200Response
30
+ """ # noqa: E501
31
+ url: StrictStr = Field(description="The signed url to download the file attachment")
32
+ expires_at: datetime = Field(description="The date and time the signed url will expire")
33
+ __properties: ClassVar[List[str]] = ["url", "expires_at"]
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 GetTransactionAttachmentUrl200Response 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
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of GetTransactionAttachmentUrl200Response from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({
86
+ "url": obj.get("url"),
87
+ "expires_at": obj.get("expires_at")
88
+ })
89
+ return _obj
90
+
91
+
@@ -0,0 +1,122 @@
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, StrictInt, StrictStr, field_validator
23
+ from typing import Any, ClassVar, Dict, List, Optional
24
+ from typing_extensions import Annotated
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class GroupTransactionsRequest(BaseModel):
29
+ """
30
+ GroupTransactionsRequest
31
+ """ # noqa: E501
32
+ ids: Annotated[List[StrictInt], Field(min_length=2, max_length=500)] = Field(description="List of existing transaction IDs to group. Split and recurring transactions may not be grouped. Transactions that are already grouped must be ungrouped before being regrouped.")
33
+ var_date: date = Field(description="Date for the new grouped transaction in ISO 8601 format.", alias="date")
34
+ payee: Annotated[str, Field(min_length=0, strict=True, max_length=140)] = Field(description="The payee for the new grouped transaction. ")
35
+ category_id: Optional[StrictInt] = Field(default=None, description="The ID of an existing category to assign to the grouped transaction. If not set and all the grouped transactions have the same category, the grouped transaction will inherit the category, otherwise the new transaction will have no category.")
36
+ notes: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=350)]] = Field(default=None, description="Notes for the grouped transaction. ")
37
+ status: Optional[StrictStr] = Field(default=None, description="If set must be either `reviewed` or `unreviewed`. If not set, defaults to `reviewed`.")
38
+ tag_ids: Optional[List[StrictInt]] = Field(default=None, description="A list of IDs for the tags associated with the grouped transaction. Each ID must match an existing tag associated with the user's account. If not set, no tags will be associated with the created transaction.")
39
+ __properties: ClassVar[List[str]] = ["ids", "date", "payee", "category_id", "notes", "status", "tag_ids"]
40
+
41
+ @field_validator('status')
42
+ def status_validate_enum(cls, value):
43
+ """Validates the enum"""
44
+ if value is None:
45
+ return value
46
+
47
+ if value not in set(['reviewed', 'unreviewed']):
48
+ raise ValueError("must be one of enum values ('reviewed', 'unreviewed')")
49
+ return value
50
+
51
+ model_config = ConfigDict(
52
+ populate_by_name=True,
53
+ validate_assignment=True,
54
+ protected_namespaces=(),
55
+ )
56
+
57
+
58
+ def to_str(self) -> str:
59
+ """Returns the string representation of the model using alias"""
60
+ return pprint.pformat(self.model_dump(by_alias=True))
61
+
62
+ def to_json(self) -> str:
63
+ """Returns the JSON representation of the model using alias"""
64
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
65
+ return json.dumps(self.to_dict())
66
+
67
+ @classmethod
68
+ def from_json(cls, json_str: str) -> Optional[Self]:
69
+ """Create an instance of GroupTransactionsRequest from a JSON string"""
70
+ return cls.from_dict(json.loads(json_str))
71
+
72
+ def to_dict(self) -> Dict[str, Any]:
73
+ """Return the dictionary representation of the model using alias.
74
+
75
+ This has the following differences from calling pydantic's
76
+ `self.model_dump(by_alias=True)`:
77
+
78
+ * `None` is only added to the output dict for nullable fields that
79
+ were set at model initialization. Other fields with value `None`
80
+ are ignored.
81
+ """
82
+ excluded_fields: Set[str] = set([
83
+ ])
84
+
85
+ _dict = self.model_dump(
86
+ by_alias=True,
87
+ exclude=excluded_fields,
88
+ exclude_none=True,
89
+ )
90
+ # set to None if category_id (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.category_id is None and "category_id" in self.model_fields_set:
93
+ _dict['category_id'] = None
94
+
95
+ # set to None if notes (nullable) is None
96
+ # and model_fields_set contains the field
97
+ if self.notes is None and "notes" in self.model_fields_set:
98
+ _dict['notes'] = None
99
+
100
+ return _dict
101
+
102
+ @classmethod
103
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
104
+ """Create an instance of GroupTransactionsRequest from a dict"""
105
+ if obj is None:
106
+ return None
107
+
108
+ if not isinstance(obj, dict):
109
+ return cls.model_validate(obj)
110
+
111
+ _obj = cls.model_validate({
112
+ "ids": obj.get("ids"),
113
+ "date": obj.get("date"),
114
+ "payee": obj.get("payee"),
115
+ "category_id": obj.get("category_id"),
116
+ "notes": obj.get("notes"),
117
+ "status": obj.get("status"),
118
+ "tag_ids": obj.get("tag_ids")
119
+ })
120
+ return _obj
121
+
122
+
@@ -0,0 +1,164 @@
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, StrictInt, StrictStr, field_validator
23
+ from typing import Any, ClassVar, Dict, List, Optional
24
+ from typing_extensions import Annotated
25
+ from lunchmoney.models.currency_enum import CurrencyEnum
26
+ from lunchmoney.models.insert_transaction_object_amount import InsertTransactionObjectAmount
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class InsertTransactionObject(BaseModel):
31
+ """
32
+ InsertTransactionObject
33
+ """ # noqa: E501
34
+ var_date: date = Field(description="Date of transaction in ISO 8601 format", alias="date")
35
+ amount: InsertTransactionObjectAmount
36
+ currency: Optional[CurrencyEnum] = Field(default=None, description="Three-letter lowercase currency code of the transaction in ISO 4217 format. Must match one of the [supported currencies](https://alpha.lunchmoney.dev/v2/currencies). If not set defaults to the user account's primary currency.")
37
+ payee: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=140)]] = Field(default=None, description="Name of payee for the transaction.")
38
+ category_id: Optional[StrictInt] = Field(default=None, description="The ID of the category associated with the transactions. If set, the category ID must exist for the user's account and it cannot be a category group.")
39
+ notes: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=350)]] = Field(default=None, 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. ")
40
+ manual_account_id: Optional[StrictInt] = Field(default=None, description="The Unique identifier for the associated manually managed account. If set, this must match an existing manual account id associated with the user's account. If not set, and `plaid_account_id` is also not set, no account is associated with the transaction and it will appear as a \"Cash Transaction\" in the Lunch Money GUI. It is an error if this, and `plaid_account_id` is also set on the same transaction.")
41
+ plaid_account_id: Optional[StrictInt] = Field(default=None, description="The Unique identifier for the associated plaid synced account. If set, this must match an existing plaid account id associated with the user's account. If not set, and `manual_account_id` is also not set, no account is associated with the transaction and it will appear as a \"Cash Transaction\" in the Lunch Money GUI. It is an error if this, and `manual_account_id` is also set on the same transaction. In addition the specified plaid account must have the \"Allow Modifications To Transactions\" property set (which is enabled by default), or the insert will fail.")
42
+ recurring_id: Optional[StrictInt] = Field(default=None, description="Unique identifier for associated recurring item. Recurring item must be associated with the same account.")
43
+ status: Optional[StrictStr] = Field(default=None, description="If set must be either `reviewed` or `unreviewed`. If not set, defaults to `unreviewed`.")
44
+ tag_ids: Optional[List[StrictInt]] = Field(default=None, description="A list of IDs for the tags associated with this transaction. Each ID must match an existing tag associated with the user's account. If not set, no tags will be associated with the created transaction.")
45
+ 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. If set, and `manual_account_id` is set, the creation of the new transaction will fail if a transaction with this id already exists for the specified manual account.")
46
+ custom_metadata: Optional[Dict[str, Any]] = Field(default=None, description="An optional JSON object that includes additional data related to this transaction. This must be a valid JSON object and, when stringified, must not exceed 4096 characters. This data may be available in the future for processing by rules.")
47
+ __properties: ClassVar[List[str]] = ["date", "amount", "currency", "payee", "category_id", "notes", "manual_account_id", "plaid_account_id", "recurring_id", "status", "tag_ids", "external_id", "custom_metadata"]
48
+
49
+ @field_validator('status')
50
+ def status_validate_enum(cls, value):
51
+ """Validates the enum"""
52
+ if value is None:
53
+ return value
54
+
55
+ if value not in set(['reviewed', 'unreviewed']):
56
+ raise ValueError("must be one of enum values ('reviewed', 'unreviewed')")
57
+ return value
58
+
59
+ model_config = ConfigDict(
60
+ populate_by_name=True,
61
+ validate_assignment=True,
62
+ protected_namespaces=(),
63
+ )
64
+
65
+
66
+ def to_str(self) -> str:
67
+ """Returns the string representation of the model using alias"""
68
+ return pprint.pformat(self.model_dump(by_alias=True))
69
+
70
+ def to_json(self) -> str:
71
+ """Returns the JSON representation of the model using alias"""
72
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
73
+ return json.dumps(self.to_dict())
74
+
75
+ @classmethod
76
+ def from_json(cls, json_str: str) -> Optional[Self]:
77
+ """Create an instance of InsertTransactionObject from a JSON string"""
78
+ return cls.from_dict(json.loads(json_str))
79
+
80
+ def to_dict(self) -> Dict[str, Any]:
81
+ """Return the dictionary representation of the model using alias.
82
+
83
+ This has the following differences from calling pydantic's
84
+ `self.model_dump(by_alias=True)`:
85
+
86
+ * `None` is only added to the output dict for nullable fields that
87
+ were set at model initialization. Other fields with value `None`
88
+ are ignored.
89
+ """
90
+ excluded_fields: Set[str] = set([
91
+ ])
92
+
93
+ _dict = self.model_dump(
94
+ by_alias=True,
95
+ exclude=excluded_fields,
96
+ exclude_none=True,
97
+ )
98
+ # override the default output from pydantic by calling `to_dict()` of amount
99
+ if self.amount:
100
+ _dict['amount'] = self.amount.to_dict()
101
+ # set to None if category_id (nullable) is None
102
+ # and model_fields_set contains the field
103
+ if self.category_id is None and "category_id" in self.model_fields_set:
104
+ _dict['category_id'] = None
105
+
106
+ # set to None if notes (nullable) is None
107
+ # and model_fields_set contains the field
108
+ if self.notes is None and "notes" in self.model_fields_set:
109
+ _dict['notes'] = None
110
+
111
+ # set to None if manual_account_id (nullable) is None
112
+ # and model_fields_set contains the field
113
+ if self.manual_account_id is None and "manual_account_id" in self.model_fields_set:
114
+ _dict['manual_account_id'] = None
115
+
116
+ # set to None if plaid_account_id (nullable) is None
117
+ # and model_fields_set contains the field
118
+ if self.plaid_account_id is None and "plaid_account_id" in self.model_fields_set:
119
+ _dict['plaid_account_id'] = None
120
+
121
+ # set to None if recurring_id (nullable) is None
122
+ # and model_fields_set contains the field
123
+ if self.recurring_id is None and "recurring_id" in self.model_fields_set:
124
+ _dict['recurring_id'] = None
125
+
126
+ # set to None if external_id (nullable) is None
127
+ # and model_fields_set contains the field
128
+ if self.external_id is None and "external_id" in self.model_fields_set:
129
+ _dict['external_id'] = None
130
+
131
+ # set to None if custom_metadata (nullable) is None
132
+ # and model_fields_set contains the field
133
+ if self.custom_metadata is None and "custom_metadata" in self.model_fields_set:
134
+ _dict['custom_metadata'] = None
135
+
136
+ return _dict
137
+
138
+ @classmethod
139
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
140
+ """Create an instance of InsertTransactionObject from a dict"""
141
+ if obj is None:
142
+ return None
143
+
144
+ if not isinstance(obj, dict):
145
+ return cls.model_validate(obj)
146
+
147
+ _obj = cls.model_validate({
148
+ "date": obj.get("date"),
149
+ "amount": InsertTransactionObjectAmount.from_dict(obj["amount"]) if obj.get("amount") is not None else None,
150
+ "currency": obj.get("currency"),
151
+ "payee": obj.get("payee"),
152
+ "category_id": obj.get("category_id"),
153
+ "notes": obj.get("notes"),
154
+ "manual_account_id": obj.get("manual_account_id"),
155
+ "plaid_account_id": obj.get("plaid_account_id"),
156
+ "recurring_id": obj.get("recurring_id"),
157
+ "status": obj.get("status"),
158
+ "tag_ids": obj.get("tag_ids"),
159
+ "external_id": obj.get("external_id"),
160
+ "custom_metadata": obj.get("custom_metadata")
161
+ })
162
+ return _obj
163
+
164
+