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,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
+ INSERTTRANSACTIONOBJECTAMOUNT_ONE_OF_SCHEMAS = ["float", "str"]
27
+
28
+ class InsertTransactionObjectAmount(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.
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 = InsertTransactionObjectAmount.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 InsertTransactionObjectAmount 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 InsertTransactionObjectAmount 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 InsertTransactionObjectAmount 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 InsertTransactionObjectAmount 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,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 pydantic import BaseModel, ConfigDict, Field
22
+ from typing import Any, ClassVar, Dict, List
23
+ from lunchmoney.models.skipped_existing_external_id_object import SkippedExistingExternalIdObject
24
+ from lunchmoney.models.transaction_object import TransactionObject
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class InsertTransactionsResponseObject(BaseModel):
29
+ """
30
+ The object returned from a successful POST /transactions request
31
+ """ # noqa: E501
32
+ transactions: List[TransactionObject] = Field(description="An array of the inserted transactions.")
33
+ skipped_duplicates: List[SkippedExistingExternalIdObject] = Field(description="An array of the requested transactions that were duplicates of existing transactions and were not inserted.")
34
+ __properties: ClassVar[List[str]] = ["transactions", "skipped_duplicates"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of InsertTransactionsResponseObject from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of each item in transactions (list)
76
+ _items = []
77
+ if self.transactions:
78
+ for _item_transactions in self.transactions:
79
+ if _item_transactions:
80
+ _items.append(_item_transactions.to_dict())
81
+ _dict['transactions'] = _items
82
+ # override the default output from pydantic by calling `to_dict()` of each item in skipped_duplicates (list)
83
+ _items = []
84
+ if self.skipped_duplicates:
85
+ for _item_skipped_duplicates in self.skipped_duplicates:
86
+ if _item_skipped_duplicates:
87
+ _items.append(_item_skipped_duplicates.to_dict())
88
+ _dict['skipped_duplicates'] = _items
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of InsertTransactionsResponseObject from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj)
99
+
100
+ _obj = cls.model_validate({
101
+ "transactions": [TransactionObject.from_dict(_item) for _item in obj["transactions"]] if obj.get("transactions") is not None else None,
102
+ "skipped_duplicates": [SkippedExistingExternalIdObject.from_dict(_item) for _item in obj["skipped_duplicates"]] if obj.get("skipped_duplicates") is not None else None
103
+ })
104
+ return _obj
105
+
106
+
@@ -0,0 +1,158 @@
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.account_type_enum import AccountTypeEnum
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+
29
+ class ManualAccountObject(BaseModel):
30
+ """
31
+ An object containing information about a manual account
32
+ """ # noqa: E501
33
+ id: StrictInt = Field(description="The unique identifier of this account")
34
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=45)] = Field(description="Name of the account")
35
+ type: AccountTypeEnum = Field(description="Primary type of the account")
36
+ subtype: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=100)]] = Field(description="Optional account subtype. Examples include<br> - retirement - checking - savings - prepaid credit card")
37
+ display_name: Optional[StrictStr] = Field(description="Optional display name for the account set by the user")
38
+ balance: Annotated[str, Field(strict=True)] = Field(description="Current balance of the account in numeric format to 4 decimal places.")
39
+ currency: Annotated[str, Field(min_length=3, strict=True, max_length=3)] = Field(description="Three-letter lowercase currency code of the account balance")
40
+ to_base: Union[StrictFloat, StrictInt] = Field(description="The balance converted to the user's primary currency")
41
+ balance_as_of: datetime = Field(description="Date balance was last updated in ISO 8601 extended format, can be in date or date-time format")
42
+ closed_on: Optional[date] = Field(description="The date this account was closed. Will be null if the account has not been marked as closed")
43
+ institution_name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=50)]] = Field(description="Name of institution holding the account")
44
+ external_id: Optional[Annotated[str, Field(min_length=0, strict=True, max_length=75)]] = Field(description="An optional external_id that may be set or updated via the API")
45
+ custom_metadata: Optional[Dict[str, Any]] = Field(default=None, description="User defined JSON data that can be set or cleared via the API.")
46
+ exclude_from_transactions: StrictBool = Field(description="If true, this account will not show up as an option for assignment when creating transactions manually")
47
+ created_at: datetime = Field(description="Date/time the account was created in ISO 8601 extended format")
48
+ updated_at: datetime = Field(description="Date/time the account was created in ISO 8601 extended format")
49
+ __properties: ClassVar[List[str]] = ["id", "name", "type", "subtype", "display_name", "balance", "currency", "to_base", "balance_as_of", "closed_on", "institution_name", "external_id", "custom_metadata", "exclude_from_transactions", "created_at", "updated_at"]
50
+
51
+ @field_validator('balance')
52
+ def balance_validate_regular_expression(cls, value):
53
+ """Validates the regular expression"""
54
+ if not re.match(r"^-?\d+(\.\d{1,4})?$", value):
55
+ raise ValueError(r"must validate the regular expression /^-?\d+(\.\d{1,4})?$/")
56
+ return value
57
+
58
+ model_config = ConfigDict(
59
+ populate_by_name=True,
60
+ validate_assignment=True,
61
+ protected_namespaces=(),
62
+ )
63
+
64
+
65
+ def to_str(self) -> str:
66
+ """Returns the string representation of the model using alias"""
67
+ return pprint.pformat(self.model_dump(by_alias=True))
68
+
69
+ def to_json(self) -> str:
70
+ """Returns the JSON representation of the model using alias"""
71
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
72
+ return json.dumps(self.to_dict())
73
+
74
+ @classmethod
75
+ def from_json(cls, json_str: str) -> Optional[Self]:
76
+ """Create an instance of ManualAccountObject from a JSON string"""
77
+ return cls.from_dict(json.loads(json_str))
78
+
79
+ def to_dict(self) -> Dict[str, Any]:
80
+ """Return the dictionary representation of the model using alias.
81
+
82
+ This has the following differences from calling pydantic's
83
+ `self.model_dump(by_alias=True)`:
84
+
85
+ * `None` is only added to the output dict for nullable fields that
86
+ were set at model initialization. Other fields with value `None`
87
+ are ignored.
88
+ """
89
+ excluded_fields: Set[str] = set([
90
+ ])
91
+
92
+ _dict = self.model_dump(
93
+ by_alias=True,
94
+ exclude=excluded_fields,
95
+ exclude_none=True,
96
+ )
97
+ # set to None if subtype (nullable) is None
98
+ # and model_fields_set contains the field
99
+ if self.subtype is None and "subtype" in self.model_fields_set:
100
+ _dict['subtype'] = None
101
+
102
+ # set to None if display_name (nullable) is None
103
+ # and model_fields_set contains the field
104
+ if self.display_name is None and "display_name" in self.model_fields_set:
105
+ _dict['display_name'] = None
106
+
107
+ # set to None if closed_on (nullable) is None
108
+ # and model_fields_set contains the field
109
+ if self.closed_on is None and "closed_on" in self.model_fields_set:
110
+ _dict['closed_on'] = None
111
+
112
+ # set to None if institution_name (nullable) is None
113
+ # and model_fields_set contains the field
114
+ if self.institution_name is None and "institution_name" in self.model_fields_set:
115
+ _dict['institution_name'] = None
116
+
117
+ # set to None if external_id (nullable) is None
118
+ # and model_fields_set contains the field
119
+ if self.external_id is None and "external_id" in self.model_fields_set:
120
+ _dict['external_id'] = None
121
+
122
+ # set to None if custom_metadata (nullable) is None
123
+ # and model_fields_set contains the field
124
+ if self.custom_metadata is None and "custom_metadata" in self.model_fields_set:
125
+ _dict['custom_metadata'] = None
126
+
127
+ return _dict
128
+
129
+ @classmethod
130
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
131
+ """Create an instance of ManualAccountObject from a dict"""
132
+ if obj is None:
133
+ return None
134
+
135
+ if not isinstance(obj, dict):
136
+ return cls.model_validate(obj)
137
+
138
+ _obj = cls.model_validate({
139
+ "id": obj.get("id"),
140
+ "name": obj.get("name"),
141
+ "type": obj.get("type"),
142
+ "subtype": obj.get("subtype"),
143
+ "display_name": obj.get("display_name"),
144
+ "balance": obj.get("balance"),
145
+ "currency": obj.get("currency"),
146
+ "to_base": obj.get("to_base"),
147
+ "balance_as_of": obj.get("balance_as_of"),
148
+ "closed_on": obj.get("closed_on"),
149
+ "institution_name": obj.get("institution_name"),
150
+ "external_id": obj.get("external_id"),
151
+ "custom_metadata": obj.get("custom_metadata"),
152
+ "exclude_from_transactions": obj.get("exclude_from_transactions") if obj.get("exclude_from_transactions") is not None else False,
153
+ "created_at": obj.get("created_at"),
154
+ "updated_at": obj.get("updated_at")
155
+ })
156
+ return _obj
157
+
158
+
@@ -0,0 +1,94 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Lunch Money API - v2
5
+
6
+ Welcome to the Lunch Money v2 API. A working version of this API is now available through these docs, or directly at: `https://api.lunchmoney.dev/v2` <span class=\"red-text\"><strong>This is in alpha launch of a major API update. It is still subject to change during this alpha review period and bugs may still exist. Users are strongly encouraged to use the mock service or to create a test budget with example data as the first step to interacting with the v2 API.</strong></span> See the [Getting Started Guide](https://alpha.lunchmoney.dev/v2/getting-started) for more information on using a test budget.<br<br> If you are new to the v2 API, you may wish to review the [v2 API Overview of Changes](https://alpha.lunchmoney.dev/v2/changelog). ### Static Mock Server You may also use these docs to explore the API using a static mock server endpoint.<p> This enables users to become familiar with the API without having to create an access token, and eliminates the possibility of modifying real data. <p> To access this endpoint select the second endpoint in the the \"Server\" dropdown to the right. When selected you should see \"Static Mock v2 Lunch Money API Server\".<br> When using this server, set your Bearer token to any string with 11 or more characters. ### Migrating from V1 The v2 API is NOT backwards compatible with the v1 API. Developers are encouraged to review the [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) to understand the changes and plan their migration. ### Acknowledgments If you have been providing feedback on the API during our iterative design process, **THANK YOU**. We are happy to provide the opportunity to finally interact with the working API that was built based on your feedback. ### Useful links: - [Getting Started](https://alpha.lunchmoney.dev/v2/getting-started) - [v2 API Changelog](https://alpha.lunchmoney.dev/v2/changelog) - [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) - [Rate Limits](https://alpha.lunchmoney.dev/v2/rate-limits) - [Current v1 Lunch Money API Documentation](https://lunchmoney.dev) - [Awesome Lunch Money Projects](https://github.com/lunch-money/awesome-lunchmoney?tab=readme-ov-file)
7
+
8
+ The version of the OpenAPI document: 2.8.4
9
+ Contact: devsupport@lunchmoney.app
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ from __future__ import annotations
17
+ import pprint
18
+ import re # noqa: F401
19
+ import json
20
+
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
22
+ from typing import Any, ClassVar, Dict, List, Union
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class NonAlignedCategoryTotalsObject(BaseModel):
27
+ """
28
+ Total activity for the given category within the given date range which is not aligned with budget period setting.
29
+ """ # noqa: E501
30
+ other_activity: Union[StrictFloat, StrictInt] = Field(description="Total non recurring activity, in the user's default currency, for the category within the given date range.<br> The total activity for the category is the sum of this and the recurring_activity.")
31
+ recurring_activity: Union[StrictFloat, StrictInt] = Field(description="Total recurring activity, in the user's default currency, for the category within the given date range.<br> The total activity for the category is the sum of this and the other_activity.")
32
+ recurring_remaining: Union[StrictFloat, StrictInt] = Field(description="Total expected recurring activity, in the user's default currency, that has not yet occurred for the category within the given date range.")
33
+ recurring_expected: Union[StrictFloat, StrictInt] = Field(description="Total expected recurring activity for the category within the given date range.")
34
+ __properties: ClassVar[List[str]] = ["other_activity", "recurring_activity", "recurring_remaining", "recurring_expected"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of NonAlignedCategoryTotalsObject from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of NonAlignedCategoryTotalsObject from a dict"""
80
+ if obj is None:
81
+ return None
82
+
83
+ if not isinstance(obj, dict):
84
+ return cls.model_validate(obj)
85
+
86
+ _obj = cls.model_validate({
87
+ "other_activity": obj.get("other_activity"),
88
+ "recurring_activity": obj.get("recurring_activity"),
89
+ "recurring_remaining": obj.get("recurring_remaining"),
90
+ "recurring_expected": obj.get("recurring_expected")
91
+ })
92
+ return _obj
93
+
94
+
@@ -0,0 +1,94 @@
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, StrictInt
22
+ from typing import Any, ClassVar, Dict, List
23
+ from lunchmoney.models.non_aligned_category_totals_object import NonAlignedCategoryTotalsObject
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class NonAlignedSummaryCategoryObject(BaseModel):
28
+ """
29
+ List of each category's budget configuration and activity for the given date range.<br> Does not include occurrences since the start_date and end_date are not aligned with budget period setting.
30
+ """ # noqa: E501
31
+ category_id: StrictInt = Field(description="ID of the category associated with the totals.")
32
+ totals: NonAlignedCategoryTotalsObject
33
+ __properties: ClassVar[List[str]] = ["category_id", "totals"]
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 NonAlignedSummaryCategoryObject 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 totals
75
+ if self.totals:
76
+ _dict['totals'] = self.totals.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of NonAlignedSummaryCategoryObject from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "category_id": obj.get("category_id"),
90
+ "totals": NonAlignedCategoryTotalsObject.from_dict(obj["totals"]) if obj.get("totals") is not None else None
91
+ })
92
+ return _obj
93
+
94
+