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/cli.py ADDED
@@ -0,0 +1,573 @@
1
+ """Command line interface generated from the command model. Do not edit."""
2
+
3
+ # ruff: noqa: E501
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ from collections.abc import Sequence
8
+ from typing import Any
9
+
10
+ from codapact.runtime.cli import ( # noqa: F401
11
+ CliRuntime,
12
+ compact,
13
+ integer,
14
+ json_value,
15
+ number,
16
+ )
17
+
18
+ from .client import Client
19
+ from .client import _model as _api_model
20
+
21
+ RUNTIME = CliRuntime(program='ynab', env_prefix='YNAB', version='0.1.0', distribution='codapact-ynab', api_name='YNAB API Endpoints', api_version='1.91.0', model=_api_model, auth_plugin='', auth_config={})
22
+ RAW = argparse.RawDescriptionHelpFormatter
23
+
24
+
25
+
26
+ def _run_accounts_list(client: Client, args: argparse.Namespace) -> Any:
27
+ kwargs = compact({'plan_id': args.p_plan_id, 'last_knowledge_of_server': args.p_last_knowledge_of_server})
28
+ return client.accounts.list(**kwargs)
29
+
30
+
31
+ def _run_accounts_create(client: Client, args: argparse.Namespace) -> Any:
32
+ kwargs = compact({'plan_id': args.p_plan_id, 'name': args.p_name, 'type_': args.p_type, 'balance': args.p_balance})
33
+ return client.accounts.create(**kwargs)
34
+
35
+
36
+ def _run_accounts_get(client: Client, args: argparse.Namespace) -> Any:
37
+ RUNTIME.require(args, 'p_account_id', 'ACCOUNT_ID (or --account-id)')
38
+ kwargs = compact({'plan_id': args.p_plan_id, 'account_id': getattr(args, 'p_account_id', None)})
39
+ return client.accounts.get(**kwargs)
40
+
41
+
42
+ def _run_categories_list(client: Client, args: argparse.Namespace) -> Any:
43
+ kwargs = compact({'plan_id': args.p_plan_id, 'last_knowledge_of_server': args.p_last_knowledge_of_server})
44
+ return client.categories.list(**kwargs)
45
+
46
+
47
+ def _run_categories_create(client: Client, args: argparse.Namespace) -> Any:
48
+ kwargs = compact({'plan_id': args.p_plan_id, 'name': args.p_name, 'note': args.p_note, 'category_group_id': args.p_category_group_id, 'goal_target': args.p_goal_target, 'goal_target_date': args.p_goal_target_date, 'goal_needs_whole_amount': args.p_goal_needs_whole_amount, 'goal_frequency': args.p_goal_frequency})
49
+ return client.categories.create(**kwargs)
50
+
51
+
52
+ def _run_categories_get(client: Client, args: argparse.Namespace) -> Any:
53
+ RUNTIME.require(args, 'p_category_id', 'CATEGORY_ID (or --category-id)')
54
+ kwargs = compact({'plan_id': args.p_plan_id, 'category_id': getattr(args, 'p_category_id', None)})
55
+ return client.categories.get(**kwargs)
56
+
57
+
58
+ def _run_categories_update(client: Client, args: argparse.Namespace) -> Any:
59
+ RUNTIME.require(args, 'p_category_id', 'CATEGORY_ID (or --category-id)')
60
+ kwargs = compact({'plan_id': args.p_plan_id, 'category_id': getattr(args, 'p_category_id', None), 'name': args.p_name, 'note': args.p_note, 'category_group_id': args.p_category_group_id, 'goal_target': args.p_goal_target, 'goal_target_date': args.p_goal_target_date, 'goal_needs_whole_amount': args.p_goal_needs_whole_amount, 'goal_frequency': args.p_goal_frequency})
61
+ return client.categories.update(**kwargs)
62
+
63
+
64
+ def _run_categories_get_month(client: Client, args: argparse.Namespace) -> Any:
65
+ RUNTIME.require(args, 'p_month', 'YYYY-MM-DD (or --month)')
66
+ RUNTIME.require(args, 'p_category_id', 'CATEGORY_ID (or --category-id)')
67
+ kwargs = compact({'plan_id': args.p_plan_id, 'month': getattr(args, 'p_month', None), 'category_id': getattr(args, 'p_category_id', None)})
68
+ return client.categories.get_month(**kwargs)
69
+
70
+
71
+ def _run_categories_update_month(client: Client, args: argparse.Namespace) -> Any:
72
+ RUNTIME.require(args, 'p_month', 'YYYY-MM-DD (or --month)')
73
+ RUNTIME.require(args, 'p_category_id', 'CATEGORY_ID (or --category-id)')
74
+ kwargs = compact({'plan_id': args.p_plan_id, 'month': getattr(args, 'p_month', None), 'category_id': getattr(args, 'p_category_id', None), 'budgeted': args.p_budgeted})
75
+ return client.categories.update_month(**kwargs)
76
+
77
+
78
+ def _run_categories_create_group(client: Client, args: argparse.Namespace) -> Any:
79
+ kwargs = compact({'plan_id': args.p_plan_id, 'name': args.p_name})
80
+ return client.categories.create_group(**kwargs)
81
+
82
+
83
+ def _run_categories_update_group(client: Client, args: argparse.Namespace) -> Any:
84
+ RUNTIME.require(args, 'p_category_group_id', 'CATEGORY_GROUP_ID (or --category-group-id)')
85
+ kwargs = compact({'plan_id': args.p_plan_id, 'category_group_id': getattr(args, 'p_category_group_id', None), 'name': args.p_name})
86
+ return client.categories.update_group(**kwargs)
87
+
88
+
89
+ def _run_money_movements_list(client: Client, args: argparse.Namespace) -> Any:
90
+ kwargs = compact({'plan_id': args.p_plan_id})
91
+ return client.money_movements.list(**kwargs)
92
+
93
+
94
+ def _run_money_movements_list_by_month(client: Client, args: argparse.Namespace) -> Any:
95
+ RUNTIME.require(args, 'p_month', 'YYYY-MM-DD (or --month)')
96
+ kwargs = compact({'plan_id': args.p_plan_id, 'month': getattr(args, 'p_month', None)})
97
+ return client.money_movements.list_by_month(**kwargs)
98
+
99
+
100
+ def _run_money_movements_list_groups(client: Client, args: argparse.Namespace) -> Any:
101
+ kwargs = compact({'plan_id': args.p_plan_id})
102
+ return client.money_movements.list_groups(**kwargs)
103
+
104
+
105
+ def _run_money_movements_list_groups_by_month(client: Client, args: argparse.Namespace) -> Any:
106
+ RUNTIME.require(args, 'p_month', 'YYYY-MM-DD (or --month)')
107
+ kwargs = compact({'plan_id': args.p_plan_id, 'month': getattr(args, 'p_month', None)})
108
+ return client.money_movements.list_groups_by_month(**kwargs)
109
+
110
+
111
+ def _run_months_list(client: Client, args: argparse.Namespace) -> Any:
112
+ kwargs = compact({'plan_id': args.p_plan_id, 'last_knowledge_of_server': args.p_last_knowledge_of_server})
113
+ return client.months.list(**kwargs)
114
+
115
+
116
+ def _run_months_get(client: Client, args: argparse.Namespace) -> Any:
117
+ RUNTIME.require(args, 'p_month', 'YYYY-MM-DD (or --month)')
118
+ kwargs = compact({'plan_id': args.p_plan_id, 'month': getattr(args, 'p_month', None)})
119
+ return client.months.get(**kwargs)
120
+
121
+
122
+ def _run_payee_locations_list(client: Client, args: argparse.Namespace) -> Any:
123
+ kwargs = compact({'plan_id': args.p_plan_id})
124
+ return client.payee_locations.list(**kwargs)
125
+
126
+
127
+ def _run_payee_locations_get(client: Client, args: argparse.Namespace) -> Any:
128
+ RUNTIME.require(args, 'p_payee_location_id', 'PAYEE_LOCATION_ID (or --payee-location-id)')
129
+ kwargs = compact({'plan_id': args.p_plan_id, 'payee_location_id': getattr(args, 'p_payee_location_id', None)})
130
+ return client.payee_locations.get(**kwargs)
131
+
132
+
133
+ def _run_payee_locations_list_by_payee(client: Client, args: argparse.Namespace) -> Any:
134
+ RUNTIME.require(args, 'p_payee_id', 'PAYEE_ID (or --payee-id)')
135
+ kwargs = compact({'plan_id': args.p_plan_id, 'payee_id': getattr(args, 'p_payee_id', None)})
136
+ return client.payee_locations.list_by_payee(**kwargs)
137
+
138
+
139
+ def _run_payees_list(client: Client, args: argparse.Namespace) -> Any:
140
+ kwargs = compact({'plan_id': args.p_plan_id, 'last_knowledge_of_server': args.p_last_knowledge_of_server})
141
+ return client.payees.list(**kwargs)
142
+
143
+
144
+ def _run_payees_create(client: Client, args: argparse.Namespace) -> Any:
145
+ kwargs = compact({'plan_id': args.p_plan_id, 'name': args.p_name})
146
+ return client.payees.create(**kwargs)
147
+
148
+
149
+ def _run_payees_get(client: Client, args: argparse.Namespace) -> Any:
150
+ RUNTIME.require(args, 'p_payee_id', 'PAYEE_ID (or --payee-id)')
151
+ kwargs = compact({'plan_id': args.p_plan_id, 'payee_id': getattr(args, 'p_payee_id', None)})
152
+ return client.payees.get(**kwargs)
153
+
154
+
155
+ def _run_payees_update(client: Client, args: argparse.Namespace) -> Any:
156
+ RUNTIME.require(args, 'p_payee_id', 'PAYEE_ID (or --payee-id)')
157
+ kwargs = compact({'plan_id': args.p_plan_id, 'payee_id': getattr(args, 'p_payee_id', None), 'name': args.p_name})
158
+ return client.payees.update(**kwargs)
159
+
160
+
161
+ def _run_plans_list(client: Client, args: argparse.Namespace) -> Any:
162
+ kwargs = compact({'include_accounts': args.p_include_accounts})
163
+ return client.plans.list(**kwargs)
164
+
165
+
166
+ def _run_plans_get(client: Client, args: argparse.Namespace) -> Any:
167
+ kwargs = compact({'plan_id': args.p_plan_id, 'last_knowledge_of_server': args.p_last_knowledge_of_server})
168
+ return client.plans.get(**kwargs)
169
+
170
+
171
+ def _run_plans_get_settings(client: Client, args: argparse.Namespace) -> Any:
172
+ kwargs = compact({'plan_id': args.p_plan_id})
173
+ return client.plans.get_settings(**kwargs)
174
+
175
+
176
+ def _run_scheduled_transactions_list(client: Client, args: argparse.Namespace) -> Any:
177
+ kwargs = compact({'plan_id': args.p_plan_id, 'last_knowledge_of_server': args.p_last_knowledge_of_server})
178
+ return client.scheduled_transactions.list(**kwargs)
179
+
180
+
181
+ def _run_scheduled_transactions_create(client: Client, args: argparse.Namespace) -> Any:
182
+ kwargs = compact({'plan_id': args.p_plan_id, 'account_id': args.p_account_id, 'date': args.p_date, 'amount': args.p_amount, 'payee_id': args.p_payee_id, 'payee_name': args.p_payee_name, 'category_id': args.p_category_id, 'memo': args.p_memo, 'flag_color': args.p_flag_color, 'frequency': args.p_frequency})
183
+ return client.scheduled_transactions.create(**kwargs)
184
+
185
+
186
+ def _run_scheduled_transactions_get(client: Client, args: argparse.Namespace) -> Any:
187
+ RUNTIME.require(args, 'p_scheduled_transaction_id', 'SCHEDULED_TRANSACTION_ID (or --scheduled-transaction-id)')
188
+ kwargs = compact({'plan_id': args.p_plan_id, 'scheduled_transaction_id': getattr(args, 'p_scheduled_transaction_id', None)})
189
+ return client.scheduled_transactions.get(**kwargs)
190
+
191
+
192
+ def _run_scheduled_transactions_update(client: Client, args: argparse.Namespace) -> Any:
193
+ RUNTIME.require(args, 'p_scheduled_transaction_id', 'SCHEDULED_TRANSACTION_ID (or --scheduled-transaction-id)')
194
+ kwargs = compact({'plan_id': args.p_plan_id, 'scheduled_transaction_id': getattr(args, 'p_scheduled_transaction_id', None), 'account_id': args.p_account_id, 'date': args.p_date, 'amount': args.p_amount, 'payee_id': args.p_payee_id, 'payee_name': args.p_payee_name, 'category_id': args.p_category_id, 'memo': args.p_memo, 'flag_color': args.p_flag_color, 'frequency': args.p_frequency})
195
+ return client.scheduled_transactions.update(**kwargs)
196
+
197
+
198
+ def _run_scheduled_transactions_delete(client: Client, args: argparse.Namespace) -> Any:
199
+ RUNTIME.require(args, 'p_scheduled_transaction_id', 'SCHEDULED_TRANSACTION_ID (or --scheduled-transaction-id)')
200
+ kwargs = compact({'plan_id': args.p_plan_id, 'scheduled_transaction_id': getattr(args, 'p_scheduled_transaction_id', None)})
201
+ RUNTIME.confirm(args, 'scheduled-transactions delete')
202
+ return client.scheduled_transactions.delete(**kwargs)
203
+
204
+
205
+ def _run_transactions_list(client: Client, args: argparse.Namespace) -> Any:
206
+ kwargs = compact({'plan_id': args.p_plan_id, 'since_date': args.p_since_date, 'until_date': args.p_until_date, 'type_': args.p_type, 'last_knowledge_of_server': args.p_last_knowledge_of_server})
207
+ return client.transactions.list(**kwargs)
208
+
209
+
210
+ def _run_transactions_create(client: Client, args: argparse.Namespace) -> Any:
211
+ kwargs = compact({'plan_id': args.p_plan_id, 'transaction': args.p_transaction, 'transactions': args.p_transactions})
212
+ return client.transactions.create(**kwargs)
213
+
214
+
215
+ def _run_transactions_update_many(client: Client, args: argparse.Namespace) -> Any:
216
+ kwargs = compact({'plan_id': args.p_plan_id, 'transactions': args.p_transactions})
217
+ return client.transactions.update_many(**kwargs)
218
+
219
+
220
+ def _run_transactions_import(client: Client, args: argparse.Namespace) -> Any:
221
+ kwargs = compact({'plan_id': args.p_plan_id})
222
+ return client.transactions.import_(**kwargs)
223
+
224
+
225
+ def _run_transactions_get(client: Client, args: argparse.Namespace) -> Any:
226
+ RUNTIME.require(args, 'p_transaction_id', 'TRANSACTION_ID (or --transaction-id)')
227
+ kwargs = compact({'plan_id': args.p_plan_id, 'transaction_id': getattr(args, 'p_transaction_id', None)})
228
+ return client.transactions.get(**kwargs)
229
+
230
+
231
+ def _run_transactions_update(client: Client, args: argparse.Namespace) -> Any:
232
+ RUNTIME.require(args, 'p_transaction_id', 'TRANSACTION_ID (or --transaction-id)')
233
+ kwargs = compact({'plan_id': args.p_plan_id, 'transaction_id': getattr(args, 'p_transaction_id', None), 'account_id': args.p_account_id, 'date': args.p_date, 'amount': args.p_amount, 'payee_id': args.p_payee_id, 'payee_name': args.p_payee_name, 'category_id': args.p_category_id, 'memo': args.p_memo, 'cleared': args.p_cleared, 'approved': args.p_approved, 'flag_color': args.p_flag_color, 'subtransactions': args.p_subtransactions})
234
+ return client.transactions.update(**kwargs)
235
+
236
+
237
+ def _run_transactions_delete(client: Client, args: argparse.Namespace) -> Any:
238
+ RUNTIME.require(args, 'p_transaction_id', 'TRANSACTION_ID (or --transaction-id)')
239
+ kwargs = compact({'plan_id': args.p_plan_id, 'transaction_id': getattr(args, 'p_transaction_id', None)})
240
+ RUNTIME.confirm(args, 'transactions delete')
241
+ return client.transactions.delete(**kwargs)
242
+
243
+
244
+ def _run_transactions_list_by_account(client: Client, args: argparse.Namespace) -> Any:
245
+ RUNTIME.require(args, 'p_account_id', 'ACCOUNT_ID (or --account-id)')
246
+ kwargs = compact({'plan_id': args.p_plan_id, 'account_id': getattr(args, 'p_account_id', None), 'since_date': args.p_since_date, 'until_date': args.p_until_date, 'type_': args.p_type, 'last_knowledge_of_server': args.p_last_knowledge_of_server})
247
+ return client.transactions.list_by_account(**kwargs)
248
+
249
+
250
+ def _run_transactions_list_by_category(client: Client, args: argparse.Namespace) -> Any:
251
+ RUNTIME.require(args, 'p_category_id', 'CATEGORY_ID (or --category-id)')
252
+ kwargs = compact({'plan_id': args.p_plan_id, 'category_id': getattr(args, 'p_category_id', None), 'since_date': args.p_since_date, 'until_date': args.p_until_date, 'type_': args.p_type, 'last_knowledge_of_server': args.p_last_knowledge_of_server})
253
+ return client.transactions.list_by_category(**kwargs)
254
+
255
+
256
+ def _run_transactions_list_by_payee(client: Client, args: argparse.Namespace) -> Any:
257
+ RUNTIME.require(args, 'p_payee_id', 'PAYEE_ID (or --payee-id)')
258
+ kwargs = compact({'plan_id': args.p_plan_id, 'payee_id': getattr(args, 'p_payee_id', None), 'since_date': args.p_since_date, 'until_date': args.p_until_date, 'type_': args.p_type, 'last_knowledge_of_server': args.p_last_knowledge_of_server})
259
+ return client.transactions.list_by_payee(**kwargs)
260
+
261
+
262
+ def _run_transactions_list_by_month(client: Client, args: argparse.Namespace) -> Any:
263
+ RUNTIME.require(args, 'p_month', 'MONTH (or --month)')
264
+ kwargs = compact({'plan_id': args.p_plan_id, 'month': getattr(args, 'p_month', None), 'since_date': args.p_since_date, 'until_date': args.p_until_date, 'type_': args.p_type, 'last_knowledge_of_server': args.p_last_knowledge_of_server})
265
+ return client.transactions.list_by_month(**kwargs)
266
+
267
+
268
+ def _run_user_get(client: Client, args: argparse.Namespace) -> Any:
269
+ kwargs = compact({})
270
+ return client.user.get(**kwargs)
271
+
272
+ def build_parser() -> argparse.ArgumentParser:
273
+ """Build the argument parser."""
274
+ common = argparse.ArgumentParser(add_help=False)
275
+ RUNTIME.add_global_options(common, hidden=True)
276
+ parser = RUNTIME.parser(
277
+ description='Our API uses a REST based design, leverages the JSON data format, and relies\nupon HTTPS for transport. We respond with meaningful HTTP response codes and\nif an error occurs, we include error details in the response body.\n\nRead the [API Documentation](https://api.ynab.com) for more information about\nthe API, including how to obtain an access token and how to use it to make\nrequests.',
278
+ epilog="credentials:\n bearer: set YNAB_BEARER, YNAB_BEARER_COMMAND, or run 'ynab auth login'",
279
+ examples=['ynab accounts get ACCOUNT_ID'],
280
+ )
281
+ commands = parser.add_subparsers(dest="command", metavar="COMMAND", required=True)
282
+ g_accounts = commands.add_parser('accounts', help='create, get, list', description="Run 'ynab accounts COMMAND --help' for a command's options and examples.")
283
+ g_accounts_commands = g_accounts.add_subparsers(dest="g_accounts", metavar="COMMAND", required=True)
284
+ c = g_accounts_commands.add_parser('list', parents=[common], help='Get all accounts', description='Returns all accounts', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab accounts list']), formatter_class=RAW)
285
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
286
+ c.add_argument('--last-knowledge-of-server', dest='p_last_knowledge_of_server', type=integer, metavar='LAST_KNOWLEDGE_OF_SERVER', help='The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.')
287
+ c.set_defaults(handler=_run_accounts_list, flags={'plan_id': '--plan-id', 'last_knowledge_of_server': '--last-knowledge-of-server'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_accounts'})
288
+ c = g_accounts_commands.add_parser('create', parents=[common], help='Create an account', description='Creates a new account', usage='%(prog)s --name NAME --type {checking,savings,cash,creditCard,otherAsset,otherLiability} --balance BALANCE [options]', epilog=RUNTIME.command_epilog(['ynab accounts create --name NAME --type checking --balance BALANCE', 'ynab accounts create --name NAME --type checking --balance BALANCE --dry-run']), formatter_class=RAW)
289
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan ("last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan) (default: last-used)')
290
+ c.add_argument('--name', dest='p_name', metavar='NAME', required=True, help='The name of the account')
291
+ c.add_argument('--type', dest='p_type', choices=['checking', 'savings', 'cash', 'creditCard', 'otherAsset', 'otherLiability'], required=True)
292
+ c.add_argument('--balance', dest='p_balance', type=integer, metavar='BALANCE', required=True, help='The current balance of the account in milliunits format')
293
+ c.set_defaults(handler=_run_accounts_create, flags={'plan_id': '--plan-id', 'body.account.name': '--name', 'body.account.type': '--type', 'body.account.balance': '--balance'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'create_account'})
294
+ c = g_accounts_commands.add_parser('get', parents=[common], help='Get an account', description='Returns a single account', usage='%(prog)s ACCOUNT_ID [options]', epilog=RUNTIME.command_epilog(['ynab accounts get ACCOUNT_ID']), formatter_class=RAW)
295
+ c.add_argument('p_account_id', metavar='ACCOUNT_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the account')
296
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
297
+ c.add_argument('--account-id', dest='p_account_id', default=argparse.SUPPRESS, metavar='ACCOUNT_ID', help='same as ACCOUNT_ID')
298
+ c.set_defaults(handler=_run_accounts_get, flags={'plan_id': '--plan-id', 'account_id': '--account-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_account_by_id'})
299
+ g_categories = commands.add_parser('categories', help='create, create-group, get, … (8 commands)', description="Run 'ynab categories COMMAND --help' for a command's options and examples.")
300
+ g_categories_commands = g_categories.add_subparsers(dest="g_categories", metavar="COMMAND", required=True)
301
+ c = g_categories_commands.add_parser('list', parents=[common], help='Get all categories', description='Returns all categories grouped by category group. Amounts (assigned, activity,\navailable, etc.) are specific to the current plan month (UTC).', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab categories list']), formatter_class=RAW)
302
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
303
+ c.add_argument('--last-knowledge-of-server', dest='p_last_knowledge_of_server', type=integer, metavar='LAST_KNOWLEDGE_OF_SERVER', help='The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.')
304
+ c.set_defaults(handler=_run_categories_list, flags={'plan_id': '--plan-id', 'last_knowledge_of_server': '--last-knowledge-of-server'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_categories'})
305
+ c = g_categories_commands.add_parser('create', parents=[common], help='Create a category', description='Creates a new category', usage='%(prog)s --name NAME --category-group-id CATEGORY_GROUP_ID [options]', epilog=RUNTIME.command_epilog(['ynab categories create --name NAME --category-group-id CATEGORY_GROUP_ID', 'ynab categories create --name NAME --category-group-id CATEGORY_GROUP_ID --dry-run']), formatter_class=RAW)
306
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan ("last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan) (default: last-used)')
307
+ c.add_argument('--name', dest='p_name', metavar='NAME', required=True)
308
+ c.add_argument('--note', dest='p_note', metavar='NOTE')
309
+ c.add_argument('--category-group-id', dest='p_category_group_id', metavar='CATEGORY_GROUP_ID', required=True, help='The id of the category group to which this category belongs. An internal category group may not be specified.')
310
+ c.add_argument('--goal-target', dest='p_goal_target', type=integer, metavar='GOAL_TARGET', help="The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED', or to 'MF' for Credit Card Payment categories and 'DEBT' for categories paired to a loan account. Must not be negative. When updating a category, passing null removes any existing target. Passing 0 does too, except for a Credit Card Payment category's 'TBD' (Pay Off Balance by Date) target, where 0 is a valid amount because the card's balance sets it. Use null to remove that target.")
311
+ c.add_argument('--goal-target-date', dest='p_goal_target_date', metavar='YYYY-MM-DD', help="The goal target date in ISO format (e.g. 2016-12-01). Not supported for categories paired to a loan account. When combined with a goal_frequency of 'monthly' or 'yearly', this is the date the recurring target is next due. Required for yearly targets, so it cannot be removed from one.")
312
+ c.add_argument('--goal-needs-whole-amount', dest='p_goal_needs_whole_amount', action=argparse.BooleanOptionalAction, help="Whether the goal requires the full target amount each period. Only supported for 'NEED' goals, and not supported for Credit Card Payment categories or categories paired to a loan account. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'.")
313
+ c.add_argument('--goal-frequency', dest='p_goal_frequency', choices=['monthly', 'weekly', 'yearly'], help="When specified, configures a recurring 'NEED' target of goal_target that repeats at this frequency, replacing any existing target. Requires goal_target. 'yearly' also requires goal_target_date, the date the target is next due. 'monthly' accepts an optional goal_target_date, and 'weekly' cannot be combined with goal_target_date. Not supported for Credit Card Payment categories or categories paired to a loan account. Omit to leave an existing target's cadence unchanged.")
314
+ c.set_defaults(handler=_run_categories_create, flags={'plan_id': '--plan-id', 'body.category.name': '--name', 'body.category.note': '--note', 'body.category.category_group_id': '--category-group-id', 'body.category.goal_target': '--goal-target', 'body.category.goal_target_date': '--goal-target-date', 'body.category.goal_needs_whole_amount': '--goal-needs-whole-amount', 'body.category.goal_frequency': '--goal-frequency'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'create_category'})
315
+ c = g_categories_commands.add_parser('get', parents=[common], help='Get a category', description='Returns a single category. Amounts (assigned, activity, available, etc.) are\nspecific to the current plan month (UTC).', usage='%(prog)s CATEGORY_ID [options]', epilog=RUNTIME.command_epilog(['ynab categories get CATEGORY_ID']), formatter_class=RAW)
316
+ c.add_argument('p_category_id', metavar='CATEGORY_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the category')
317
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
318
+ c.add_argument('--category-id', dest='p_category_id', default=argparse.SUPPRESS, metavar='CATEGORY_ID', help='same as CATEGORY_ID')
319
+ c.set_defaults(handler=_run_categories_get, flags={'plan_id': '--plan-id', 'category_id': '--category-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_category_by_id'})
320
+ c = g_categories_commands.add_parser('update', parents=[common], help='Update a category', description='Update a category', usage='%(prog)s CATEGORY_ID [options]', epilog=RUNTIME.command_epilog(['ynab categories update CATEGORY_ID', 'ynab categories update CATEGORY_ID --dry-run']), formatter_class=RAW)
321
+ c.add_argument('p_category_id', metavar='CATEGORY_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the category')
322
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
323
+ c.add_argument('--category-id', dest='p_category_id', default=argparse.SUPPRESS, metavar='CATEGORY_ID', help='same as CATEGORY_ID')
324
+ c.add_argument('--name', dest='p_name', metavar='NAME')
325
+ c.add_argument('--note', dest='p_note', metavar='NOTE')
326
+ c.add_argument('--category-group-id', dest='p_category_group_id', metavar='CATEGORY_GROUP_ID', help='The id of the category group to which this category belongs. An internal category group may not be specified.')
327
+ c.add_argument('--goal-target', dest='p_goal_target', type=integer, metavar='GOAL_TARGET', help="The goal target amount in milliunits format. If value is specified and goal has not already been configured for category, a monthly goal will be created for the category with this target amount. If goal_type is not specified, it will default to 'NEED', or to 'MF' for Credit Card Payment categories and 'DEBT' for categories paired to a loan account. Must not be negative. When updating a category, passing null removes any existing target. Passing 0 does too, except for a Credit Card Payment category's 'TBD' (Pay Off Balance by Date) target, where 0 is a valid amount because the card's balance sets it. Use null to remove that target.")
328
+ c.add_argument('--goal-target-date', dest='p_goal_target_date', metavar='YYYY-MM-DD', help="The goal target date in ISO format (e.g. 2016-12-01). Not supported for categories paired to a loan account. When combined with a goal_frequency of 'monthly' or 'yearly', this is the date the recurring target is next due. Required for yearly targets, so it cannot be removed from one.")
329
+ c.add_argument('--goal-needs-whole-amount', dest='p_goal_needs_whole_amount', action=argparse.BooleanOptionalAction, help="Whether the goal requires the full target amount each period. Only supported for 'NEED' goals, and not supported for Credit Card Payment categories or categories paired to a loan account. When true, the goal is configured as 'Set aside another...'. When false, the goal is configured as 'Refill up to...'.")
330
+ c.add_argument('--goal-frequency', dest='p_goal_frequency', choices=['monthly', 'weekly', 'yearly'], help="When specified, configures a recurring 'NEED' target of goal_target that repeats at this frequency, replacing any existing target. Requires goal_target. 'yearly' also requires goal_target_date, the date the target is next due. 'monthly' accepts an optional goal_target_date, and 'weekly' cannot be combined with goal_target_date. Not supported for Credit Card Payment categories or categories paired to a loan account. Omit to leave an existing target's cadence unchanged.")
331
+ c.set_defaults(handler=_run_categories_update, flags={'plan_id': '--plan-id', 'category_id': '--category-id', 'body.category.name': '--name', 'body.category.note': '--note', 'body.category.category_group_id': '--category-group-id', 'body.category.goal_target': '--goal-target', 'body.category.goal_target_date': '--goal-target-date', 'body.category.goal_needs_whole_amount': '--goal-needs-whole-amount', 'body.category.goal_frequency': '--goal-frequency'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'update_category', 'requires_one_of': [['--name', '--note', '--category-group-id', '--goal-target', '--goal-target-date', '--goal-needs-whole-amount', '--goal-frequency']]})
332
+ c = g_categories_commands.add_parser('get-month', parents=[common], help='Get a category for a specific plan month', description='Returns a single category for a specific plan month. Amounts (assigned,\nactivity, available, etc.) are specific to the current plan month (UTC).', usage='%(prog)s YYYY-MM-DD CATEGORY_ID [options]', epilog=RUNTIME.command_epilog(['ynab categories get-month YYYY-MM-DD CATEGORY_ID']), formatter_class=RAW)
333
+ c.add_argument('p_month', metavar='YYYY-MM-DD', nargs='?', default=argparse.SUPPRESS, help='The plan month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC))')
334
+ c.add_argument('p_category_id', metavar='CATEGORY_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the category')
335
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
336
+ c.add_argument('--month', dest='p_month', default=argparse.SUPPRESS, metavar='YYYY-MM-DD', help='same as YYYY-MM-DD')
337
+ c.add_argument('--category-id', dest='p_category_id', default=argparse.SUPPRESS, metavar='CATEGORY_ID', help='same as CATEGORY_ID')
338
+ c.set_defaults(handler=_run_categories_get_month, flags={'plan_id': '--plan-id', 'month': '--month', 'category_id': '--category-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_month_category_by_id'})
339
+ c = g_categories_commands.add_parser('update-month', parents=[common], help='Update a category for a specific month', description='Update a category for a specific month. Only `budgeted` (assigned) amount can\nbe updated.', usage='%(prog)s YYYY-MM-DD CATEGORY_ID --budgeted BUDGETED [options]', epilog=RUNTIME.command_epilog(['ynab categories update-month YYYY-MM-DD CATEGORY_ID --budgeted BUDGETED', 'ynab categories update-month YYYY-MM-DD CATEGORY_ID --budgeted BUDGETED --dry-run']), formatter_class=RAW)
340
+ c.add_argument('p_month', metavar='YYYY-MM-DD', nargs='?', default=argparse.SUPPRESS, help='The plan month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC))')
341
+ c.add_argument('p_category_id', metavar='CATEGORY_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the category')
342
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
343
+ c.add_argument('--month', dest='p_month', default=argparse.SUPPRESS, metavar='YYYY-MM-DD', help='same as YYYY-MM-DD')
344
+ c.add_argument('--category-id', dest='p_category_id', default=argparse.SUPPRESS, metavar='CATEGORY_ID', help='same as CATEGORY_ID')
345
+ c.add_argument('--budgeted', dest='p_budgeted', type=integer, metavar='BUDGETED', required=True, help='Assigned (budgeted) amount in milliunits format')
346
+ c.set_defaults(handler=_run_categories_update_month, flags={'plan_id': '--plan-id', 'month': '--month', 'category_id': '--category-id', 'body.category.budgeted': '--budgeted'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'update_month_category'})
347
+ c = g_categories_commands.add_parser('create-group', parents=[common], help='Create a category group', description='Creates a new category group', usage='%(prog)s --name NAME [options]', epilog=RUNTIME.command_epilog(['ynab categories create-group --name NAME', 'ynab categories create-group --name NAME --dry-run']), formatter_class=RAW)
348
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan ("last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan) (default: last-used)')
349
+ c.add_argument('--name', dest='p_name', metavar='NAME', required=True, help='The name of the category group. The name must be a maximum of 50 characters.')
350
+ c.set_defaults(handler=_run_categories_create_group, flags={'plan_id': '--plan-id', 'body.category_group.name': '--name'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'create_category_group'})
351
+ c = g_categories_commands.add_parser('update-group', parents=[common], help='Update a category group', description='Update a category group', usage='%(prog)s CATEGORY_GROUP_ID --name NAME [options]', epilog=RUNTIME.command_epilog(['ynab categories update-group CATEGORY_GROUP_ID --name NAME', 'ynab categories update-group CATEGORY_GROUP_ID --name NAME --dry-run']), formatter_class=RAW)
352
+ c.add_argument('p_category_group_id', metavar='CATEGORY_GROUP_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the category group')
353
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
354
+ c.add_argument('--category-group-id', dest='p_category_group_id', default=argparse.SUPPRESS, metavar='CATEGORY_GROUP_ID', help='same as CATEGORY_GROUP_ID')
355
+ c.add_argument('--name', dest='p_name', metavar='NAME', required=True, help='The name of the category group. The name must be a maximum of 50 characters.')
356
+ c.set_defaults(handler=_run_categories_update_group, flags={'plan_id': '--plan-id', 'category_group_id': '--category-group-id', 'body.category_group.name': '--name'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'update_category_group'})
357
+ g_money_movements = commands.add_parser('money-movements', help='list, list-by-month, list-groups, list-groups-by-month', description="Run 'ynab money-movements COMMAND --help' for a command's options and examples.")
358
+ g_money_movements_commands = g_money_movements.add_subparsers(dest="g_money_movements", metavar="COMMAND", required=True)
359
+ c = g_money_movements_commands.add_parser('list', parents=[common], help='Get all money movements', description='Returns all money movements', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab money-movements list']), formatter_class=RAW)
360
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
361
+ c.set_defaults(handler=_run_money_movements_list, flags={'plan_id': '--plan-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_money_movements'})
362
+ c = g_money_movements_commands.add_parser('list-by-month', parents=[common], help='Get money movements for a plan month', description='Returns all money movements for a specific month', usage='%(prog)s YYYY-MM-DD [options]', epilog=RUNTIME.command_epilog(['ynab money-movements list-by-month YYYY-MM-DD']), formatter_class=RAW)
363
+ c.add_argument('p_month', metavar='YYYY-MM-DD', nargs='?', default=argparse.SUPPRESS, help='The plan month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC))')
364
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
365
+ c.add_argument('--month', dest='p_month', default=argparse.SUPPRESS, metavar='YYYY-MM-DD', help='same as YYYY-MM-DD')
366
+ c.set_defaults(handler=_run_money_movements_list_by_month, flags={'plan_id': '--plan-id', 'month': '--month'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_money_movements_by_month'})
367
+ c = g_money_movements_commands.add_parser('list-groups', parents=[common], help='Get all money movement groups', description='Returns all money movement groups', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab money-movements list-groups']), formatter_class=RAW)
368
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
369
+ c.set_defaults(handler=_run_money_movements_list_groups, flags={'plan_id': '--plan-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_money_movement_groups'})
370
+ c = g_money_movements_commands.add_parser('list-groups-by-month', parents=[common], help='Get money movement groups for a plan month', description='Returns all money movement groups for a specific month', usage='%(prog)s YYYY-MM-DD [options]', epilog=RUNTIME.command_epilog(['ynab money-movements list-groups-by-month YYYY-MM-DD']), formatter_class=RAW)
371
+ c.add_argument('p_month', metavar='YYYY-MM-DD', nargs='?', default=argparse.SUPPRESS, help='The plan month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC))')
372
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
373
+ c.add_argument('--month', dest='p_month', default=argparse.SUPPRESS, metavar='YYYY-MM-DD', help='same as YYYY-MM-DD')
374
+ c.set_defaults(handler=_run_money_movements_list_groups_by_month, flags={'plan_id': '--plan-id', 'month': '--month'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_money_movement_groups_by_month'})
375
+ g_months = commands.add_parser('months', help='get, list', description="Run 'ynab months COMMAND --help' for a command's options and examples.")
376
+ g_months_commands = g_months.add_subparsers(dest="g_months", metavar="COMMAND", required=True)
377
+ c = g_months_commands.add_parser('list', parents=[common], help='Get all plan months', description='Returns all plan months', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab months list']), formatter_class=RAW)
378
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
379
+ c.add_argument('--last-knowledge-of-server', dest='p_last_knowledge_of_server', type=integer, metavar='LAST_KNOWLEDGE_OF_SERVER', help='The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.')
380
+ c.set_defaults(handler=_run_months_list, flags={'plan_id': '--plan-id', 'last_knowledge_of_server': '--last-knowledge-of-server'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_plan_months'})
381
+ c = g_months_commands.add_parser('get', parents=[common], help='Get a plan month', description='Returns a single plan month', usage='%(prog)s YYYY-MM-DD [options]', epilog=RUNTIME.command_epilog(['ynab months get YYYY-MM-DD']), formatter_class=RAW)
382
+ c.add_argument('p_month', metavar='YYYY-MM-DD', nargs='?', default=argparse.SUPPRESS, help='The plan month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC))')
383
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
384
+ c.add_argument('--month', dest='p_month', default=argparse.SUPPRESS, metavar='YYYY-MM-DD', help='same as YYYY-MM-DD')
385
+ c.set_defaults(handler=_run_months_get, flags={'plan_id': '--plan-id', 'month': '--month'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_plan_month'})
386
+ g_payee_locations = commands.add_parser('payee-locations', help='get, list, list-by-payee', description="Run 'ynab payee-locations COMMAND --help' for a command's options and examples.")
387
+ g_payee_locations_commands = g_payee_locations.add_subparsers(dest="g_payee_locations", metavar="COMMAND", required=True)
388
+ c = g_payee_locations_commands.add_parser('list', parents=[common], help='Get all payee locations', description='Returns all payee locations', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab payee-locations list']), formatter_class=RAW)
389
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
390
+ c.set_defaults(handler=_run_payee_locations_list, flags={'plan_id': '--plan-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_payee_locations'})
391
+ c = g_payee_locations_commands.add_parser('get', parents=[common], help='Get a payee location', description='Returns a single payee location', usage='%(prog)s PAYEE_LOCATION_ID [options]', epilog=RUNTIME.command_epilog(['ynab payee-locations get PAYEE_LOCATION_ID']), formatter_class=RAW)
392
+ c.add_argument('p_payee_location_id', metavar='PAYEE_LOCATION_ID', nargs='?', default=argparse.SUPPRESS, help='id of payee location')
393
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
394
+ c.add_argument('--payee-location-id', dest='p_payee_location_id', default=argparse.SUPPRESS, metavar='PAYEE_LOCATION_ID', help='same as PAYEE_LOCATION_ID')
395
+ c.set_defaults(handler=_run_payee_locations_get, flags={'plan_id': '--plan-id', 'payee_location_id': '--payee-location-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_payee_location_by_id'})
396
+ c = g_payee_locations_commands.add_parser('list-by-payee', parents=[common], help='Get all locations for a payee', description='Returns all payee locations for a specified payee', usage='%(prog)s PAYEE_ID [options]', epilog=RUNTIME.command_epilog(['ynab payee-locations list-by-payee PAYEE_ID']), formatter_class=RAW)
397
+ c.add_argument('p_payee_id', metavar='PAYEE_ID', nargs='?', default=argparse.SUPPRESS, help='id of payee')
398
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
399
+ c.add_argument('--payee-id', dest='p_payee_id', default=argparse.SUPPRESS, metavar='PAYEE_ID', help='same as PAYEE_ID')
400
+ c.set_defaults(handler=_run_payee_locations_list_by_payee, flags={'plan_id': '--plan-id', 'payee_id': '--payee-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_payee_locations_by_payee'})
401
+ g_payees = commands.add_parser('payees', help='create, get, list, update', description="Run 'ynab payees COMMAND --help' for a command's options and examples.")
402
+ g_payees_commands = g_payees.add_subparsers(dest="g_payees", metavar="COMMAND", required=True)
403
+ c = g_payees_commands.add_parser('list', parents=[common], help='Get all payees', description='Returns all payees', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab payees list']), formatter_class=RAW)
404
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
405
+ c.add_argument('--last-knowledge-of-server', dest='p_last_knowledge_of_server', type=integer, metavar='LAST_KNOWLEDGE_OF_SERVER', help='The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.')
406
+ c.set_defaults(handler=_run_payees_list, flags={'plan_id': '--plan-id', 'last_knowledge_of_server': '--last-knowledge-of-server'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_payees'})
407
+ c = g_payees_commands.add_parser('create', parents=[common], help='Create a payee', description='Creates a new payee', usage='%(prog)s --name NAME [options]', epilog=RUNTIME.command_epilog(['ynab payees create --name NAME', 'ynab payees create --name NAME --dry-run']), formatter_class=RAW)
408
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
409
+ c.add_argument('--name', dest='p_name', metavar='NAME', required=True, help='The name of the payee.')
410
+ c.set_defaults(handler=_run_payees_create, flags={'plan_id': '--plan-id', 'body.payee.name': '--name'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'create_payee'})
411
+ c = g_payees_commands.add_parser('get', parents=[common], help='Get a payee', description='Returns a single payee', usage='%(prog)s PAYEE_ID [options]', epilog=RUNTIME.command_epilog(['ynab payees get PAYEE_ID']), formatter_class=RAW)
412
+ c.add_argument('p_payee_id', metavar='PAYEE_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the payee')
413
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
414
+ c.add_argument('--payee-id', dest='p_payee_id', default=argparse.SUPPRESS, metavar='PAYEE_ID', help='same as PAYEE_ID')
415
+ c.set_defaults(handler=_run_payees_get, flags={'plan_id': '--plan-id', 'payee_id': '--payee-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_payee_by_id'})
416
+ c = g_payees_commands.add_parser('update', parents=[common], help='Update a payee', description='Update a payee', usage='%(prog)s PAYEE_ID [options]', epilog=RUNTIME.command_epilog(['ynab payees update PAYEE_ID', 'ynab payees update PAYEE_ID --dry-run']), formatter_class=RAW)
417
+ c.add_argument('p_payee_id', metavar='PAYEE_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the payee')
418
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
419
+ c.add_argument('--payee-id', dest='p_payee_id', default=argparse.SUPPRESS, metavar='PAYEE_ID', help='same as PAYEE_ID')
420
+ c.add_argument('--name', dest='p_name', metavar='NAME', help='The name of the payee.')
421
+ c.set_defaults(handler=_run_payees_update, flags={'plan_id': '--plan-id', 'payee_id': '--payee-id', 'body.payee.name': '--name'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'update_payee', 'requires_one_of': [['--name']]})
422
+ g_plans = commands.add_parser('plans', help='get, get-settings, list', description="Run 'ynab plans COMMAND --help' for a command's options and examples.")
423
+ g_plans_commands = g_plans.add_subparsers(dest="g_plans", metavar="COMMAND", required=True)
424
+ c = g_plans_commands.add_parser('list', parents=[common], help='Get all plans', description='Returns plans list with summary information', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab plans list']), formatter_class=RAW)
425
+ c.add_argument('--include-accounts', dest='p_include_accounts', action=argparse.BooleanOptionalAction, help='Whether to include the list of plan accounts')
426
+ c.set_defaults(handler=_run_plans_list, flags={'include_accounts': '--include-accounts'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_plans'})
427
+ c = g_plans_commands.add_parser('get', parents=[common], help='Get a plan', description='Returns a single plan with all related entities. This resource is effectively\na full plan export.', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab plans get']), formatter_class=RAW)
428
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
429
+ c.add_argument('--last-knowledge-of-server', dest='p_last_knowledge_of_server', type=integer, metavar='LAST_KNOWLEDGE_OF_SERVER', help='The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.')
430
+ c.set_defaults(handler=_run_plans_get, flags={'plan_id': '--plan-id', 'last_knowledge_of_server': '--last-knowledge-of-server'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_plan_by_id'})
431
+ c = g_plans_commands.add_parser('get-settings', parents=[common], help='Get plan settings', description='Returns settings for a plan', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab plans get-settings']), formatter_class=RAW)
432
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
433
+ c.set_defaults(handler=_run_plans_get_settings, flags={'plan_id': '--plan-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_plan_settings_by_id'})
434
+ g_scheduled_transactions = commands.add_parser('scheduled-transactions', help='create, delete, get, … (5 commands)', description="Run 'ynab scheduled-transactions COMMAND --help' for a command's options and examples.")
435
+ g_scheduled_transactions_commands = g_scheduled_transactions.add_subparsers(dest="g_scheduled_transactions", metavar="COMMAND", required=True)
436
+ c = g_scheduled_transactions_commands.add_parser('list', parents=[common], help='Get all scheduled transactions', description='Returns all scheduled transactions', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab scheduled-transactions list']), formatter_class=RAW)
437
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
438
+ c.add_argument('--last-knowledge-of-server', dest='p_last_knowledge_of_server', type=integer, metavar='LAST_KNOWLEDGE_OF_SERVER', help='The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.')
439
+ c.set_defaults(handler=_run_scheduled_transactions_list, flags={'plan_id': '--plan-id', 'last_knowledge_of_server': '--last-knowledge-of-server'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_scheduled_transactions'})
440
+ c = g_scheduled_transactions_commands.add_parser('create', parents=[common], help='Create a scheduled transaction', description='Creates a single scheduled transaction (a transaction with a future date).', usage='%(prog)s --account-id ACCOUNT_ID --date YYYY-MM-DD [options]', epilog=RUNTIME.command_epilog(['ynab scheduled-transactions create --account-id ACCOUNT_ID --date YYYY-MM-DD', 'ynab scheduled-transactions create --account-id ACCOUNT_ID --date YYYY-MM-DD --dry-run']), formatter_class=RAW)
441
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
442
+ c.add_argument('--account-id', dest='p_account_id', metavar='ACCOUNT_ID', required=True)
443
+ c.add_argument('--date', dest='p_date', metavar='YYYY-MM-DD', required=True, help='The scheduled transaction date in ISO format (e.g. 2016-12-01). This should be a future date no more than 5 years into the future.')
444
+ c.add_argument('--amount', dest='p_amount', type=integer, metavar='AMOUNT', help='The scheduled transaction amount in milliunits format.')
445
+ c.add_argument('--payee-id', dest='p_payee_id', metavar='PAYEE_ID', help='The payee for the scheduled transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `transfer_payee_id` on the account resource.')
446
+ c.add_argument('--payee-name', dest='p_payee_name', metavar='PAYEE_NAME', help='The payee name for the the scheduled transaction. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a payee with the same name or (2) creation of a new payee.')
447
+ c.add_argument('--category-id', dest='p_category_id', metavar='CATEGORY_ID', help='The category for the scheduled transaction. Credit Card Payment categories are not permitted. Creating a split scheduled transaction is not currently supported.')
448
+ c.add_argument('--memo', dest='p_memo', metavar='MEMO')
449
+ c.add_argument('--flag-color', dest='p_flag_color', choices=['red', 'orange', 'yellow', 'green', 'blue', 'purple', ''])
450
+ c.add_argument('--frequency', dest='p_frequency', choices=['never', 'daily', 'weekly', 'everyOtherWeek', 'twiceAMonth', 'every4Weeks', 'monthly', 'everyOtherMonth', 'every3Months', 'every4Months', 'twiceAYear', 'yearly', 'everyOtherYear'])
451
+ c.set_defaults(handler=_run_scheduled_transactions_create, flags={'plan_id': '--plan-id', 'body.scheduled_transaction.account_id': '--account-id', 'body.scheduled_transaction.date': '--date', 'body.scheduled_transaction.amount': '--amount', 'body.scheduled_transaction.payee_id': '--payee-id', 'body.scheduled_transaction.payee_name': '--payee-name', 'body.scheduled_transaction.category_id': '--category-id', 'body.scheduled_transaction.memo': '--memo', 'body.scheduled_transaction.flag_color': '--flag-color', 'body.scheduled_transaction.frequency': '--frequency'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'create_scheduled_transaction'})
452
+ c = g_scheduled_transactions_commands.add_parser('get', parents=[common], help='Get a scheduled transaction', description='Returns a single scheduled transaction', usage='%(prog)s SCHEDULED_TRANSACTION_ID [options]', epilog=RUNTIME.command_epilog(['ynab scheduled-transactions get SCHEDULED_TRANSACTION_ID']), formatter_class=RAW)
453
+ c.add_argument('p_scheduled_transaction_id', metavar='SCHEDULED_TRANSACTION_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the scheduled transaction')
454
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
455
+ c.add_argument('--scheduled-transaction-id', dest='p_scheduled_transaction_id', default=argparse.SUPPRESS, metavar='SCHEDULED_TRANSACTION_ID', help='same as SCHEDULED_TRANSACTION_ID')
456
+ c.set_defaults(handler=_run_scheduled_transactions_get, flags={'plan_id': '--plan-id', 'scheduled_transaction_id': '--scheduled-transaction-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_scheduled_transaction_by_id'})
457
+ c = g_scheduled_transactions_commands.add_parser('update', parents=[common], help='Update a scheduled transaction', description='Updates a single scheduled transaction', usage='%(prog)s SCHEDULED_TRANSACTION_ID --account-id ACCOUNT_ID --date YYYY-MM-DD [options]', epilog=RUNTIME.command_epilog(['ynab scheduled-transactions update SCHEDULED_TRANSACTION_ID --account-id ACCOUNT_ID --date YYYY-MM-DD', 'ynab scheduled-transactions update SCHEDULED_TRANSACTION_ID --account-id ACCOUNT_ID --date YYYY-MM-DD --dry-run']), formatter_class=RAW)
458
+ c.add_argument('p_scheduled_transaction_id', metavar='SCHEDULED_TRANSACTION_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the scheduled transaction')
459
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
460
+ c.add_argument('--scheduled-transaction-id', dest='p_scheduled_transaction_id', default=argparse.SUPPRESS, metavar='SCHEDULED_TRANSACTION_ID', help='same as SCHEDULED_TRANSACTION_ID')
461
+ c.add_argument('--account-id', dest='p_account_id', metavar='ACCOUNT_ID', required=True)
462
+ c.add_argument('--date', dest='p_date', metavar='YYYY-MM-DD', required=True, help='The scheduled transaction date in ISO format (e.g. 2016-12-01). This should be a future date no more than 5 years into the future.')
463
+ c.add_argument('--amount', dest='p_amount', type=integer, metavar='AMOUNT', help='The scheduled transaction amount in milliunits format.')
464
+ c.add_argument('--payee-id', dest='p_payee_id', metavar='PAYEE_ID', help='The payee for the scheduled transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `transfer_payee_id` on the account resource.')
465
+ c.add_argument('--payee-name', dest='p_payee_name', metavar='PAYEE_NAME', help='The payee name for the the scheduled transaction. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a payee with the same name or (2) creation of a new payee.')
466
+ c.add_argument('--category-id', dest='p_category_id', metavar='CATEGORY_ID', help='The category for the scheduled transaction. Credit Card Payment categories are not permitted. Creating a split scheduled transaction is not currently supported.')
467
+ c.add_argument('--memo', dest='p_memo', metavar='MEMO')
468
+ c.add_argument('--flag-color', dest='p_flag_color', choices=['red', 'orange', 'yellow', 'green', 'blue', 'purple', ''])
469
+ c.add_argument('--frequency', dest='p_frequency', choices=['never', 'daily', 'weekly', 'everyOtherWeek', 'twiceAMonth', 'every4Weeks', 'monthly', 'everyOtherMonth', 'every3Months', 'every4Months', 'twiceAYear', 'yearly', 'everyOtherYear'])
470
+ c.set_defaults(handler=_run_scheduled_transactions_update, flags={'plan_id': '--plan-id', 'scheduled_transaction_id': '--scheduled-transaction-id', 'body.scheduled_transaction.account_id': '--account-id', 'body.scheduled_transaction.date': '--date', 'body.scheduled_transaction.amount': '--amount', 'body.scheduled_transaction.payee_id': '--payee-id', 'body.scheduled_transaction.payee_name': '--payee-name', 'body.scheduled_transaction.category_id': '--category-id', 'body.scheduled_transaction.memo': '--memo', 'body.scheduled_transaction.flag_color': '--flag-color', 'body.scheduled_transaction.frequency': '--frequency'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'update_scheduled_transaction'})
471
+ c = g_scheduled_transactions_commands.add_parser('delete', parents=[common], help='Delete a scheduled transaction', description='Deletes a scheduled transaction', usage='%(prog)s SCHEDULED_TRANSACTION_ID [options]', epilog=RUNTIME.command_epilog(['ynab scheduled-transactions delete SCHEDULED_TRANSACTION_ID --dry-run', 'ynab scheduled-transactions delete SCHEDULED_TRANSACTION_ID --yes']), formatter_class=RAW)
472
+ c.add_argument('p_scheduled_transaction_id', metavar='SCHEDULED_TRANSACTION_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the scheduled transaction')
473
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
474
+ c.add_argument('--scheduled-transaction-id', dest='p_scheduled_transaction_id', default=argparse.SUPPRESS, metavar='SCHEDULED_TRANSACTION_ID', help='same as SCHEDULED_TRANSACTION_ID')
475
+ RUNTIME.add_confirm_option(c)
476
+ c.set_defaults(handler=_run_scheduled_transactions_delete, flags={'plan_id': '--plan-id', 'scheduled_transaction_id': '--scheduled-transaction-id'}, meta={'read_only': False, 'destructive': True, 'paginated': False, 'deprecated': False, 'operation': 'delete_scheduled_transaction'})
477
+ g_transactions = commands.add_parser('transactions', help='create, delete, get, … (11 commands)', description="Run 'ynab transactions COMMAND --help' for a command's options and examples.")
478
+ g_transactions_commands = g_transactions.add_subparsers(dest="g_transactions", metavar="COMMAND", required=True)
479
+ c = g_transactions_commands.add_parser('list', parents=[common], help='Get transactions', description='Returns plan transactions, excluding any pending transactions', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab transactions list']), formatter_class=RAW)
480
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
481
+ c.add_argument('--since-date', dest='p_since_date', metavar='YYYY-MM-DD', help='If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.')
482
+ c.add_argument('--until-date', dest='p_until_date', metavar='YYYY-MM-DD', help='If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).')
483
+ c.add_argument('--type', dest='p_type', choices=['uncategorized', 'unapproved'], help='If specified, only transactions of the specified type will be included. "uncategorized" and "unapproved" are currently supported.')
484
+ c.add_argument('--last-knowledge-of-server', dest='p_last_knowledge_of_server', type=integer, metavar='LAST_KNOWLEDGE_OF_SERVER', help='The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.')
485
+ c.set_defaults(handler=_run_transactions_list, flags={'plan_id': '--plan-id', 'since_date': '--since-date', 'until_date': '--until-date', 'type': '--type', 'last_knowledge_of_server': '--last-knowledge-of-server'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_transactions'})
486
+ c = g_transactions_commands.add_parser('create', parents=[common], help='Create a single transaction or multiple transactions', description='Creates a single transaction or multiple transactions. If you provide a body\ncontaining a `transaction` object, a single transaction will be created and if\nyou provide a body containing a `transactions` array, multiple transactions\nwill be created. Scheduled transactions (transactions with a future date)\ncannot be created on this endpoint.', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab transactions create', 'ynab transactions create --dry-run']), formatter_class=RAW)
487
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
488
+ c.add_argument('--transaction', dest='p_transaction', type=json_value, metavar="JSON")
489
+ c.add_argument('--transactions', dest='p_transactions', type=json_value, metavar="JSON")
490
+ c.set_defaults(handler=_run_transactions_create, flags={'plan_id': '--plan-id', 'body.transaction': '--transaction', 'body.transactions': '--transactions'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'create_transaction', 'requires_one_of': [['--transaction', '--transactions']]})
491
+ c = g_transactions_commands.add_parser('update-many', parents=[common], help='Update multiple transactions', description='Updates multiple transactions, by `id` or `import_id`.', usage='%(prog)s --transactions @transactions.json [options]', epilog=RUNTIME.command_epilog(['ynab transactions update-many --transactions @transactions.json', 'ynab transactions update-many --transactions @transactions.json --dry-run']), formatter_class=RAW)
492
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
493
+ c.add_argument('--transactions', dest='p_transactions', type=json_value, metavar="JSON", required=True)
494
+ c.set_defaults(handler=_run_transactions_update_many, flags={'plan_id': '--plan-id', 'body.transactions': '--transactions'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'update_transactions'})
495
+ c = g_transactions_commands.add_parser('import', parents=[common], help='[deprecated] Import transactions', description='DEPRECATED: This endpoint is no longer needed because YNAB now automatically\nimports transactions on linked accounts. Requests are still accepted for\nbackwards compatibility but no import is performed and the response will\nalways contain an empty list of transaction ids.', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab transactions import', 'ynab transactions import --dry-run']), formatter_class=RAW)
496
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
497
+ c.set_defaults(handler=_run_transactions_import, flags={'plan_id': '--plan-id'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': True, 'operation': 'import_transactions'})
498
+ c = g_transactions_commands.add_parser('get', parents=[common], help='Get a transaction', description='Returns a single transaction', usage='%(prog)s TRANSACTION_ID [options]', epilog=RUNTIME.command_epilog(['ynab transactions get TRANSACTION_ID']), formatter_class=RAW)
499
+ c.add_argument('p_transaction_id', metavar='TRANSACTION_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the transaction')
500
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
501
+ c.add_argument('--transaction-id', dest='p_transaction_id', default=argparse.SUPPRESS, metavar='TRANSACTION_ID', help='same as TRANSACTION_ID')
502
+ c.set_defaults(handler=_run_transactions_get, flags={'plan_id': '--plan-id', 'transaction_id': '--transaction-id'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_transaction_by_id'})
503
+ c = g_transactions_commands.add_parser('update', parents=[common], help='Update a transaction', description='Updates a single transaction', usage='%(prog)s TRANSACTION_ID [options]', epilog=RUNTIME.command_epilog(['ynab transactions update TRANSACTION_ID', 'ynab transactions update TRANSACTION_ID --dry-run']), formatter_class=RAW)
504
+ c.add_argument('p_transaction_id', metavar='TRANSACTION_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the transaction')
505
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
506
+ c.add_argument('--transaction-id', dest='p_transaction_id', default=argparse.SUPPRESS, metavar='TRANSACTION_ID', help='same as TRANSACTION_ID')
507
+ c.add_argument('--account-id', dest='p_account_id', metavar='ACCOUNT_ID')
508
+ c.add_argument('--date', dest='p_date', metavar='YYYY-MM-DD', help='The transaction date in ISO format (e.g. 2016-12-01). Future dates (scheduled transactions) are not permitted. Split transaction dates cannot be changed and if a different date is supplied it will be ignored.')
509
+ c.add_argument('--amount', dest='p_amount', type=integer, metavar='AMOUNT', help='The transaction amount in milliunits format. Split transaction amounts cannot be changed and if a different amount is supplied it will be ignored.')
510
+ c.add_argument('--payee-id', dest='p_payee_id', metavar='PAYEE_ID', help='The payee for the transaction. To create a transfer between two accounts, use the account transfer payee pointing to the target account. Account transfer payees are specified as `transfer_payee_id` on the account resource.')
511
+ c.add_argument('--payee-name', dest='p_payee_name', metavar='PAYEE_NAME', help='The payee name. If a `payee_name` value is provided and `payee_id` has a null value, the `payee_name` value will be used to resolve the payee by either (1) a matching payee rename rule (only if `import_id` is also specified) or (2) a payee with the same name or (3) creation of a new payee.')
512
+ c.add_argument('--category-id', dest='p_category_id', metavar='CATEGORY_ID', help='The category for the transaction. To configure a split transaction, you can specify null for `category_id` and provide a `subtransactions` array as part of the transaction object. If an existing transaction is a split, the `category_id` cannot be changed. Credit Card Payment categories are not permitted and will be ignored if supplied.')
513
+ c.add_argument('--memo', dest='p_memo', metavar='MEMO')
514
+ c.add_argument('--cleared', dest='p_cleared', choices=['cleared', 'uncleared', 'reconciled'])
515
+ c.add_argument('--approved', dest='p_approved', action=argparse.BooleanOptionalAction, help='Whether or not the transaction is approved. If not supplied, transaction will be unapproved by default.')
516
+ c.add_argument('--flag-color', dest='p_flag_color', choices=['red', 'orange', 'yellow', 'green', 'blue', 'purple', ''])
517
+ c.add_argument('--subtransactions', dest='p_subtransactions', type=json_value, metavar="JSON", help='An array of subtransactions to configure a transaction as a split. Updating `subtransactions` on an existing split transaction is not supported and will return an error. Splits are not allowed on tracking accounts or on transfers between on-budget accounts; a transfer to a tracking account can be a split.')
518
+ c.set_defaults(handler=_run_transactions_update, flags={'plan_id': '--plan-id', 'transaction_id': '--transaction-id', 'body.transaction.account_id': '--account-id', 'body.transaction.date': '--date', 'body.transaction.amount': '--amount', 'body.transaction.payee_id': '--payee-id', 'body.transaction.payee_name': '--payee-name', 'body.transaction.category_id': '--category-id', 'body.transaction.memo': '--memo', 'body.transaction.cleared': '--cleared', 'body.transaction.approved': '--approved', 'body.transaction.flag_color': '--flag-color', 'body.transaction.subtransactions': '--subtransactions'}, meta={'read_only': False, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'update_transaction', 'requires_one_of': [['--account-id', '--date', '--amount', '--payee-id', '--payee-name', '--category-id', '--memo', '--cleared', '--approved', '--flag-color', '--subtransactions']]})
519
+ c = g_transactions_commands.add_parser('delete', parents=[common], help='Delete a transaction', description='Deletes a transaction', usage='%(prog)s TRANSACTION_ID [options]', epilog=RUNTIME.command_epilog(['ynab transactions delete TRANSACTION_ID --dry-run', 'ynab transactions delete TRANSACTION_ID --yes']), formatter_class=RAW)
520
+ c.add_argument('p_transaction_id', metavar='TRANSACTION_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the transaction')
521
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
522
+ c.add_argument('--transaction-id', dest='p_transaction_id', default=argparse.SUPPRESS, metavar='TRANSACTION_ID', help='same as TRANSACTION_ID')
523
+ RUNTIME.add_confirm_option(c)
524
+ c.set_defaults(handler=_run_transactions_delete, flags={'plan_id': '--plan-id', 'transaction_id': '--transaction-id'}, meta={'read_only': False, 'destructive': True, 'paginated': False, 'deprecated': False, 'operation': 'delete_transaction'})
525
+ c = g_transactions_commands.add_parser('list-by-account', parents=[common], help='Get account transactions', description='Returns all transactions for a specified account, excluding any pending\ntransactions', usage='%(prog)s ACCOUNT_ID [options]', epilog=RUNTIME.command_epilog(['ynab transactions list-by-account ACCOUNT_ID']), formatter_class=RAW)
526
+ c.add_argument('p_account_id', metavar='ACCOUNT_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the account')
527
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
528
+ c.add_argument('--account-id', dest='p_account_id', default=argparse.SUPPRESS, metavar='ACCOUNT_ID', help='same as ACCOUNT_ID')
529
+ c.add_argument('--since-date', dest='p_since_date', metavar='YYYY-MM-DD', help='If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.')
530
+ c.add_argument('--until-date', dest='p_until_date', metavar='YYYY-MM-DD', help='If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).')
531
+ c.add_argument('--type', dest='p_type', choices=['uncategorized', 'unapproved'], help='If specified, only transactions of the specified type will be included. "uncategorized" and "unapproved" are currently supported.')
532
+ c.add_argument('--last-knowledge-of-server', dest='p_last_knowledge_of_server', type=integer, metavar='LAST_KNOWLEDGE_OF_SERVER', help='The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.')
533
+ c.set_defaults(handler=_run_transactions_list_by_account, flags={'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'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_transactions_by_account'})
534
+ c = g_transactions_commands.add_parser('list-by-category', parents=[common], help='Get category transactions', description='Returns all transactions for a specified category, excluding any pending\ntransactions', usage='%(prog)s CATEGORY_ID [options]', epilog=RUNTIME.command_epilog(['ynab transactions list-by-category CATEGORY_ID']), formatter_class=RAW)
535
+ c.add_argument('p_category_id', metavar='CATEGORY_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the category')
536
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
537
+ c.add_argument('--category-id', dest='p_category_id', default=argparse.SUPPRESS, metavar='CATEGORY_ID', help='same as CATEGORY_ID')
538
+ c.add_argument('--since-date', dest='p_since_date', metavar='YYYY-MM-DD', help='If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.')
539
+ c.add_argument('--until-date', dest='p_until_date', metavar='YYYY-MM-DD', help='If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).')
540
+ c.add_argument('--type', dest='p_type', choices=['uncategorized', 'unapproved'], help='If specified, only transactions of the specified type will be included. "uncategorized" and "unapproved" are currently supported.')
541
+ c.add_argument('--last-knowledge-of-server', dest='p_last_knowledge_of_server', type=integer, metavar='LAST_KNOWLEDGE_OF_SERVER', help='The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.')
542
+ c.set_defaults(handler=_run_transactions_list_by_category, flags={'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'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_transactions_by_category'})
543
+ c = g_transactions_commands.add_parser('list-by-payee', parents=[common], help='Get payee transactions', description='Returns all transactions for a specified payee, excluding any pending\ntransactions', usage='%(prog)s PAYEE_ID [options]', epilog=RUNTIME.command_epilog(['ynab transactions list-by-payee PAYEE_ID']), formatter_class=RAW)
544
+ c.add_argument('p_payee_id', metavar='PAYEE_ID', nargs='?', default=argparse.SUPPRESS, help='The id of the payee')
545
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
546
+ c.add_argument('--payee-id', dest='p_payee_id', default=argparse.SUPPRESS, metavar='PAYEE_ID', help='same as PAYEE_ID')
547
+ c.add_argument('--since-date', dest='p_since_date', metavar='YYYY-MM-DD', help='If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30). Defaults to one year ago when not specified.')
548
+ c.add_argument('--until-date', dest='p_until_date', metavar='YYYY-MM-DD', help='If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).')
549
+ c.add_argument('--type', dest='p_type', choices=['uncategorized', 'unapproved'], help='If specified, only transactions of the specified type will be included. "uncategorized" and "unapproved" are currently supported.')
550
+ c.add_argument('--last-knowledge-of-server', dest='p_last_knowledge_of_server', type=integer, metavar='LAST_KNOWLEDGE_OF_SERVER', help='The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.')
551
+ c.set_defaults(handler=_run_transactions_list_by_payee, flags={'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'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_transactions_by_payee'})
552
+ c = g_transactions_commands.add_parser('list-by-month', parents=[common], help='Get plan month transactions', description='Returns all transactions for a specified month, excluding any pending\ntransactions', usage='%(prog)s MONTH [options]', epilog=RUNTIME.command_epilog(['ynab transactions list-by-month MONTH']), formatter_class=RAW)
553
+ c.add_argument('p_month', metavar='MONTH', nargs='?', default=argparse.SUPPRESS, help='The plan month in ISO format (e.g. 2016-12-01) ("current" can also be used to specify the current calendar month (UTC))')
554
+ c.add_argument('--plan-id', dest='p_plan_id', metavar='PLAN_ID', help='The id of the plan. "last-used" can be used to specify the last used plan and "default" can be used if default plan selection is enabled (see: https://api.ynab.com/#oauth-default-plan). (default: last-used)')
555
+ c.add_argument('--month', dest='p_month', default=argparse.SUPPRESS, metavar='MONTH', help='same as MONTH')
556
+ c.add_argument('--since-date', dest='p_since_date', metavar='YYYY-MM-DD', help='If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).')
557
+ c.add_argument('--until-date', dest='p_until_date', metavar='YYYY-MM-DD', help='If specified, only transactions on or before this date will be included. The date should be ISO formatted (e.g. 2016-12-30).')
558
+ c.add_argument('--type', dest='p_type', choices=['uncategorized', 'unapproved'], help='If specified, only transactions of the specified type will be included. "uncategorized" and "unapproved" are currently supported.')
559
+ c.add_argument('--last-knowledge-of-server', dest='p_last_knowledge_of_server', type=integer, metavar='LAST_KNOWLEDGE_OF_SERVER', help='The starting server knowledge. If provided, only entities that have changed since `last_knowledge_of_server` will be included.')
560
+ c.set_defaults(handler=_run_transactions_list_by_month, flags={'plan_id': '--plan-id', 'month': '--month', 'since_date': '--since-date', 'until_date': '--until-date', 'type': '--type', 'last_knowledge_of_server': '--last-knowledge-of-server'}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_transactions_by_month'})
561
+ g_user = commands.add_parser('user', help='get', description="Run 'ynab user COMMAND --help' for a command's options and examples.")
562
+ g_user_commands = g_user.add_subparsers(dest="g_user", metavar="COMMAND", required=True)
563
+ c = g_user_commands.add_parser('get', parents=[common], help='Get user', description='Returns authenticated user information', usage='%(prog)s [options]', epilog=RUNTIME.command_epilog(['ynab user get']), formatter_class=RAW)
564
+ c.set_defaults(handler=_run_user_get, flags={}, meta={'read_only': True, 'destructive': False, 'paginated': False, 'deprecated': False, 'operation': 'get_user'})
565
+ RUNTIME.add_builtins(commands)
566
+ return parser
567
+
568
+
569
+ def main(argv: Sequence[str] | None = None) -> int:
570
+ """Parse arguments, run one command, and return the exit code."""
571
+ return RUNTIME.main(
572
+ build_parser, lambda options: Client(**options), _api_model, argv
573
+ )