codapact-ynab 0.2.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.
- codapact_ynab/__init__.py +6 -0
- codapact_ynab/__main__.py +6 -0
- codapact_ynab/_model.json +11304 -0
- codapact_ynab/cli.py +573 -0
- codapact_ynab/client.py +475 -0
- codapact_ynab/py.typed +0 -0
- codapact_ynab/types.py +1365 -0
- codapact_ynab-0.2.0.dist-info/METADATA +89 -0
- codapact_ynab-0.2.0.dist-info/RECORD +12 -0
- codapact_ynab-0.2.0.dist-info/WHEEL +4 -0
- codapact_ynab-0.2.0.dist-info/entry_points.txt +3 -0
- codapact_ynab-0.2.0.dist-info/licenses/LICENSE +21 -0
codapact_ynab/client.py
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
"""Client generated from the library surface. Do not edit."""
|
|
2
|
+
|
|
3
|
+
# ruff: noqa: E501
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import builtins # noqa: F401
|
|
7
|
+
from collections.abc import Iterator, Sequence
|
|
8
|
+
from functools import cache
|
|
9
|
+
from importlib.resources import files
|
|
10
|
+
from typing import Any, Literal, cast # noqa: F401
|
|
11
|
+
|
|
12
|
+
from codapact.runtime import (
|
|
13
|
+
AuthProvider,
|
|
14
|
+
Middleware,
|
|
15
|
+
RuntimeClient,
|
|
16
|
+
Transport,
|
|
17
|
+
load_model,
|
|
18
|
+
)
|
|
19
|
+
from codapact.runtime.arguments import UNSET, Unset, call_args
|
|
20
|
+
|
|
21
|
+
from codapact.runtime.arguments import fields as _fields # noqa: F401
|
|
22
|
+
|
|
23
|
+
from . import types as _t
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@cache
|
|
27
|
+
def _model() -> Any:
|
|
28
|
+
return load_model(files(__package__).joinpath("_model.json"))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class _AccountsResource:
|
|
32
|
+
"""Operations under ``accounts``."""
|
|
33
|
+
|
|
34
|
+
def __init__(self, runtime: RuntimeClient) -> None:
|
|
35
|
+
self._runtime = runtime
|
|
36
|
+
|
|
37
|
+
def list(self, *, plan_id: str | Unset = UNSET, last_knowledge_of_server: int | Unset = UNSET) -> _t.AccountsResponse:
|
|
38
|
+
"""
|
|
39
|
+
Get all accounts
|
|
40
|
+
|
|
41
|
+
Returns all accounts
|
|
42
|
+
"""
|
|
43
|
+
return cast('_t.AccountsResponse', self._runtime.call('get_accounts', call_args({'plan_id': plan_id, 'last_knowledge_of_server': last_knowledge_of_server})))
|
|
44
|
+
|
|
45
|
+
def create(self, *, name: str, type_: _t.SaveAccountType, balance: int, plan_id: str | Unset = UNSET) -> _t.AccountResponse:
|
|
46
|
+
"""
|
|
47
|
+
Create an account
|
|
48
|
+
|
|
49
|
+
Creates a new account
|
|
50
|
+
"""
|
|
51
|
+
return cast('_t.AccountResponse', self._runtime.call('create_account', call_args({'plan_id': plan_id}, {'body': {'account': _fields({'name': name, 'type': type_, 'balance': balance})}}, required=frozenset({'body'}))))
|
|
52
|
+
|
|
53
|
+
def get(self, *, account_id: str, plan_id: str | Unset = UNSET) -> _t.AccountResponse:
|
|
54
|
+
"""
|
|
55
|
+
Get an account
|
|
56
|
+
|
|
57
|
+
Returns a single account
|
|
58
|
+
"""
|
|
59
|
+
return cast('_t.AccountResponse', self._runtime.call('get_account_by_id', call_args({'plan_id': plan_id, 'account_id': account_id})))
|
|
60
|
+
|
|
61
|
+
class _CategoriesResource:
|
|
62
|
+
"""Operations under ``categories``."""
|
|
63
|
+
|
|
64
|
+
def __init__(self, runtime: RuntimeClient) -> None:
|
|
65
|
+
self._runtime = runtime
|
|
66
|
+
|
|
67
|
+
def list(self, *, plan_id: str | Unset = UNSET, last_knowledge_of_server: int | Unset = UNSET) -> _t.CategoriesResponse:
|
|
68
|
+
"""
|
|
69
|
+
Get all categories
|
|
70
|
+
|
|
71
|
+
Returns all categories grouped by category group. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC).
|
|
72
|
+
"""
|
|
73
|
+
return cast('_t.CategoriesResponse', self._runtime.call('get_categories', call_args({'plan_id': plan_id, 'last_knowledge_of_server': last_knowledge_of_server})))
|
|
74
|
+
|
|
75
|
+
def create(self, *, name: str | None, category_group_id: str, plan_id: str | Unset = UNSET, note: str | None | Unset = UNSET, goal_target: int | None | Unset = UNSET, goal_target_date: str | None | Unset = UNSET, goal_needs_whole_amount: bool | None | Unset = UNSET, goal_frequency: _t.SaveCategoryGoalFrequency | Unset = UNSET) -> _t.SaveCategoryResponse:
|
|
76
|
+
"""
|
|
77
|
+
Create a category
|
|
78
|
+
|
|
79
|
+
Creates a new category
|
|
80
|
+
"""
|
|
81
|
+
return cast('_t.SaveCategoryResponse', self._runtime.call('create_category', call_args({'plan_id': plan_id}, {'body': {'category': _fields({'name': name, 'note': note, 'category_group_id': category_group_id, 'goal_target': goal_target, 'goal_target_date': goal_target_date, 'goal_needs_whole_amount': goal_needs_whole_amount, 'goal_frequency': goal_frequency})}}, required=frozenset({'body'}))))
|
|
82
|
+
|
|
83
|
+
def get(self, *, category_id: str, plan_id: str | Unset = UNSET) -> _t.CategoryResponse:
|
|
84
|
+
"""
|
|
85
|
+
Get a category
|
|
86
|
+
|
|
87
|
+
Returns a single category. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC).
|
|
88
|
+
"""
|
|
89
|
+
return cast('_t.CategoryResponse', self._runtime.call('get_category_by_id', call_args({'plan_id': plan_id, 'category_id': category_id})))
|
|
90
|
+
|
|
91
|
+
def update(self, *, category_id: str, plan_id: str | Unset = UNSET, name: str | None | Unset = UNSET, note: str | None | Unset = UNSET, category_group_id: str | Unset = UNSET, goal_target: int | None | Unset = UNSET, goal_target_date: str | None | Unset = UNSET, goal_needs_whole_amount: bool | None | Unset = UNSET, goal_frequency: _t.SaveCategoryGoalFrequency | Unset = UNSET) -> _t.SaveCategoryResponse:
|
|
92
|
+
"""Update a category"""
|
|
93
|
+
return cast('_t.SaveCategoryResponse', self._runtime.call('update_category', call_args({'plan_id': plan_id, 'category_id': category_id}, {'body': {'category': _fields({'name': name, 'note': note, 'category_group_id': category_group_id, 'goal_target': goal_target, 'goal_target_date': goal_target_date, 'goal_needs_whole_amount': goal_needs_whole_amount, 'goal_frequency': goal_frequency})}})))
|
|
94
|
+
|
|
95
|
+
def get_month(self, *, month: str, category_id: str, plan_id: str | Unset = UNSET) -> _t.CategoryResponse:
|
|
96
|
+
"""
|
|
97
|
+
Get a category for a specific plan month
|
|
98
|
+
|
|
99
|
+
Returns a single category for a specific plan month. Amounts (assigned, activity, available, etc.) are specific to the current plan month (UTC).
|
|
100
|
+
"""
|
|
101
|
+
return cast('_t.CategoryResponse', self._runtime.call('get_month_category_by_id', call_args({'plan_id': plan_id, 'month': month, 'category_id': category_id})))
|
|
102
|
+
|
|
103
|
+
def update_month(self, *, month: str, category_id: str, budgeted: int, plan_id: str | Unset = UNSET) -> _t.SaveCategoryResponse:
|
|
104
|
+
"""
|
|
105
|
+
Update a category for a specific month
|
|
106
|
+
|
|
107
|
+
Update a category for a specific month. Only `budgeted` (assigned) amount can be updated.
|
|
108
|
+
"""
|
|
109
|
+
return cast('_t.SaveCategoryResponse', self._runtime.call('update_month_category', call_args({'plan_id': plan_id, 'month': month, 'category_id': category_id}, {'body': {'category': _fields({'budgeted': budgeted})}}, required=frozenset({'body'}))))
|
|
110
|
+
|
|
111
|
+
def create_group(self, *, name: str, plan_id: str | Unset = UNSET) -> _t.SaveCategoryGroupResponse:
|
|
112
|
+
"""
|
|
113
|
+
Create a category group
|
|
114
|
+
|
|
115
|
+
Creates a new category group
|
|
116
|
+
"""
|
|
117
|
+
return cast('_t.SaveCategoryGroupResponse', self._runtime.call('create_category_group', call_args({'plan_id': plan_id}, {'body': {'category_group': _fields({'name': name})}}, required=frozenset({'body'}))))
|
|
118
|
+
|
|
119
|
+
def update_group(self, *, category_group_id: str, name: str, plan_id: str | Unset = UNSET) -> _t.SaveCategoryGroupResponse:
|
|
120
|
+
"""Update a category group"""
|
|
121
|
+
return cast('_t.SaveCategoryGroupResponse', self._runtime.call('update_category_group', call_args({'plan_id': plan_id, 'category_group_id': category_group_id}, {'body': {'category_group': _fields({'name': name})}}, required=frozenset({'body'}))))
|
|
122
|
+
|
|
123
|
+
class _MoneyMovementsResource:
|
|
124
|
+
"""Operations under ``money_movements``."""
|
|
125
|
+
|
|
126
|
+
def __init__(self, runtime: RuntimeClient) -> None:
|
|
127
|
+
self._runtime = runtime
|
|
128
|
+
|
|
129
|
+
def list(self, *, plan_id: str | Unset = UNSET) -> _t.MoneyMovementsResponse:
|
|
130
|
+
"""
|
|
131
|
+
Get all money movements
|
|
132
|
+
|
|
133
|
+
Returns all money movements
|
|
134
|
+
"""
|
|
135
|
+
return cast('_t.MoneyMovementsResponse', self._runtime.call('get_money_movements', call_args({'plan_id': plan_id})))
|
|
136
|
+
|
|
137
|
+
def list_by_month(self, *, month: str, plan_id: str | Unset = UNSET) -> _t.MoneyMovementsResponse:
|
|
138
|
+
"""
|
|
139
|
+
Get money movements for a plan month
|
|
140
|
+
|
|
141
|
+
Returns all money movements for a specific month
|
|
142
|
+
"""
|
|
143
|
+
return cast('_t.MoneyMovementsResponse', self._runtime.call('get_money_movements_by_month', call_args({'plan_id': plan_id, 'month': month})))
|
|
144
|
+
|
|
145
|
+
def list_groups(self, *, plan_id: str | Unset = UNSET) -> _t.MoneyMovementGroupsResponse:
|
|
146
|
+
"""
|
|
147
|
+
Get all money movement groups
|
|
148
|
+
|
|
149
|
+
Returns all money movement groups
|
|
150
|
+
"""
|
|
151
|
+
return cast('_t.MoneyMovementGroupsResponse', self._runtime.call('get_money_movement_groups', call_args({'plan_id': plan_id})))
|
|
152
|
+
|
|
153
|
+
def list_groups_by_month(self, *, month: str, plan_id: str | Unset = UNSET) -> _t.MoneyMovementGroupsResponse:
|
|
154
|
+
"""
|
|
155
|
+
Get money movement groups for a plan month
|
|
156
|
+
|
|
157
|
+
Returns all money movement groups for a specific month
|
|
158
|
+
"""
|
|
159
|
+
return cast('_t.MoneyMovementGroupsResponse', self._runtime.call('get_money_movement_groups_by_month', call_args({'plan_id': plan_id, 'month': month})))
|
|
160
|
+
|
|
161
|
+
class _MonthsResource:
|
|
162
|
+
"""Operations under ``months``."""
|
|
163
|
+
|
|
164
|
+
def __init__(self, runtime: RuntimeClient) -> None:
|
|
165
|
+
self._runtime = runtime
|
|
166
|
+
|
|
167
|
+
def list(self, *, plan_id: str | Unset = UNSET, last_knowledge_of_server: int | Unset = UNSET) -> _t.MonthSummariesResponse:
|
|
168
|
+
"""
|
|
169
|
+
Get all plan months
|
|
170
|
+
|
|
171
|
+
Returns all plan months
|
|
172
|
+
"""
|
|
173
|
+
return cast('_t.MonthSummariesResponse', self._runtime.call('get_plan_months', call_args({'plan_id': plan_id, 'last_knowledge_of_server': last_knowledge_of_server})))
|
|
174
|
+
|
|
175
|
+
def get(self, *, month: str, plan_id: str | Unset = UNSET) -> _t.MonthDetailResponse:
|
|
176
|
+
"""
|
|
177
|
+
Get a plan month
|
|
178
|
+
|
|
179
|
+
Returns a single plan month
|
|
180
|
+
"""
|
|
181
|
+
return cast('_t.MonthDetailResponse', self._runtime.call('get_plan_month', call_args({'plan_id': plan_id, 'month': month})))
|
|
182
|
+
|
|
183
|
+
class _PayeeLocationsResource:
|
|
184
|
+
"""Operations under ``payee_locations``."""
|
|
185
|
+
|
|
186
|
+
def __init__(self, runtime: RuntimeClient) -> None:
|
|
187
|
+
self._runtime = runtime
|
|
188
|
+
|
|
189
|
+
def list(self, *, plan_id: str | Unset = UNSET) -> _t.PayeeLocationsResponse:
|
|
190
|
+
"""
|
|
191
|
+
Get all payee locations
|
|
192
|
+
|
|
193
|
+
Returns all payee locations
|
|
194
|
+
"""
|
|
195
|
+
return cast('_t.PayeeLocationsResponse', self._runtime.call('get_payee_locations', call_args({'plan_id': plan_id})))
|
|
196
|
+
|
|
197
|
+
def get(self, *, payee_location_id: str, plan_id: str | Unset = UNSET) -> _t.PayeeLocationResponse:
|
|
198
|
+
"""
|
|
199
|
+
Get a payee location
|
|
200
|
+
|
|
201
|
+
Returns a single payee location
|
|
202
|
+
"""
|
|
203
|
+
return cast('_t.PayeeLocationResponse', self._runtime.call('get_payee_location_by_id', call_args({'plan_id': plan_id, 'payee_location_id': payee_location_id})))
|
|
204
|
+
|
|
205
|
+
def list_by_payee(self, *, payee_id: str, plan_id: str | Unset = UNSET) -> _t.PayeeLocationsResponse:
|
|
206
|
+
"""
|
|
207
|
+
Get all locations for a payee
|
|
208
|
+
|
|
209
|
+
Returns all payee locations for a specified payee
|
|
210
|
+
"""
|
|
211
|
+
return cast('_t.PayeeLocationsResponse', self._runtime.call('get_payee_locations_by_payee', call_args({'plan_id': plan_id, 'payee_id': payee_id})))
|
|
212
|
+
|
|
213
|
+
class _PayeesResource:
|
|
214
|
+
"""Operations under ``payees``."""
|
|
215
|
+
|
|
216
|
+
def __init__(self, runtime: RuntimeClient) -> None:
|
|
217
|
+
self._runtime = runtime
|
|
218
|
+
|
|
219
|
+
def list(self, *, plan_id: str | Unset = UNSET, last_knowledge_of_server: int | Unset = UNSET) -> _t.PayeesResponse:
|
|
220
|
+
"""
|
|
221
|
+
Get all payees
|
|
222
|
+
|
|
223
|
+
Returns all payees
|
|
224
|
+
"""
|
|
225
|
+
return cast('_t.PayeesResponse', self._runtime.call('get_payees', call_args({'plan_id': plan_id, 'last_knowledge_of_server': last_knowledge_of_server})))
|
|
226
|
+
|
|
227
|
+
def create(self, *, name: str, plan_id: str | Unset = UNSET) -> _t.SavePayeeResponse:
|
|
228
|
+
"""
|
|
229
|
+
Create a payee
|
|
230
|
+
|
|
231
|
+
Creates a new payee
|
|
232
|
+
"""
|
|
233
|
+
return cast('_t.SavePayeeResponse', self._runtime.call('create_payee', call_args({'plan_id': plan_id}, {'body': {'payee': _fields({'name': name})}}, required=frozenset({'body'}))))
|
|
234
|
+
|
|
235
|
+
def get(self, *, payee_id: str, plan_id: str | Unset = UNSET) -> _t.PayeeResponse:
|
|
236
|
+
"""
|
|
237
|
+
Get a payee
|
|
238
|
+
|
|
239
|
+
Returns a single payee
|
|
240
|
+
"""
|
|
241
|
+
return cast('_t.PayeeResponse', self._runtime.call('get_payee_by_id', call_args({'plan_id': plan_id, 'payee_id': payee_id})))
|
|
242
|
+
|
|
243
|
+
def update(self, *, payee_id: str, plan_id: str | Unset = UNSET, name: str | Unset = UNSET) -> _t.SavePayeeResponse:
|
|
244
|
+
"""Update a payee"""
|
|
245
|
+
return cast('_t.SavePayeeResponse', self._runtime.call('update_payee', call_args({'plan_id': plan_id, 'payee_id': payee_id}, {'body': {'payee': _fields({'name': name})}})))
|
|
246
|
+
|
|
247
|
+
class _PlansResource:
|
|
248
|
+
"""Operations under ``plans``."""
|
|
249
|
+
|
|
250
|
+
def __init__(self, runtime: RuntimeClient) -> None:
|
|
251
|
+
self._runtime = runtime
|
|
252
|
+
|
|
253
|
+
def list(self, *, include_accounts: bool | Unset = UNSET) -> _t.PlanSummaryResponse:
|
|
254
|
+
"""
|
|
255
|
+
Get all plans
|
|
256
|
+
|
|
257
|
+
Returns plans list with summary information
|
|
258
|
+
"""
|
|
259
|
+
return cast('_t.PlanSummaryResponse', self._runtime.call('get_plans', call_args({'include_accounts': include_accounts})))
|
|
260
|
+
|
|
261
|
+
def get(self, *, plan_id: str | Unset = UNSET, last_knowledge_of_server: int | Unset = UNSET) -> _t.PlanDetailResponse:
|
|
262
|
+
"""
|
|
263
|
+
Get a plan
|
|
264
|
+
|
|
265
|
+
Returns a single plan with all related entities. This resource is effectively a full plan export.
|
|
266
|
+
"""
|
|
267
|
+
return cast('_t.PlanDetailResponse', self._runtime.call('get_plan_by_id', call_args({'plan_id': plan_id, 'last_knowledge_of_server': last_knowledge_of_server})))
|
|
268
|
+
|
|
269
|
+
def get_settings(self, *, plan_id: str | Unset = UNSET) -> _t.PlanSettingsResponse:
|
|
270
|
+
"""
|
|
271
|
+
Get plan settings
|
|
272
|
+
|
|
273
|
+
Returns settings for a plan
|
|
274
|
+
"""
|
|
275
|
+
return cast('_t.PlanSettingsResponse', self._runtime.call('get_plan_settings_by_id', call_args({'plan_id': plan_id})))
|
|
276
|
+
|
|
277
|
+
class _ScheduledTransactionsResource:
|
|
278
|
+
"""Operations under ``scheduled_transactions``."""
|
|
279
|
+
|
|
280
|
+
def __init__(self, runtime: RuntimeClient) -> None:
|
|
281
|
+
self._runtime = runtime
|
|
282
|
+
|
|
283
|
+
def list(self, *, plan_id: str | Unset = UNSET, last_knowledge_of_server: int | Unset = UNSET) -> _t.ScheduledTransactionsResponse:
|
|
284
|
+
"""
|
|
285
|
+
Get all scheduled transactions
|
|
286
|
+
|
|
287
|
+
Returns all scheduled transactions
|
|
288
|
+
"""
|
|
289
|
+
return cast('_t.ScheduledTransactionsResponse', self._runtime.call('get_scheduled_transactions', call_args({'plan_id': plan_id, 'last_knowledge_of_server': last_knowledge_of_server})))
|
|
290
|
+
|
|
291
|
+
def create(self, *, account_id: str, date: str, plan_id: str | Unset = UNSET, amount: int | Unset = UNSET, payee_id: str | None | Unset = UNSET, payee_name: str | None | Unset = UNSET, category_id: str | None | Unset = UNSET, memo: str | None | Unset = UNSET, flag_color: _t.TransactionFlagColor | None | Unset = UNSET, frequency: _t.ScheduledTransactionFrequency | Unset = UNSET) -> _t.ScheduledTransactionResponse:
|
|
292
|
+
"""
|
|
293
|
+
Create a scheduled transaction
|
|
294
|
+
|
|
295
|
+
Creates a single scheduled transaction (a transaction with a future date).
|
|
296
|
+
"""
|
|
297
|
+
return cast('_t.ScheduledTransactionResponse', self._runtime.call('create_scheduled_transaction', call_args({'plan_id': plan_id}, {'body': {'scheduled_transaction': _fields({'account_id': account_id, 'date': date, 'amount': amount, 'payee_id': payee_id, 'payee_name': payee_name, 'category_id': category_id, 'memo': memo, 'flag_color': flag_color, 'frequency': frequency})}}, required=frozenset({'body'}))))
|
|
298
|
+
|
|
299
|
+
def get(self, *, scheduled_transaction_id: str, plan_id: str | Unset = UNSET) -> _t.ScheduledTransactionResponse:
|
|
300
|
+
"""
|
|
301
|
+
Get a scheduled transaction
|
|
302
|
+
|
|
303
|
+
Returns a single scheduled transaction
|
|
304
|
+
"""
|
|
305
|
+
return cast('_t.ScheduledTransactionResponse', self._runtime.call('get_scheduled_transaction_by_id', call_args({'plan_id': plan_id, 'scheduled_transaction_id': scheduled_transaction_id})))
|
|
306
|
+
|
|
307
|
+
def update(self, *, scheduled_transaction_id: str, account_id: str, date: str, plan_id: str | Unset = UNSET, amount: int | Unset = UNSET, payee_id: str | None | Unset = UNSET, payee_name: str | None | Unset = UNSET, category_id: str | None | Unset = UNSET, memo: str | None | Unset = UNSET, flag_color: _t.TransactionFlagColor | None | Unset = UNSET, frequency: _t.ScheduledTransactionFrequency | Unset = UNSET) -> _t.ScheduledTransactionResponse:
|
|
308
|
+
"""
|
|
309
|
+
Update a scheduled transaction
|
|
310
|
+
|
|
311
|
+
Updates a single scheduled transaction
|
|
312
|
+
"""
|
|
313
|
+
return cast('_t.ScheduledTransactionResponse', self._runtime.call('update_scheduled_transaction', call_args({'plan_id': plan_id, 'scheduled_transaction_id': scheduled_transaction_id}, {'body': {'scheduled_transaction': _fields({'account_id': account_id, 'date': date, 'amount': amount, 'payee_id': payee_id, 'payee_name': payee_name, 'category_id': category_id, 'memo': memo, 'flag_color': flag_color, 'frequency': frequency})}}, required=frozenset({'body'}))))
|
|
314
|
+
|
|
315
|
+
def delete(self, *, scheduled_transaction_id: str, plan_id: str | Unset = UNSET) -> _t.ScheduledTransactionResponse:
|
|
316
|
+
"""
|
|
317
|
+
Delete a scheduled transaction
|
|
318
|
+
|
|
319
|
+
Deletes a scheduled transaction
|
|
320
|
+
"""
|
|
321
|
+
return cast('_t.ScheduledTransactionResponse', self._runtime.call('delete_scheduled_transaction', call_args({'plan_id': plan_id, 'scheduled_transaction_id': scheduled_transaction_id})))
|
|
322
|
+
|
|
323
|
+
class _TransactionsResource:
|
|
324
|
+
"""Operations under ``transactions``."""
|
|
325
|
+
|
|
326
|
+
def __init__(self, runtime: RuntimeClient) -> None:
|
|
327
|
+
self._runtime = runtime
|
|
328
|
+
|
|
329
|
+
def list(self, *, plan_id: str | Unset = UNSET, since_date: str | Unset = UNSET, until_date: str | Unset = UNSET, type_: _t.GetTransactionsType | Unset = UNSET, last_knowledge_of_server: int | Unset = UNSET) -> _t.TransactionsResponse:
|
|
330
|
+
"""
|
|
331
|
+
Get transactions
|
|
332
|
+
|
|
333
|
+
Returns plan transactions, excluding any pending transactions
|
|
334
|
+
"""
|
|
335
|
+
return cast('_t.TransactionsResponse', self._runtime.call('get_transactions', call_args({'plan_id': plan_id, 'since_date': since_date, 'until_date': until_date, 'type': type_, 'last_knowledge_of_server': last_knowledge_of_server})))
|
|
336
|
+
|
|
337
|
+
def create(self, *, plan_id: str | Unset = UNSET, transaction: _t.NewTransaction | Unset = UNSET, transactions: builtins.list[_t.NewTransaction] | Unset = UNSET) -> _t.SaveTransactionsResponse:
|
|
338
|
+
"""
|
|
339
|
+
Create a single transaction or multiple transactions
|
|
340
|
+
|
|
341
|
+
Creates a single transaction or multiple transactions. If you provide a body containing a `transaction` object, a single transaction will be created and if you provide a body containing a `transactions` array, multiple transactions will be created. Scheduled transactions (transactions with a future date) cannot be created on this endpoint.
|
|
342
|
+
"""
|
|
343
|
+
return cast('_t.SaveTransactionsResponse', self._runtime.call('create_transaction', call_args({'plan_id': plan_id}, {'body': {'transaction': transaction, 'transactions': transactions}})))
|
|
344
|
+
|
|
345
|
+
def update_many(self, *, transactions: builtins.list[_t.SaveTransactionWithIdOrImportId], plan_id: str | Unset = UNSET) -> _t.SaveTransactionsResponse:
|
|
346
|
+
"""
|
|
347
|
+
Update multiple transactions
|
|
348
|
+
|
|
349
|
+
Updates multiple transactions, by `id` or `import_id`.
|
|
350
|
+
"""
|
|
351
|
+
return cast('_t.SaveTransactionsResponse', self._runtime.call('update_transactions', call_args({'plan_id': plan_id}, {'body': {'transactions': transactions}}, required=frozenset({'body'}))))
|
|
352
|
+
|
|
353
|
+
def import_(self, *, plan_id: str | Unset = UNSET) -> _t.TransactionsImportResponse:
|
|
354
|
+
"""
|
|
355
|
+
Import transactions
|
|
356
|
+
|
|
357
|
+
DEPRECATED: This endpoint is no longer needed because YNAB now automatically imports transactions on linked accounts. Requests are still accepted for backwards compatibility but no import is performed and the response will always contain an empty list of transaction ids.
|
|
358
|
+
|
|
359
|
+
Deprecated.
|
|
360
|
+
"""
|
|
361
|
+
return cast('_t.TransactionsImportResponse', self._runtime.call('import_transactions', call_args({'plan_id': plan_id})))
|
|
362
|
+
|
|
363
|
+
def get(self, *, transaction_id: str, plan_id: str | Unset = UNSET) -> _t.TransactionResponse:
|
|
364
|
+
"""
|
|
365
|
+
Get a transaction
|
|
366
|
+
|
|
367
|
+
Returns a single transaction
|
|
368
|
+
"""
|
|
369
|
+
return cast('_t.TransactionResponse', self._runtime.call('get_transaction_by_id', call_args({'plan_id': plan_id, 'transaction_id': transaction_id})))
|
|
370
|
+
|
|
371
|
+
def update(self, *, transaction_id: str, plan_id: str | Unset = UNSET, account_id: str | Unset = UNSET, date: str | Unset = UNSET, amount: int | Unset = UNSET, payee_id: str | None | Unset = UNSET, payee_name: str | None | Unset = UNSET, category_id: str | None | Unset = UNSET, memo: str | None | Unset = UNSET, cleared: _t.TransactionClearedStatus | Unset = UNSET, approved: bool | Unset = UNSET, flag_color: _t.TransactionFlagColor | None | Unset = UNSET, subtransactions: builtins.list[_t.SaveSubTransaction] | Unset = UNSET) -> _t.TransactionResponse:
|
|
372
|
+
"""
|
|
373
|
+
Update a transaction
|
|
374
|
+
|
|
375
|
+
Updates a single transaction
|
|
376
|
+
"""
|
|
377
|
+
return cast('_t.TransactionResponse', self._runtime.call('update_transaction', call_args({'plan_id': plan_id, 'transaction_id': transaction_id}, {'body': {'transaction': _fields({'account_id': account_id, 'date': date, 'amount': amount, 'payee_id': payee_id, 'payee_name': payee_name, 'category_id': category_id, 'memo': memo, 'cleared': cleared, 'approved': approved, 'flag_color': flag_color, 'subtransactions': subtransactions})}})))
|
|
378
|
+
|
|
379
|
+
def delete(self, *, transaction_id: str, plan_id: str | Unset = UNSET) -> _t.TransactionResponse:
|
|
380
|
+
"""
|
|
381
|
+
Delete a transaction
|
|
382
|
+
|
|
383
|
+
Deletes a transaction
|
|
384
|
+
"""
|
|
385
|
+
return cast('_t.TransactionResponse', self._runtime.call('delete_transaction', call_args({'plan_id': plan_id, 'transaction_id': transaction_id})))
|
|
386
|
+
|
|
387
|
+
def list_by_account(self, *, account_id: str, plan_id: str | Unset = UNSET, since_date: str | Unset = UNSET, until_date: str | Unset = UNSET, type_: _t.GetTransactionsByAccountType | Unset = UNSET, last_knowledge_of_server: int | Unset = UNSET) -> _t.TransactionsResponse:
|
|
388
|
+
"""
|
|
389
|
+
Get account transactions
|
|
390
|
+
|
|
391
|
+
Returns all transactions for a specified account, excluding any pending transactions
|
|
392
|
+
"""
|
|
393
|
+
return cast('_t.TransactionsResponse', self._runtime.call('get_transactions_by_account', call_args({'plan_id': plan_id, 'account_id': account_id, 'since_date': since_date, 'until_date': until_date, 'type': type_, 'last_knowledge_of_server': last_knowledge_of_server})))
|
|
394
|
+
|
|
395
|
+
def list_by_category(self, *, category_id: str, plan_id: str | Unset = UNSET, since_date: str | Unset = UNSET, until_date: str | Unset = UNSET, type_: _t.GetTransactionsByCategoryType | Unset = UNSET, last_knowledge_of_server: int | Unset = UNSET) -> _t.HybridTransactionsResponse:
|
|
396
|
+
"""
|
|
397
|
+
Get category transactions
|
|
398
|
+
|
|
399
|
+
Returns all transactions for a specified category, excluding any pending transactions
|
|
400
|
+
"""
|
|
401
|
+
return cast('_t.HybridTransactionsResponse', self._runtime.call('get_transactions_by_category', call_args({'plan_id': plan_id, 'category_id': category_id, 'since_date': since_date, 'until_date': until_date, 'type': type_, 'last_knowledge_of_server': last_knowledge_of_server})))
|
|
402
|
+
|
|
403
|
+
def list_by_payee(self, *, payee_id: str, plan_id: str | Unset = UNSET, since_date: str | Unset = UNSET, until_date: str | Unset = UNSET, type_: _t.GetTransactionsByPayeeType | Unset = UNSET, last_knowledge_of_server: int | Unset = UNSET) -> _t.HybridTransactionsResponse:
|
|
404
|
+
"""
|
|
405
|
+
Get payee transactions
|
|
406
|
+
|
|
407
|
+
Returns all transactions for a specified payee, excluding any pending transactions
|
|
408
|
+
"""
|
|
409
|
+
return cast('_t.HybridTransactionsResponse', self._runtime.call('get_transactions_by_payee', call_args({'plan_id': plan_id, 'payee_id': payee_id, 'since_date': since_date, 'until_date': until_date, 'type': type_, 'last_knowledge_of_server': last_knowledge_of_server})))
|
|
410
|
+
|
|
411
|
+
def list_by_month(self, *, month: str, plan_id: str | Unset = UNSET, since_date: str | Unset = UNSET, until_date: str | Unset = UNSET, type_: _t.GetTransactionsByMonthType | Unset = UNSET, last_knowledge_of_server: int | Unset = UNSET) -> _t.TransactionsResponse:
|
|
412
|
+
"""
|
|
413
|
+
Get plan month transactions
|
|
414
|
+
|
|
415
|
+
Returns all transactions for a specified month, excluding any pending transactions
|
|
416
|
+
"""
|
|
417
|
+
return cast('_t.TransactionsResponse', self._runtime.call('get_transactions_by_month', call_args({'plan_id': plan_id, 'month': month, 'since_date': since_date, 'until_date': until_date, 'type': type_, 'last_knowledge_of_server': last_knowledge_of_server})))
|
|
418
|
+
|
|
419
|
+
class _UserResource:
|
|
420
|
+
"""Operations under ``user``."""
|
|
421
|
+
|
|
422
|
+
def __init__(self, runtime: RuntimeClient) -> None:
|
|
423
|
+
self._runtime = runtime
|
|
424
|
+
|
|
425
|
+
def get(self) -> _t.UserResponse:
|
|
426
|
+
"""
|
|
427
|
+
Get user
|
|
428
|
+
|
|
429
|
+
Returns authenticated user information
|
|
430
|
+
"""
|
|
431
|
+
return cast('_t.UserResponse', self._runtime.call('get_user', call_args({})))
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
class Client:
|
|
435
|
+
"""
|
|
436
|
+
YNAB API Endpoints client.
|
|
437
|
+
|
|
438
|
+
Default base URL: https://api.ynab.com/v1
|
|
439
|
+
"""
|
|
440
|
+
|
|
441
|
+
def __init__(
|
|
442
|
+
self,
|
|
443
|
+
*,
|
|
444
|
+
base_url: str | None = None,
|
|
445
|
+
auth: AuthProvider | None = None,
|
|
446
|
+
transport: Transport | None = None,
|
|
447
|
+
middleware: Sequence[Middleware] | None = None,
|
|
448
|
+
validate: bool = True,
|
|
449
|
+
timeout: float = 30.0,
|
|
450
|
+
allow_private: bool = False,
|
|
451
|
+
response_validation: str = "strict",
|
|
452
|
+
proxy: str | None = None,
|
|
453
|
+
) -> None:
|
|
454
|
+
self._runtime = RuntimeClient(
|
|
455
|
+
_model(),
|
|
456
|
+
base_url=base_url,
|
|
457
|
+
auth=auth,
|
|
458
|
+
transport=transport,
|
|
459
|
+
middleware=middleware,
|
|
460
|
+
validate=validate,
|
|
461
|
+
timeout=timeout,
|
|
462
|
+
allow_private=allow_private,
|
|
463
|
+
response_validation=response_validation,
|
|
464
|
+
proxy=proxy,
|
|
465
|
+
)
|
|
466
|
+
self.accounts = _AccountsResource(self._runtime)
|
|
467
|
+
self.categories = _CategoriesResource(self._runtime)
|
|
468
|
+
self.money_movements = _MoneyMovementsResource(self._runtime)
|
|
469
|
+
self.months = _MonthsResource(self._runtime)
|
|
470
|
+
self.payee_locations = _PayeeLocationsResource(self._runtime)
|
|
471
|
+
self.payees = _PayeesResource(self._runtime)
|
|
472
|
+
self.plans = _PlansResource(self._runtime)
|
|
473
|
+
self.scheduled_transactions = _ScheduledTransactionsResource(self._runtime)
|
|
474
|
+
self.transactions = _TransactionsResource(self._runtime)
|
|
475
|
+
self.user = _UserResource(self._runtime)
|
codapact_ynab/py.typed
ADDED
|
File without changes
|