Skip to content

Commit 2a12701

Browse files
authored
✨ get_recurring_items
#125
1 parent 63a8912 commit 2a12701

File tree

9 files changed

+439
-7
lines changed

9 files changed

+439
-7
lines changed

docs/interacting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ lunch = LunchMoney(access_token="xxxxxxxxxxx")
2020
| GET | [get_category](#lunchable.LunchMoney.get_category) | Get single category |
2121
| GET | [get_crypto](#lunchable.LunchMoney.get_crypto) | Get Crypto Assets |
2222
| GET | [get_plaid_accounts](#lunchable.LunchMoney.get_plaid_accounts) | Get Plaid Synced Assets |
23-
| GET | [get_recurring_expenses](#lunchable.LunchMoney.get_recurring_expenses) | Get Recurring Expenses |
23+
| GET | [get_recurring_items](#lunchable.LunchMoney.get_recurring_items) | Get Recurring Items |
2424
| GET | [get_tags](#lunchable.LunchMoney.get_tags) | Get Spending Tags |
2525
| GET | [get_transaction](#lunchable.LunchMoney.get_transaction) | Get a Transaction by ID |
2626
| GET | [get_transactions](#lunchable.LunchMoney.get_transactions) | Get Transactions Using Criteria |

lunchable/_config/api_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class APIConfig:
2626
LUNCHMONEY_TRANSACTION_GROUPS: str = "group"
2727
LUNCHMONEY_PLAID_ACCOUNTS: str = "plaid_accounts"
2828
LUNCH_MONEY_RECURRING_EXPENSES: str = "recurring_expenses"
29+
LUNCH_MONEY_RECURRING_ITEMS: str = "recurring_items"
2930
LUNCHMONEY_BUDGET: str = "budgets"
3031
LUNCHMONEY_ASSETS: str = "assets"
3132
LUNCHMONEY_CATEGORIES: str = "categories"

lunchable/models/_descriptions.py

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,150 @@ class _RecurringExpensesDescriptions:
273273
"""
274274

275275

276+
class _SummarizedTransactionDescriptions:
277+
"""
278+
Descriptions for Summarized Transaction
279+
"""
280+
281+
id = """
282+
Unique identifier for the transaction that matched this recurring item
283+
"""
284+
date = """
285+
Date of transaction in ISO 8601 format
286+
"""
287+
amount = """
288+
Amount of the transaction in numeric format to 4 decimal places
289+
"""
290+
currency = """
291+
Three-letter lowercase currency code of the transaction in ISO 4217 format
292+
"""
293+
payee = """
294+
Payee or payer of the recurring item
295+
"""
296+
category_id = """
297+
Unique identifier of associated category
298+
"""
299+
recurring_id = """
300+
Unique identifier of associated recurring item
301+
"""
302+
to_base = """
303+
The amount converted to the user's primary currency. If the multicurrency
304+
feature is not being used, to_base and amount will be the same.
305+
"""
306+
307+
308+
class _RecurringItemsDescriptions:
309+
"""
310+
Descriptions for Recurring Items
311+
"""
312+
313+
id = """
314+
Unique identifier for recurring item
315+
"""
316+
start_date = """
317+
Denotes when recurring item starts occurring in ISO 8601 format.
318+
If null, then this recurring item will show up for all time before end_date
319+
"""
320+
end_date = """
321+
Denotes when recurring item stops occurring in ISO 8601 format.
322+
If null, then this recurring item has no set end date and will
323+
show up for all months after start_date
324+
"""
325+
payee = """
326+
Payee or payer of the recurring item
327+
"""
328+
currency = """
329+
Three-letter lowercase currency code for the recurring item in ISO 4217 format
330+
"""
331+
created_by = """
332+
The id of the user who created this recurring item.
333+
"""
334+
created_at = """
335+
The date and time of when the recurring item was created (in the ISO 8601
336+
extended format).
337+
"""
338+
updated_at = """
339+
The date and time of when the recurring item was updated (in the ISO 8601 extended format).
340+
"""
341+
billing_date = """
342+
Initial date that a transaction associated with this recurring item occured.
343+
This date is used in conjunction with values of quantity and granularity to
344+
determine the expected dates of recurring transactions in the period.
345+
"""
346+
original_name = """
347+
If any, represents the original name of the recurring item as denoted by
348+
the transaction that triggered its creation
349+
"""
350+
description = """
351+
If any, represents the user-entered description of the recurring item
352+
"""
353+
plaid_account_id = """
354+
If any, denotes the plaid account associated with the creation of this
355+
recurring item (see Plaid Accounts)
356+
"""
357+
asset_id = """
358+
If any, denotes the manually-managed account (i.e. asset) associated
359+
with the creation of this recurring item (see Assets)
360+
"""
361+
source = """
362+
This can be one of four values:
363+
- manual: User created this recurring item manually from the Recurring Items page
364+
- transaction: User created this by converting a transaction from the Transactions page
365+
- system: Recurring item was created by the system on transaction import
366+
- null: Some older recurring items may not have a source.
367+
"""
368+
notes = """
369+
If any, the user-entered notes for the recurring item
370+
"""
371+
amount = """
372+
Amount of the recurring item in numeric format to 4 decimal places.
373+
For recurring items with flexible amounts, this is the average of the
374+
specified min and max amounts.
375+
"""
376+
category_id = """
377+
If any, denotes the unique identifier for the associated category to this recurring item
378+
"""
379+
category_group_id = """
380+
If any, denotes the unique identifier of associated category group
381+
"""
382+
is_income = """
383+
Based on the associated category's property, denotes if the recurring transaction
384+
is treated as income
385+
"""
386+
exclude_from_totals = """
387+
Based on the associated category's property, denotes if the recurring transaction is excluded from totals
388+
"""
389+
granularity = """
390+
The unit of time used to define the cadence of the recurring item.
391+
One of `weeks`, `months`, `years`
392+
"""
393+
quantity = """
394+
The number of granular units between each occurrence
395+
"""
396+
occurrences = """
397+
An object which contains dates as keys and lists as values. The dates will
398+
include all the dates in the month that a recurring item is expected, as well
399+
as the last date in the previous period and the first date in the next period.
400+
The value for each key is a list of Summarized Transaction Objects that matched
401+
the recurring item for that date (if any)
402+
"""
403+
transactions_within_range = """
404+
A list of all the Summarized Transaction Objects for transactions that that
405+
have occurred in the query month for the recurring item (if any)
406+
"""
407+
missing_dates_within_range = """
408+
A list of date strings when a recurring transaction is expected but has not (yet) occurred.
409+
"""
410+
date = """
411+
Denotes the value of the start_date query parameter, or if none was provided, the date when
412+
the request was made. This indicates the month used by the system when populating the response.
413+
"""
414+
to_base = """
415+
The amount converted to the user's primary currency. If the multicurrency feature is not being
416+
used, to_base and amount will be the same.
417+
"""
418+
419+
276420
class _TransactionInsertDescriptions:
277421
"""
278422
Descriptions for TransactionInsertObject

lunchable/models/_lunchmoney.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .crypto import CryptoClient
1919
from .plaid_accounts import PlaidAccountsClient
2020
from .recurring_expenses import RecurringExpensesClient
21+
from .recurring_items import RecurringItemsClient
2122
from .tags import TagsClient
2223
from .transactions import TransactionsClient
2324
from .user import UserClient
@@ -33,6 +34,7 @@ class LunchMoney(
3334
TagsClient,
3435
TransactionsClient,
3536
UserClient,
37+
RecurringItemsClient,
3638
):
3739
"""
3840
Lunch Money Python Client.

lunchable/models/recurring_expenses.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import datetime
88
import logging
9+
import warnings
910
from typing import List, Optional
1011

1112
from pydantic import Field
@@ -55,9 +56,6 @@ class RecurringExpensesObject(LunchableModel):
5556
asset_id: Optional[int] = Field(
5657
None, description=_RecurringExpensesDescriptions.asset_id
5758
)
58-
transaction_id: Optional[int] = Field(
59-
None, description=_RecurringExpensesDescriptions.transaction_id
60-
)
6159
category_id: Optional[int] = Field(
6260
None, description=_RecurringExpensesDescriptions.category_id
6361
)
@@ -85,6 +83,9 @@ def get_recurring_expenses(
8583
"""
8684
Get Recurring Expenses
8785
86+
**DEPRECATED** - Use [LunchMoney.get_recurring_items()][lunchable.LunchMoney.get_recurring_items]
87+
instead.
88+
8889
Retrieve a list of recurring expenses to expect for a specified period.
8990
9091
Every month, a different set of recurring expenses is expected. This is because recurring
@@ -111,6 +112,14 @@ def get_recurring_expenses(
111112
-------
112113
List[RecurringExpensesObject]
113114
"""
115+
warnings.warn(
116+
message=(
117+
"`LunchMoney.get_recurring_expenses` is deprecated, "
118+
"use `LunchMoney.get_recurring_items` instead"
119+
),
120+
category=DeprecationWarning,
121+
stacklevel=2,
122+
)
114123
if start_date is None:
115124
start_date = datetime.datetime.now().date().replace(day=1)
116125
params = RecurringExpenseParamsGet(

0 commit comments

Comments
 (0)