lunchmoney-python 2.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. lunchmoney/__init__.py +205 -0
  2. lunchmoney/api/__init__.py +16 -0
  3. lunchmoney/api/categories_api.py +1499 -0
  4. lunchmoney/api/manual_accounts_api.py +1479 -0
  5. lunchmoney/api/me_api.py +293 -0
  6. lunchmoney/api/plaid_accounts_api.py +909 -0
  7. lunchmoney/api/recurring_items_api.py +702 -0
  8. lunchmoney/api/summary_api.py +434 -0
  9. lunchmoney/api/tags_api.py +1465 -0
  10. lunchmoney/api/transactions_api.py +914 -0
  11. lunchmoney/api/transactions_bulk_api.py +1527 -0
  12. lunchmoney/api/transactions_files_api.py +891 -0
  13. lunchmoney/api/transactions_group_api.py +601 -0
  14. lunchmoney/api/transactions_split_api.py +616 -0
  15. lunchmoney/api_client.py +805 -0
  16. lunchmoney/api_response.py +21 -0
  17. lunchmoney/configuration.py +620 -0
  18. lunchmoney/exceptions.py +217 -0
  19. lunchmoney/models/__init__.py +84 -0
  20. lunchmoney/models/account_type_enum.py +46 -0
  21. lunchmoney/models/aligned_category_totals_object.py +108 -0
  22. lunchmoney/models/aligned_summary_category_object.py +110 -0
  23. lunchmoney/models/aligned_summary_response_object.py +104 -0
  24. lunchmoney/models/category_object.py +146 -0
  25. lunchmoney/models/child_category_object.py +141 -0
  26. lunchmoney/models/child_transaction_object.py +219 -0
  27. lunchmoney/models/create_category_request_object.py +137 -0
  28. lunchmoney/models/create_category_request_object_children_inner.py +159 -0
  29. lunchmoney/models/create_manual_account_request_object.py +138 -0
  30. lunchmoney/models/create_manual_account_request_object_balance.py +145 -0
  31. lunchmoney/models/create_new_transactions_request.py +103 -0
  32. lunchmoney/models/create_tag_request_object.py +112 -0
  33. lunchmoney/models/currency_enum.py +198 -0
  34. lunchmoney/models/delete_category_response_with_dependencies.py +94 -0
  35. lunchmoney/models/delete_category_response_with_dependencies_dependents.py +98 -0
  36. lunchmoney/models/delete_tag_response_with_dependencies.py +94 -0
  37. lunchmoney/models/delete_tag_response_with_dependencies_dependents.py +90 -0
  38. lunchmoney/models/delete_transactions_request.py +89 -0
  39. lunchmoney/models/error_response_object.py +98 -0
  40. lunchmoney/models/error_response_object_errors_inner.py +101 -0
  41. lunchmoney/models/get_all_categories200_response.py +96 -0
  42. lunchmoney/models/get_all_manual_accounts200_response.py +96 -0
  43. lunchmoney/models/get_all_plaid_accounts200_response.py +96 -0
  44. lunchmoney/models/get_all_recurring200_response.py +96 -0
  45. lunchmoney/models/get_all_tags200_response.py +96 -0
  46. lunchmoney/models/get_all_transactions200_response.py +100 -0
  47. lunchmoney/models/get_all_transactions_created_since_parameter.py +145 -0
  48. lunchmoney/models/get_budget_summary200_response.py +138 -0
  49. lunchmoney/models/get_transaction_attachment_url200_response.py +91 -0
  50. lunchmoney/models/group_transactions_request.py +122 -0
  51. lunchmoney/models/insert_transaction_object.py +164 -0
  52. lunchmoney/models/insert_transaction_object_amount.py +145 -0
  53. lunchmoney/models/insert_transactions_response_object.py +106 -0
  54. lunchmoney/models/manual_account_object.py +158 -0
  55. lunchmoney/models/non_aligned_category_totals_object.py +94 -0
  56. lunchmoney/models/non_aligned_summary_category_object.py +94 -0
  57. lunchmoney/models/non_aligned_summary_response_object.py +104 -0
  58. lunchmoney/models/plaid_account_object.py +168 -0
  59. lunchmoney/models/recurring_object.py +143 -0
  60. lunchmoney/models/recurring_object_matches.py +105 -0
  61. lunchmoney/models/recurring_object_matches_found_transactions_inner.py +91 -0
  62. lunchmoney/models/recurring_object_overrides.py +92 -0
  63. lunchmoney/models/recurring_object_transaction_criteria.py +149 -0
  64. lunchmoney/models/skipped_existing_external_id_object.py +108 -0
  65. lunchmoney/models/split_transaction_object.py +102 -0
  66. lunchmoney/models/split_transaction_object_amount.py +145 -0
  67. lunchmoney/models/split_transaction_request.py +97 -0
  68. lunchmoney/models/summary_category_occurrence_object.py +126 -0
  69. lunchmoney/models/summary_recurring_transaction_object.py +100 -0
  70. lunchmoney/models/summary_rollover_pool_adjustment_object.py +98 -0
  71. lunchmoney/models/summary_rollover_pool_object.py +98 -0
  72. lunchmoney/models/summary_totals_breakdown_object.py +98 -0
  73. lunchmoney/models/summary_totals_object.py +97 -0
  74. lunchmoney/models/tag_object.py +125 -0
  75. lunchmoney/models/transaction_attachment_object.py +106 -0
  76. lunchmoney/models/transaction_object.py +229 -0
  77. lunchmoney/models/update_category_request_object.py +156 -0
  78. lunchmoney/models/update_manual_account_request_object.py +156 -0
  79. lunchmoney/models/update_manual_account_request_object_balance.py +145 -0
  80. lunchmoney/models/update_tag_request_object.py +126 -0
  81. lunchmoney/models/update_transaction_object.py +228 -0
  82. lunchmoney/models/update_transaction_object_amount.py +145 -0
  83. lunchmoney/models/update_transactions200_response.py +96 -0
  84. lunchmoney/models/update_transactions_request.py +97 -0
  85. lunchmoney/models/update_transactions_request_transactions_inner.py +228 -0
  86. lunchmoney/models/user_object.py +106 -0
  87. lunchmoney/py.typed +0 -0
  88. lunchmoney/rest.py +259 -0
  89. lunchmoney_python-2.9.0.dist-info/METADATA +285 -0
  90. lunchmoney_python-2.9.0.dist-info/RECORD +92 -0
  91. lunchmoney_python-2.9.0.dist-info/WHEEL +5 -0
  92. lunchmoney_python-2.9.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1499 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Lunch Money API - v2
5
+
6
+ Welcome to the Lunch Money v2 API. A working version of this API is now available through these docs, or directly at: `https://api.lunchmoney.dev/v2` <span class=\"red-text\"><strong>This is in alpha launch of a major API update. It is still subject to change during this alpha review period and bugs may still exist. Users are strongly encouraged to use the mock service or to create a test budget with example data as the first step to interacting with the v2 API.</strong></span> See the [Getting Started Guide](https://alpha.lunchmoney.dev/v2/getting-started) for more information on using a test budget.<br<br> If you are new to the v2 API, you may wish to review the [v2 API Overview of Changes](https://alpha.lunchmoney.dev/v2/changelog). ### Static Mock Server You may also use these docs to explore the API using a static mock server endpoint.<p> This enables users to become familiar with the API without having to create an access token, and eliminates the possibility of modifying real data. <p> To access this endpoint select the second endpoint in the the \"Server\" dropdown to the right. When selected you should see \"Static Mock v2 Lunch Money API Server\".<br> When using this server, set your Bearer token to any string with 11 or more characters. ### Migrating from V1 The v2 API is NOT backwards compatible with the v1 API. Developers are encouraged to review the [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) to understand the changes and plan their migration. ### Acknowledgments If you have been providing feedback on the API during our iterative design process, **THANK YOU**. We are happy to provide the opportunity to finally interact with the working API that was built based on your feedback. ### Useful links: - [Getting Started](https://alpha.lunchmoney.dev/v2/getting-started) - [v2 API Changelog](https://alpha.lunchmoney.dev/v2/changelog) - [Migration Guide](https://alpha.lunchmoney.dev/v2/migration-guide) - [Rate Limits](https://alpha.lunchmoney.dev/v2/rate-limits) - [Current v1 Lunch Money API Documentation](https://lunchmoney.dev) - [Awesome Lunch Money Projects](https://github.com/lunch-money/awesome-lunchmoney?tab=readme-ov-file)
7
+
8
+ The version of the OpenAPI document: 2.8.4
9
+ Contact: devsupport@lunchmoney.app
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ import warnings
16
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
17
+ from typing import Any, Dict, List, Optional, Tuple, Union
18
+ from typing_extensions import Annotated
19
+
20
+ from pydantic import Field, StrictBool, StrictInt, StrictStr, field_validator
21
+ from typing import Optional
22
+ from typing_extensions import Annotated
23
+ from lunchmoney.models.category_object import CategoryObject
24
+ from lunchmoney.models.create_category_request_object import CreateCategoryRequestObject
25
+ from lunchmoney.models.get_all_categories200_response import GetAllCategories200Response
26
+ from lunchmoney.models.update_category_request_object import UpdateCategoryRequestObject
27
+
28
+ from lunchmoney.api_client import ApiClient, RequestSerialized
29
+ from lunchmoney.api_response import ApiResponse
30
+ from lunchmoney.rest import RESTResponseType
31
+
32
+
33
+ class CategoriesApi:
34
+ """NOTE: This class is auto generated by OpenAPI Generator
35
+ Ref: https://openapi-generator.tech
36
+
37
+ Do not edit the class manually.
38
+ """
39
+
40
+ def __init__(self, api_client=None) -> None:
41
+ if api_client is None:
42
+ api_client = ApiClient.get_default()
43
+ self.api_client = api_client
44
+
45
+
46
+ @validate_call
47
+ def create_category(
48
+ self,
49
+ create_category_request_object: CreateCategoryRequestObject,
50
+ _request_timeout: Union[
51
+ None,
52
+ Annotated[StrictFloat, Field(gt=0)],
53
+ Tuple[
54
+ Annotated[StrictFloat, Field(gt=0)],
55
+ Annotated[StrictFloat, Field(gt=0)]
56
+ ]
57
+ ] = None,
58
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
59
+ _content_type: Optional[StrictStr] = None,
60
+ _headers: Optional[Dict[StrictStr, Any]] = None,
61
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
62
+ ) -> CategoryObject:
63
+ """Create a new category or category group
64
+
65
+ Creates a new category with the given name.<br> If the `is_group` attribute is set to true, a category group is created. In this case, the `children` attribute may be set to an array of existing category IDs to add to the newly-created category group.
66
+
67
+ :param create_category_request_object: (required)
68
+ :type create_category_request_object: CreateCategoryRequestObject
69
+ :param _request_timeout: timeout setting for this request. If one
70
+ number provided, it will be total request
71
+ timeout. It can also be a pair (tuple) of
72
+ (connection, read) timeouts.
73
+ :type _request_timeout: int, tuple(int, int), optional
74
+ :param _request_auth: set to override the auth_settings for an a single
75
+ request; this effectively ignores the
76
+ authentication in the spec for a single request.
77
+ :type _request_auth: dict, optional
78
+ :param _content_type: force content-type for the request.
79
+ :type _content_type: str, Optional
80
+ :param _headers: set to override the headers for a single
81
+ request; this effectively ignores the headers
82
+ in the spec for a single request.
83
+ :type _headers: dict, optional
84
+ :param _host_index: set to override the host_index for a single
85
+ request; this effectively ignores the host_index
86
+ in the spec for a single request.
87
+ :type _host_index: int, optional
88
+ :return: Returns the result object.
89
+ """ # noqa: E501
90
+
91
+ _param = self._create_category_serialize(
92
+ create_category_request_object=create_category_request_object,
93
+ _request_auth=_request_auth,
94
+ _content_type=_content_type,
95
+ _headers=_headers,
96
+ _host_index=_host_index
97
+ )
98
+
99
+ _response_types_map: Dict[str, Optional[str]] = {
100
+ '201': "CategoryObject",
101
+ '400': "ErrorResponseObject",
102
+ '401': "ErrorResponseObject",
103
+ '429': "ErrorResponseObject",
104
+ '500': "ErrorResponseObject",
105
+ }
106
+ response_data = self.api_client.call_api(
107
+ *_param,
108
+ _request_timeout=_request_timeout
109
+ )
110
+ response_data.read()
111
+ return self.api_client.response_deserialize(
112
+ response_data=response_data,
113
+ response_types_map=_response_types_map,
114
+ ).data
115
+
116
+
117
+ @validate_call
118
+ def create_category_with_http_info(
119
+ self,
120
+ create_category_request_object: CreateCategoryRequestObject,
121
+ _request_timeout: Union[
122
+ None,
123
+ Annotated[StrictFloat, Field(gt=0)],
124
+ Tuple[
125
+ Annotated[StrictFloat, Field(gt=0)],
126
+ Annotated[StrictFloat, Field(gt=0)]
127
+ ]
128
+ ] = None,
129
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
130
+ _content_type: Optional[StrictStr] = None,
131
+ _headers: Optional[Dict[StrictStr, Any]] = None,
132
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
133
+ ) -> ApiResponse[CategoryObject]:
134
+ """Create a new category or category group
135
+
136
+ Creates a new category with the given name.<br> If the `is_group` attribute is set to true, a category group is created. In this case, the `children` attribute may be set to an array of existing category IDs to add to the newly-created category group.
137
+
138
+ :param create_category_request_object: (required)
139
+ :type create_category_request_object: CreateCategoryRequestObject
140
+ :param _request_timeout: timeout setting for this request. If one
141
+ number provided, it will be total request
142
+ timeout. It can also be a pair (tuple) of
143
+ (connection, read) timeouts.
144
+ :type _request_timeout: int, tuple(int, int), optional
145
+ :param _request_auth: set to override the auth_settings for an a single
146
+ request; this effectively ignores the
147
+ authentication in the spec for a single request.
148
+ :type _request_auth: dict, optional
149
+ :param _content_type: force content-type for the request.
150
+ :type _content_type: str, Optional
151
+ :param _headers: set to override the headers for a single
152
+ request; this effectively ignores the headers
153
+ in the spec for a single request.
154
+ :type _headers: dict, optional
155
+ :param _host_index: set to override the host_index for a single
156
+ request; this effectively ignores the host_index
157
+ in the spec for a single request.
158
+ :type _host_index: int, optional
159
+ :return: Returns the result object.
160
+ """ # noqa: E501
161
+
162
+ _param = self._create_category_serialize(
163
+ create_category_request_object=create_category_request_object,
164
+ _request_auth=_request_auth,
165
+ _content_type=_content_type,
166
+ _headers=_headers,
167
+ _host_index=_host_index
168
+ )
169
+
170
+ _response_types_map: Dict[str, Optional[str]] = {
171
+ '201': "CategoryObject",
172
+ '400': "ErrorResponseObject",
173
+ '401': "ErrorResponseObject",
174
+ '429': "ErrorResponseObject",
175
+ '500': "ErrorResponseObject",
176
+ }
177
+ response_data = self.api_client.call_api(
178
+ *_param,
179
+ _request_timeout=_request_timeout
180
+ )
181
+ response_data.read()
182
+ return self.api_client.response_deserialize(
183
+ response_data=response_data,
184
+ response_types_map=_response_types_map,
185
+ )
186
+
187
+
188
+ @validate_call
189
+ def create_category_without_preload_content(
190
+ self,
191
+ create_category_request_object: CreateCategoryRequestObject,
192
+ _request_timeout: Union[
193
+ None,
194
+ Annotated[StrictFloat, Field(gt=0)],
195
+ Tuple[
196
+ Annotated[StrictFloat, Field(gt=0)],
197
+ Annotated[StrictFloat, Field(gt=0)]
198
+ ]
199
+ ] = None,
200
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
201
+ _content_type: Optional[StrictStr] = None,
202
+ _headers: Optional[Dict[StrictStr, Any]] = None,
203
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
204
+ ) -> RESTResponseType:
205
+ """Create a new category or category group
206
+
207
+ Creates a new category with the given name.<br> If the `is_group` attribute is set to true, a category group is created. In this case, the `children` attribute may be set to an array of existing category IDs to add to the newly-created category group.
208
+
209
+ :param create_category_request_object: (required)
210
+ :type create_category_request_object: CreateCategoryRequestObject
211
+ :param _request_timeout: timeout setting for this request. If one
212
+ number provided, it will be total request
213
+ timeout. It can also be a pair (tuple) of
214
+ (connection, read) timeouts.
215
+ :type _request_timeout: int, tuple(int, int), optional
216
+ :param _request_auth: set to override the auth_settings for an a single
217
+ request; this effectively ignores the
218
+ authentication in the spec for a single request.
219
+ :type _request_auth: dict, optional
220
+ :param _content_type: force content-type for the request.
221
+ :type _content_type: str, Optional
222
+ :param _headers: set to override the headers for a single
223
+ request; this effectively ignores the headers
224
+ in the spec for a single request.
225
+ :type _headers: dict, optional
226
+ :param _host_index: set to override the host_index for a single
227
+ request; this effectively ignores the host_index
228
+ in the spec for a single request.
229
+ :type _host_index: int, optional
230
+ :return: Returns the result object.
231
+ """ # noqa: E501
232
+
233
+ _param = self._create_category_serialize(
234
+ create_category_request_object=create_category_request_object,
235
+ _request_auth=_request_auth,
236
+ _content_type=_content_type,
237
+ _headers=_headers,
238
+ _host_index=_host_index
239
+ )
240
+
241
+ _response_types_map: Dict[str, Optional[str]] = {
242
+ '201': "CategoryObject",
243
+ '400': "ErrorResponseObject",
244
+ '401': "ErrorResponseObject",
245
+ '429': "ErrorResponseObject",
246
+ '500': "ErrorResponseObject",
247
+ }
248
+ response_data = self.api_client.call_api(
249
+ *_param,
250
+ _request_timeout=_request_timeout
251
+ )
252
+ return response_data.response
253
+
254
+
255
+ def _create_category_serialize(
256
+ self,
257
+ create_category_request_object,
258
+ _request_auth,
259
+ _content_type,
260
+ _headers,
261
+ _host_index,
262
+ ) -> RequestSerialized:
263
+
264
+ _host = None
265
+
266
+ _collection_formats: Dict[str, str] = {
267
+ }
268
+
269
+ _path_params: Dict[str, str] = {}
270
+ _query_params: List[Tuple[str, str]] = []
271
+ _header_params: Dict[str, Optional[str]] = _headers or {}
272
+ _form_params: List[Tuple[str, str]] = []
273
+ _files: Dict[
274
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
275
+ ] = {}
276
+ _body_params: Optional[bytes] = None
277
+
278
+ # process the path parameters
279
+ # process the query parameters
280
+ # process the header parameters
281
+ # process the form parameters
282
+ # process the body parameter
283
+ if create_category_request_object is not None:
284
+ _body_params = create_category_request_object
285
+
286
+
287
+ # set the HTTP header `Accept`
288
+ if 'Accept' not in _header_params:
289
+ _header_params['Accept'] = self.api_client.select_header_accept(
290
+ [
291
+ 'application/json'
292
+ ]
293
+ )
294
+
295
+ # set the HTTP header `Content-Type`
296
+ if _content_type:
297
+ _header_params['Content-Type'] = _content_type
298
+ else:
299
+ _default_content_type = (
300
+ self.api_client.select_header_content_type(
301
+ [
302
+ 'application/json'
303
+ ]
304
+ )
305
+ )
306
+ if _default_content_type is not None:
307
+ _header_params['Content-Type'] = _default_content_type
308
+
309
+ # authentication setting
310
+ _auth_settings: List[str] = [
311
+ 'cookieAuth',
312
+ 'bearerSecurity'
313
+ ]
314
+
315
+ return self.api_client.param_serialize(
316
+ method='POST',
317
+ resource_path='/categories',
318
+ path_params=_path_params,
319
+ query_params=_query_params,
320
+ header_params=_header_params,
321
+ body=_body_params,
322
+ post_params=_form_params,
323
+ files=_files,
324
+ auth_settings=_auth_settings,
325
+ collection_formats=_collection_formats,
326
+ _host=_host,
327
+ _request_auth=_request_auth
328
+ )
329
+
330
+
331
+
332
+
333
+ @validate_call
334
+ def delete_category(
335
+ self,
336
+ id: Annotated[StrictInt, Field(description="ID of the category to delete")],
337
+ force: Annotated[Optional[StrictBool], Field(description="Set to `true` to force deletion even if there are dependencies")] = None,
338
+ _request_timeout: Union[
339
+ None,
340
+ Annotated[StrictFloat, Field(gt=0)],
341
+ Tuple[
342
+ Annotated[StrictFloat, Field(gt=0)],
343
+ Annotated[StrictFloat, Field(gt=0)]
344
+ ]
345
+ ] = None,
346
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
347
+ _content_type: Optional[StrictStr] = None,
348
+ _headers: Optional[Dict[StrictStr, Any]] = None,
349
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
350
+ ) -> None:
351
+ """Delete a category or category group
352
+
353
+ Attempts to delete the single category or category group specified on the path. By default, this will only work if there are no dependencies, such as existing budgets for the category, categorized transactions, children categories for a category group, categorized recurring items, etc. If there are dependents, this endpoint will return an object that describes the amount and type of existing dependencies.
354
+
355
+ :param id: ID of the category to delete (required)
356
+ :type id: int
357
+ :param force: Set to `true` to force deletion even if there are dependencies
358
+ :type force: bool
359
+ :param _request_timeout: timeout setting for this request. If one
360
+ number provided, it will be total request
361
+ timeout. It can also be a pair (tuple) of
362
+ (connection, read) timeouts.
363
+ :type _request_timeout: int, tuple(int, int), optional
364
+ :param _request_auth: set to override the auth_settings for an a single
365
+ request; this effectively ignores the
366
+ authentication in the spec for a single request.
367
+ :type _request_auth: dict, optional
368
+ :param _content_type: force content-type for the request.
369
+ :type _content_type: str, Optional
370
+ :param _headers: set to override the headers for a single
371
+ request; this effectively ignores the headers
372
+ in the spec for a single request.
373
+ :type _headers: dict, optional
374
+ :param _host_index: set to override the host_index for a single
375
+ request; this effectively ignores the host_index
376
+ in the spec for a single request.
377
+ :type _host_index: int, optional
378
+ :return: Returns the result object.
379
+ """ # noqa: E501
380
+
381
+ _param = self._delete_category_serialize(
382
+ id=id,
383
+ force=force,
384
+ _request_auth=_request_auth,
385
+ _content_type=_content_type,
386
+ _headers=_headers,
387
+ _host_index=_host_index
388
+ )
389
+
390
+ _response_types_map: Dict[str, Optional[str]] = {
391
+ '204': None,
392
+ '401': "ErrorResponseObject",
393
+ '404': "ErrorResponseObject",
394
+ '422': "DeleteCategoryResponseWithDependencies",
395
+ '429': "ErrorResponseObject",
396
+ '500': "ErrorResponseObject",
397
+ }
398
+ response_data = self.api_client.call_api(
399
+ *_param,
400
+ _request_timeout=_request_timeout
401
+ )
402
+ response_data.read()
403
+ return self.api_client.response_deserialize(
404
+ response_data=response_data,
405
+ response_types_map=_response_types_map,
406
+ ).data
407
+
408
+
409
+ @validate_call
410
+ def delete_category_with_http_info(
411
+ self,
412
+ id: Annotated[StrictInt, Field(description="ID of the category to delete")],
413
+ force: Annotated[Optional[StrictBool], Field(description="Set to `true` to force deletion even if there are dependencies")] = None,
414
+ _request_timeout: Union[
415
+ None,
416
+ Annotated[StrictFloat, Field(gt=0)],
417
+ Tuple[
418
+ Annotated[StrictFloat, Field(gt=0)],
419
+ Annotated[StrictFloat, Field(gt=0)]
420
+ ]
421
+ ] = None,
422
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
423
+ _content_type: Optional[StrictStr] = None,
424
+ _headers: Optional[Dict[StrictStr, Any]] = None,
425
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
426
+ ) -> ApiResponse[None]:
427
+ """Delete a category or category group
428
+
429
+ Attempts to delete the single category or category group specified on the path. By default, this will only work if there are no dependencies, such as existing budgets for the category, categorized transactions, children categories for a category group, categorized recurring items, etc. If there are dependents, this endpoint will return an object that describes the amount and type of existing dependencies.
430
+
431
+ :param id: ID of the category to delete (required)
432
+ :type id: int
433
+ :param force: Set to `true` to force deletion even if there are dependencies
434
+ :type force: bool
435
+ :param _request_timeout: timeout setting for this request. If one
436
+ number provided, it will be total request
437
+ timeout. It can also be a pair (tuple) of
438
+ (connection, read) timeouts.
439
+ :type _request_timeout: int, tuple(int, int), optional
440
+ :param _request_auth: set to override the auth_settings for an a single
441
+ request; this effectively ignores the
442
+ authentication in the spec for a single request.
443
+ :type _request_auth: dict, optional
444
+ :param _content_type: force content-type for the request.
445
+ :type _content_type: str, Optional
446
+ :param _headers: set to override the headers for a single
447
+ request; this effectively ignores the headers
448
+ in the spec for a single request.
449
+ :type _headers: dict, optional
450
+ :param _host_index: set to override the host_index for a single
451
+ request; this effectively ignores the host_index
452
+ in the spec for a single request.
453
+ :type _host_index: int, optional
454
+ :return: Returns the result object.
455
+ """ # noqa: E501
456
+
457
+ _param = self._delete_category_serialize(
458
+ id=id,
459
+ force=force,
460
+ _request_auth=_request_auth,
461
+ _content_type=_content_type,
462
+ _headers=_headers,
463
+ _host_index=_host_index
464
+ )
465
+
466
+ _response_types_map: Dict[str, Optional[str]] = {
467
+ '204': None,
468
+ '401': "ErrorResponseObject",
469
+ '404': "ErrorResponseObject",
470
+ '422': "DeleteCategoryResponseWithDependencies",
471
+ '429': "ErrorResponseObject",
472
+ '500': "ErrorResponseObject",
473
+ }
474
+ response_data = self.api_client.call_api(
475
+ *_param,
476
+ _request_timeout=_request_timeout
477
+ )
478
+ response_data.read()
479
+ return self.api_client.response_deserialize(
480
+ response_data=response_data,
481
+ response_types_map=_response_types_map,
482
+ )
483
+
484
+
485
+ @validate_call
486
+ def delete_category_without_preload_content(
487
+ self,
488
+ id: Annotated[StrictInt, Field(description="ID of the category to delete")],
489
+ force: Annotated[Optional[StrictBool], Field(description="Set to `true` to force deletion even if there are dependencies")] = None,
490
+ _request_timeout: Union[
491
+ None,
492
+ Annotated[StrictFloat, Field(gt=0)],
493
+ Tuple[
494
+ Annotated[StrictFloat, Field(gt=0)],
495
+ Annotated[StrictFloat, Field(gt=0)]
496
+ ]
497
+ ] = None,
498
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
499
+ _content_type: Optional[StrictStr] = None,
500
+ _headers: Optional[Dict[StrictStr, Any]] = None,
501
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
502
+ ) -> RESTResponseType:
503
+ """Delete a category or category group
504
+
505
+ Attempts to delete the single category or category group specified on the path. By default, this will only work if there are no dependencies, such as existing budgets for the category, categorized transactions, children categories for a category group, categorized recurring items, etc. If there are dependents, this endpoint will return an object that describes the amount and type of existing dependencies.
506
+
507
+ :param id: ID of the category to delete (required)
508
+ :type id: int
509
+ :param force: Set to `true` to force deletion even if there are dependencies
510
+ :type force: bool
511
+ :param _request_timeout: timeout setting for this request. If one
512
+ number provided, it will be total request
513
+ timeout. It can also be a pair (tuple) of
514
+ (connection, read) timeouts.
515
+ :type _request_timeout: int, tuple(int, int), optional
516
+ :param _request_auth: set to override the auth_settings for an a single
517
+ request; this effectively ignores the
518
+ authentication in the spec for a single request.
519
+ :type _request_auth: dict, optional
520
+ :param _content_type: force content-type for the request.
521
+ :type _content_type: str, Optional
522
+ :param _headers: set to override the headers for a single
523
+ request; this effectively ignores the headers
524
+ in the spec for a single request.
525
+ :type _headers: dict, optional
526
+ :param _host_index: set to override the host_index for a single
527
+ request; this effectively ignores the host_index
528
+ in the spec for a single request.
529
+ :type _host_index: int, optional
530
+ :return: Returns the result object.
531
+ """ # noqa: E501
532
+
533
+ _param = self._delete_category_serialize(
534
+ id=id,
535
+ force=force,
536
+ _request_auth=_request_auth,
537
+ _content_type=_content_type,
538
+ _headers=_headers,
539
+ _host_index=_host_index
540
+ )
541
+
542
+ _response_types_map: Dict[str, Optional[str]] = {
543
+ '204': None,
544
+ '401': "ErrorResponseObject",
545
+ '404': "ErrorResponseObject",
546
+ '422': "DeleteCategoryResponseWithDependencies",
547
+ '429': "ErrorResponseObject",
548
+ '500': "ErrorResponseObject",
549
+ }
550
+ response_data = self.api_client.call_api(
551
+ *_param,
552
+ _request_timeout=_request_timeout
553
+ )
554
+ return response_data.response
555
+
556
+
557
+ def _delete_category_serialize(
558
+ self,
559
+ id,
560
+ force,
561
+ _request_auth,
562
+ _content_type,
563
+ _headers,
564
+ _host_index,
565
+ ) -> RequestSerialized:
566
+
567
+ _host = None
568
+
569
+ _collection_formats: Dict[str, str] = {
570
+ }
571
+
572
+ _path_params: Dict[str, str] = {}
573
+ _query_params: List[Tuple[str, str]] = []
574
+ _header_params: Dict[str, Optional[str]] = _headers or {}
575
+ _form_params: List[Tuple[str, str]] = []
576
+ _files: Dict[
577
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
578
+ ] = {}
579
+ _body_params: Optional[bytes] = None
580
+
581
+ # process the path parameters
582
+ if id is not None:
583
+ _path_params['id'] = id
584
+ # process the query parameters
585
+ if force is not None:
586
+
587
+ _query_params.append(('force', force))
588
+
589
+ # process the header parameters
590
+ # process the form parameters
591
+ # process the body parameter
592
+
593
+
594
+ # set the HTTP header `Accept`
595
+ if 'Accept' not in _header_params:
596
+ _header_params['Accept'] = self.api_client.select_header_accept(
597
+ [
598
+ 'application/json'
599
+ ]
600
+ )
601
+
602
+
603
+ # authentication setting
604
+ _auth_settings: List[str] = [
605
+ 'cookieAuth',
606
+ 'bearerSecurity'
607
+ ]
608
+
609
+ return self.api_client.param_serialize(
610
+ method='DELETE',
611
+ resource_path='/categories/{id}',
612
+ path_params=_path_params,
613
+ query_params=_query_params,
614
+ header_params=_header_params,
615
+ body=_body_params,
616
+ post_params=_form_params,
617
+ files=_files,
618
+ auth_settings=_auth_settings,
619
+ collection_formats=_collection_formats,
620
+ _host=_host,
621
+ _request_auth=_request_auth
622
+ )
623
+
624
+
625
+
626
+
627
+ @validate_call
628
+ def get_all_categories(
629
+ self,
630
+ format: Annotated[Optional[StrictStr], Field(description="If `nested`, returns top-level categories (either category groups or categories not part of a category group) in alphabetical order. Grouped categories are nested within the category group under the property `children`. A `flattened`, response is similar but it includes grouped categories at the top level.<br/><br/> Categories are sorted by their `order`. When `order` is null, they are listed in alphabetical order below other categories with an `order`.")] = None,
631
+ is_group: Annotated[Optional[StrictBool], Field(description="If `false`, only categories not part of a category group are returned.<br> If `true`, only category groups are returned.<br> When set, the `format` parameter is ignored.")] = None,
632
+ _request_timeout: Union[
633
+ None,
634
+ Annotated[StrictFloat, Field(gt=0)],
635
+ Tuple[
636
+ Annotated[StrictFloat, Field(gt=0)],
637
+ Annotated[StrictFloat, Field(gt=0)]
638
+ ]
639
+ ] = None,
640
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
641
+ _content_type: Optional[StrictStr] = None,
642
+ _headers: Optional[Dict[StrictStr, Any]] = None,
643
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
644
+ ) -> GetAllCategories200Response:
645
+ """Get all categories
646
+
647
+ Retrieve a list of all categories associated with the user's account.
648
+
649
+ :param format: If `nested`, returns top-level categories (either category groups or categories not part of a category group) in alphabetical order. Grouped categories are nested within the category group under the property `children`. A `flattened`, response is similar but it includes grouped categories at the top level.<br/><br/> Categories are sorted by their `order`. When `order` is null, they are listed in alphabetical order below other categories with an `order`.
650
+ :type format: str
651
+ :param is_group: If `false`, only categories not part of a category group are returned.<br> If `true`, only category groups are returned.<br> When set, the `format` parameter is ignored.
652
+ :type is_group: bool
653
+ :param _request_timeout: timeout setting for this request. If one
654
+ number provided, it will be total request
655
+ timeout. It can also be a pair (tuple) of
656
+ (connection, read) timeouts.
657
+ :type _request_timeout: int, tuple(int, int), optional
658
+ :param _request_auth: set to override the auth_settings for an a single
659
+ request; this effectively ignores the
660
+ authentication in the spec for a single request.
661
+ :type _request_auth: dict, optional
662
+ :param _content_type: force content-type for the request.
663
+ :type _content_type: str, Optional
664
+ :param _headers: set to override the headers for a single
665
+ request; this effectively ignores the headers
666
+ in the spec for a single request.
667
+ :type _headers: dict, optional
668
+ :param _host_index: set to override the host_index for a single
669
+ request; this effectively ignores the host_index
670
+ in the spec for a single request.
671
+ :type _host_index: int, optional
672
+ :return: Returns the result object.
673
+ """ # noqa: E501
674
+
675
+ _param = self._get_all_categories_serialize(
676
+ format=format,
677
+ is_group=is_group,
678
+ _request_auth=_request_auth,
679
+ _content_type=_content_type,
680
+ _headers=_headers,
681
+ _host_index=_host_index
682
+ )
683
+
684
+ _response_types_map: Dict[str, Optional[str]] = {
685
+ '200': "GetAllCategories200Response",
686
+ '400': "ErrorResponseObject",
687
+ '401': "ErrorResponseObject",
688
+ '429': "ErrorResponseObject",
689
+ '500': "ErrorResponseObject",
690
+ }
691
+ response_data = self.api_client.call_api(
692
+ *_param,
693
+ _request_timeout=_request_timeout
694
+ )
695
+ response_data.read()
696
+ return self.api_client.response_deserialize(
697
+ response_data=response_data,
698
+ response_types_map=_response_types_map,
699
+ ).data
700
+
701
+
702
+ @validate_call
703
+ def get_all_categories_with_http_info(
704
+ self,
705
+ format: Annotated[Optional[StrictStr], Field(description="If `nested`, returns top-level categories (either category groups or categories not part of a category group) in alphabetical order. Grouped categories are nested within the category group under the property `children`. A `flattened`, response is similar but it includes grouped categories at the top level.<br/><br/> Categories are sorted by their `order`. When `order` is null, they are listed in alphabetical order below other categories with an `order`.")] = None,
706
+ is_group: Annotated[Optional[StrictBool], Field(description="If `false`, only categories not part of a category group are returned.<br> If `true`, only category groups are returned.<br> When set, the `format` parameter is ignored.")] = None,
707
+ _request_timeout: Union[
708
+ None,
709
+ Annotated[StrictFloat, Field(gt=0)],
710
+ Tuple[
711
+ Annotated[StrictFloat, Field(gt=0)],
712
+ Annotated[StrictFloat, Field(gt=0)]
713
+ ]
714
+ ] = None,
715
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
716
+ _content_type: Optional[StrictStr] = None,
717
+ _headers: Optional[Dict[StrictStr, Any]] = None,
718
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
719
+ ) -> ApiResponse[GetAllCategories200Response]:
720
+ """Get all categories
721
+
722
+ Retrieve a list of all categories associated with the user's account.
723
+
724
+ :param format: If `nested`, returns top-level categories (either category groups or categories not part of a category group) in alphabetical order. Grouped categories are nested within the category group under the property `children`. A `flattened`, response is similar but it includes grouped categories at the top level.<br/><br/> Categories are sorted by their `order`. When `order` is null, they are listed in alphabetical order below other categories with an `order`.
725
+ :type format: str
726
+ :param is_group: If `false`, only categories not part of a category group are returned.<br> If `true`, only category groups are returned.<br> When set, the `format` parameter is ignored.
727
+ :type is_group: bool
728
+ :param _request_timeout: timeout setting for this request. If one
729
+ number provided, it will be total request
730
+ timeout. It can also be a pair (tuple) of
731
+ (connection, read) timeouts.
732
+ :type _request_timeout: int, tuple(int, int), optional
733
+ :param _request_auth: set to override the auth_settings for an a single
734
+ request; this effectively ignores the
735
+ authentication in the spec for a single request.
736
+ :type _request_auth: dict, optional
737
+ :param _content_type: force content-type for the request.
738
+ :type _content_type: str, Optional
739
+ :param _headers: set to override the headers for a single
740
+ request; this effectively ignores the headers
741
+ in the spec for a single request.
742
+ :type _headers: dict, optional
743
+ :param _host_index: set to override the host_index for a single
744
+ request; this effectively ignores the host_index
745
+ in the spec for a single request.
746
+ :type _host_index: int, optional
747
+ :return: Returns the result object.
748
+ """ # noqa: E501
749
+
750
+ _param = self._get_all_categories_serialize(
751
+ format=format,
752
+ is_group=is_group,
753
+ _request_auth=_request_auth,
754
+ _content_type=_content_type,
755
+ _headers=_headers,
756
+ _host_index=_host_index
757
+ )
758
+
759
+ _response_types_map: Dict[str, Optional[str]] = {
760
+ '200': "GetAllCategories200Response",
761
+ '400': "ErrorResponseObject",
762
+ '401': "ErrorResponseObject",
763
+ '429': "ErrorResponseObject",
764
+ '500': "ErrorResponseObject",
765
+ }
766
+ response_data = self.api_client.call_api(
767
+ *_param,
768
+ _request_timeout=_request_timeout
769
+ )
770
+ response_data.read()
771
+ return self.api_client.response_deserialize(
772
+ response_data=response_data,
773
+ response_types_map=_response_types_map,
774
+ )
775
+
776
+
777
+ @validate_call
778
+ def get_all_categories_without_preload_content(
779
+ self,
780
+ format: Annotated[Optional[StrictStr], Field(description="If `nested`, returns top-level categories (either category groups or categories not part of a category group) in alphabetical order. Grouped categories are nested within the category group under the property `children`. A `flattened`, response is similar but it includes grouped categories at the top level.<br/><br/> Categories are sorted by their `order`. When `order` is null, they are listed in alphabetical order below other categories with an `order`.")] = None,
781
+ is_group: Annotated[Optional[StrictBool], Field(description="If `false`, only categories not part of a category group are returned.<br> If `true`, only category groups are returned.<br> When set, the `format` parameter is ignored.")] = None,
782
+ _request_timeout: Union[
783
+ None,
784
+ Annotated[StrictFloat, Field(gt=0)],
785
+ Tuple[
786
+ Annotated[StrictFloat, Field(gt=0)],
787
+ Annotated[StrictFloat, Field(gt=0)]
788
+ ]
789
+ ] = None,
790
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
791
+ _content_type: Optional[StrictStr] = None,
792
+ _headers: Optional[Dict[StrictStr, Any]] = None,
793
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
794
+ ) -> RESTResponseType:
795
+ """Get all categories
796
+
797
+ Retrieve a list of all categories associated with the user's account.
798
+
799
+ :param format: If `nested`, returns top-level categories (either category groups or categories not part of a category group) in alphabetical order. Grouped categories are nested within the category group under the property `children`. A `flattened`, response is similar but it includes grouped categories at the top level.<br/><br/> Categories are sorted by their `order`. When `order` is null, they are listed in alphabetical order below other categories with an `order`.
800
+ :type format: str
801
+ :param is_group: If `false`, only categories not part of a category group are returned.<br> If `true`, only category groups are returned.<br> When set, the `format` parameter is ignored.
802
+ :type is_group: bool
803
+ :param _request_timeout: timeout setting for this request. If one
804
+ number provided, it will be total request
805
+ timeout. It can also be a pair (tuple) of
806
+ (connection, read) timeouts.
807
+ :type _request_timeout: int, tuple(int, int), optional
808
+ :param _request_auth: set to override the auth_settings for an a single
809
+ request; this effectively ignores the
810
+ authentication in the spec for a single request.
811
+ :type _request_auth: dict, optional
812
+ :param _content_type: force content-type for the request.
813
+ :type _content_type: str, Optional
814
+ :param _headers: set to override the headers for a single
815
+ request; this effectively ignores the headers
816
+ in the spec for a single request.
817
+ :type _headers: dict, optional
818
+ :param _host_index: set to override the host_index for a single
819
+ request; this effectively ignores the host_index
820
+ in the spec for a single request.
821
+ :type _host_index: int, optional
822
+ :return: Returns the result object.
823
+ """ # noqa: E501
824
+
825
+ _param = self._get_all_categories_serialize(
826
+ format=format,
827
+ is_group=is_group,
828
+ _request_auth=_request_auth,
829
+ _content_type=_content_type,
830
+ _headers=_headers,
831
+ _host_index=_host_index
832
+ )
833
+
834
+ _response_types_map: Dict[str, Optional[str]] = {
835
+ '200': "GetAllCategories200Response",
836
+ '400': "ErrorResponseObject",
837
+ '401': "ErrorResponseObject",
838
+ '429': "ErrorResponseObject",
839
+ '500': "ErrorResponseObject",
840
+ }
841
+ response_data = self.api_client.call_api(
842
+ *_param,
843
+ _request_timeout=_request_timeout
844
+ )
845
+ return response_data.response
846
+
847
+
848
+ def _get_all_categories_serialize(
849
+ self,
850
+ format,
851
+ is_group,
852
+ _request_auth,
853
+ _content_type,
854
+ _headers,
855
+ _host_index,
856
+ ) -> RequestSerialized:
857
+
858
+ _host = None
859
+
860
+ _collection_formats: Dict[str, str] = {
861
+ }
862
+
863
+ _path_params: Dict[str, str] = {}
864
+ _query_params: List[Tuple[str, str]] = []
865
+ _header_params: Dict[str, Optional[str]] = _headers or {}
866
+ _form_params: List[Tuple[str, str]] = []
867
+ _files: Dict[
868
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
869
+ ] = {}
870
+ _body_params: Optional[bytes] = None
871
+
872
+ # process the path parameters
873
+ # process the query parameters
874
+ if format is not None:
875
+
876
+ _query_params.append(('format', format))
877
+
878
+ if is_group is not None:
879
+
880
+ _query_params.append(('is_group', is_group))
881
+
882
+ # process the header parameters
883
+ # process the form parameters
884
+ # process the body parameter
885
+
886
+
887
+ # set the HTTP header `Accept`
888
+ if 'Accept' not in _header_params:
889
+ _header_params['Accept'] = self.api_client.select_header_accept(
890
+ [
891
+ 'application/json'
892
+ ]
893
+ )
894
+
895
+
896
+ # authentication setting
897
+ _auth_settings: List[str] = [
898
+ 'cookieAuth',
899
+ 'bearerSecurity'
900
+ ]
901
+
902
+ return self.api_client.param_serialize(
903
+ method='GET',
904
+ resource_path='/categories',
905
+ path_params=_path_params,
906
+ query_params=_query_params,
907
+ header_params=_header_params,
908
+ body=_body_params,
909
+ post_params=_form_params,
910
+ files=_files,
911
+ auth_settings=_auth_settings,
912
+ collection_formats=_collection_formats,
913
+ _host=_host,
914
+ _request_auth=_request_auth
915
+ )
916
+
917
+
918
+
919
+
920
+ @validate_call
921
+ def get_category_by_id(
922
+ self,
923
+ id: Annotated[StrictInt, Field(description="ID of the category to retrieve")],
924
+ _request_timeout: Union[
925
+ None,
926
+ Annotated[StrictFloat, Field(gt=0)],
927
+ Tuple[
928
+ Annotated[StrictFloat, Field(gt=0)],
929
+ Annotated[StrictFloat, Field(gt=0)]
930
+ ]
931
+ ] = None,
932
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
933
+ _content_type: Optional[StrictStr] = None,
934
+ _headers: Optional[Dict[StrictStr, Any]] = None,
935
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
936
+ ) -> CategoryObject:
937
+ """Get a single category
938
+
939
+ Retrieve details of a specific category or category group by its ID.
940
+
941
+ :param id: ID of the category to retrieve (required)
942
+ :type id: int
943
+ :param _request_timeout: timeout setting for this request. If one
944
+ number provided, it will be total request
945
+ timeout. It can also be a pair (tuple) of
946
+ (connection, read) timeouts.
947
+ :type _request_timeout: int, tuple(int, int), optional
948
+ :param _request_auth: set to override the auth_settings for an a single
949
+ request; this effectively ignores the
950
+ authentication in the spec for a single request.
951
+ :type _request_auth: dict, optional
952
+ :param _content_type: force content-type for the request.
953
+ :type _content_type: str, Optional
954
+ :param _headers: set to override the headers for a single
955
+ request; this effectively ignores the headers
956
+ in the spec for a single request.
957
+ :type _headers: dict, optional
958
+ :param _host_index: set to override the host_index for a single
959
+ request; this effectively ignores the host_index
960
+ in the spec for a single request.
961
+ :type _host_index: int, optional
962
+ :return: Returns the result object.
963
+ """ # noqa: E501
964
+
965
+ _param = self._get_category_by_id_serialize(
966
+ id=id,
967
+ _request_auth=_request_auth,
968
+ _content_type=_content_type,
969
+ _headers=_headers,
970
+ _host_index=_host_index
971
+ )
972
+
973
+ _response_types_map: Dict[str, Optional[str]] = {
974
+ '201': "CategoryObject",
975
+ '400': "ErrorResponseObject",
976
+ '401': "ErrorResponseObject",
977
+ '404': "ErrorResponseObject",
978
+ '429': "ErrorResponseObject",
979
+ '500': "ErrorResponseObject",
980
+ }
981
+ response_data = self.api_client.call_api(
982
+ *_param,
983
+ _request_timeout=_request_timeout
984
+ )
985
+ response_data.read()
986
+ return self.api_client.response_deserialize(
987
+ response_data=response_data,
988
+ response_types_map=_response_types_map,
989
+ ).data
990
+
991
+
992
+ @validate_call
993
+ def get_category_by_id_with_http_info(
994
+ self,
995
+ id: Annotated[StrictInt, Field(description="ID of the category to retrieve")],
996
+ _request_timeout: Union[
997
+ None,
998
+ Annotated[StrictFloat, Field(gt=0)],
999
+ Tuple[
1000
+ Annotated[StrictFloat, Field(gt=0)],
1001
+ Annotated[StrictFloat, Field(gt=0)]
1002
+ ]
1003
+ ] = None,
1004
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1005
+ _content_type: Optional[StrictStr] = None,
1006
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1007
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1008
+ ) -> ApiResponse[CategoryObject]:
1009
+ """Get a single category
1010
+
1011
+ Retrieve details of a specific category or category group by its ID.
1012
+
1013
+ :param id: ID of the category to retrieve (required)
1014
+ :type id: int
1015
+ :param _request_timeout: timeout setting for this request. If one
1016
+ number provided, it will be total request
1017
+ timeout. It can also be a pair (tuple) of
1018
+ (connection, read) timeouts.
1019
+ :type _request_timeout: int, tuple(int, int), optional
1020
+ :param _request_auth: set to override the auth_settings for an a single
1021
+ request; this effectively ignores the
1022
+ authentication in the spec for a single request.
1023
+ :type _request_auth: dict, optional
1024
+ :param _content_type: force content-type for the request.
1025
+ :type _content_type: str, Optional
1026
+ :param _headers: set to override the headers for a single
1027
+ request; this effectively ignores the headers
1028
+ in the spec for a single request.
1029
+ :type _headers: dict, optional
1030
+ :param _host_index: set to override the host_index for a single
1031
+ request; this effectively ignores the host_index
1032
+ in the spec for a single request.
1033
+ :type _host_index: int, optional
1034
+ :return: Returns the result object.
1035
+ """ # noqa: E501
1036
+
1037
+ _param = self._get_category_by_id_serialize(
1038
+ id=id,
1039
+ _request_auth=_request_auth,
1040
+ _content_type=_content_type,
1041
+ _headers=_headers,
1042
+ _host_index=_host_index
1043
+ )
1044
+
1045
+ _response_types_map: Dict[str, Optional[str]] = {
1046
+ '201': "CategoryObject",
1047
+ '400': "ErrorResponseObject",
1048
+ '401': "ErrorResponseObject",
1049
+ '404': "ErrorResponseObject",
1050
+ '429': "ErrorResponseObject",
1051
+ '500': "ErrorResponseObject",
1052
+ }
1053
+ response_data = self.api_client.call_api(
1054
+ *_param,
1055
+ _request_timeout=_request_timeout
1056
+ )
1057
+ response_data.read()
1058
+ return self.api_client.response_deserialize(
1059
+ response_data=response_data,
1060
+ response_types_map=_response_types_map,
1061
+ )
1062
+
1063
+
1064
+ @validate_call
1065
+ def get_category_by_id_without_preload_content(
1066
+ self,
1067
+ id: Annotated[StrictInt, Field(description="ID of the category to retrieve")],
1068
+ _request_timeout: Union[
1069
+ None,
1070
+ Annotated[StrictFloat, Field(gt=0)],
1071
+ Tuple[
1072
+ Annotated[StrictFloat, Field(gt=0)],
1073
+ Annotated[StrictFloat, Field(gt=0)]
1074
+ ]
1075
+ ] = None,
1076
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1077
+ _content_type: Optional[StrictStr] = None,
1078
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1079
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1080
+ ) -> RESTResponseType:
1081
+ """Get a single category
1082
+
1083
+ Retrieve details of a specific category or category group by its ID.
1084
+
1085
+ :param id: ID of the category to retrieve (required)
1086
+ :type id: int
1087
+ :param _request_timeout: timeout setting for this request. If one
1088
+ number provided, it will be total request
1089
+ timeout. It can also be a pair (tuple) of
1090
+ (connection, read) timeouts.
1091
+ :type _request_timeout: int, tuple(int, int), optional
1092
+ :param _request_auth: set to override the auth_settings for an a single
1093
+ request; this effectively ignores the
1094
+ authentication in the spec for a single request.
1095
+ :type _request_auth: dict, optional
1096
+ :param _content_type: force content-type for the request.
1097
+ :type _content_type: str, Optional
1098
+ :param _headers: set to override the headers for a single
1099
+ request; this effectively ignores the headers
1100
+ in the spec for a single request.
1101
+ :type _headers: dict, optional
1102
+ :param _host_index: set to override the host_index for a single
1103
+ request; this effectively ignores the host_index
1104
+ in the spec for a single request.
1105
+ :type _host_index: int, optional
1106
+ :return: Returns the result object.
1107
+ """ # noqa: E501
1108
+
1109
+ _param = self._get_category_by_id_serialize(
1110
+ id=id,
1111
+ _request_auth=_request_auth,
1112
+ _content_type=_content_type,
1113
+ _headers=_headers,
1114
+ _host_index=_host_index
1115
+ )
1116
+
1117
+ _response_types_map: Dict[str, Optional[str]] = {
1118
+ '201': "CategoryObject",
1119
+ '400': "ErrorResponseObject",
1120
+ '401': "ErrorResponseObject",
1121
+ '404': "ErrorResponseObject",
1122
+ '429': "ErrorResponseObject",
1123
+ '500': "ErrorResponseObject",
1124
+ }
1125
+ response_data = self.api_client.call_api(
1126
+ *_param,
1127
+ _request_timeout=_request_timeout
1128
+ )
1129
+ return response_data.response
1130
+
1131
+
1132
+ def _get_category_by_id_serialize(
1133
+ self,
1134
+ id,
1135
+ _request_auth,
1136
+ _content_type,
1137
+ _headers,
1138
+ _host_index,
1139
+ ) -> RequestSerialized:
1140
+
1141
+ _host = None
1142
+
1143
+ _collection_formats: Dict[str, str] = {
1144
+ }
1145
+
1146
+ _path_params: Dict[str, str] = {}
1147
+ _query_params: List[Tuple[str, str]] = []
1148
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1149
+ _form_params: List[Tuple[str, str]] = []
1150
+ _files: Dict[
1151
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1152
+ ] = {}
1153
+ _body_params: Optional[bytes] = None
1154
+
1155
+ # process the path parameters
1156
+ if id is not None:
1157
+ _path_params['id'] = id
1158
+ # process the query parameters
1159
+ # process the header parameters
1160
+ # process the form parameters
1161
+ # process the body parameter
1162
+
1163
+
1164
+ # set the HTTP header `Accept`
1165
+ if 'Accept' not in _header_params:
1166
+ _header_params['Accept'] = self.api_client.select_header_accept(
1167
+ [
1168
+ 'application/json'
1169
+ ]
1170
+ )
1171
+
1172
+
1173
+ # authentication setting
1174
+ _auth_settings: List[str] = [
1175
+ 'cookieAuth',
1176
+ 'bearerSecurity'
1177
+ ]
1178
+
1179
+ return self.api_client.param_serialize(
1180
+ method='GET',
1181
+ resource_path='/categories/{id}',
1182
+ path_params=_path_params,
1183
+ query_params=_query_params,
1184
+ header_params=_header_params,
1185
+ body=_body_params,
1186
+ post_params=_form_params,
1187
+ files=_files,
1188
+ auth_settings=_auth_settings,
1189
+ collection_formats=_collection_formats,
1190
+ _host=_host,
1191
+ _request_auth=_request_auth
1192
+ )
1193
+
1194
+
1195
+
1196
+
1197
+ @validate_call
1198
+ def update_category(
1199
+ self,
1200
+ id: Annotated[StrictInt, Field(description="ID of the category to update")],
1201
+ update_category_request_object: UpdateCategoryRequestObject,
1202
+ _request_timeout: Union[
1203
+ None,
1204
+ Annotated[StrictFloat, Field(gt=0)],
1205
+ Tuple[
1206
+ Annotated[StrictFloat, Field(gt=0)],
1207
+ Annotated[StrictFloat, Field(gt=0)]
1208
+ ]
1209
+ ] = None,
1210
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1211
+ _content_type: Optional[StrictStr] = None,
1212
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1213
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1214
+ ) -> CategoryObject:
1215
+ """Update an existing category or category group
1216
+
1217
+ Modifies the properties of an existing category or category group.<br><br> You may submit the response from a `GET /categories/{id}` as the request body; however, only certain properties can be updated using this API. The following properties are accepted in the request body but their values will be ignored: `id`, `is_group`,`archived_at`, `updated_at`, `created_at`, and `order`.<br><br> It is also possible to provide only the properties to be updated in the request body, as long as the request includes at least one of the properties that is not listed above. For example, a request body that contains only a `name` property is valid.<br><br> It is not possible to use this API to convert a category to a category group, or a vice versa, so while submitting a request body with the `is_group` property is tolerated, it will result in an error response if the value is changed.<br><br> It is possible to modify the children of an existing category group with this API by setting the `children` attribute. If this is set, it will replace the existing children with the newly specified children. If the intention is to add or remove a single category, it is more straightforward to update the child category by specifying the new `group_id` attribute. If the goal is to add multiple new children or remove multiple existing children, it is recommended to first call the `GET /categories/:id` endpoint to get the existing children and then modify the list as desired.<br><br>
1218
+
1219
+ :param id: ID of the category to update (required)
1220
+ :type id: int
1221
+ :param update_category_request_object: (required)
1222
+ :type update_category_request_object: UpdateCategoryRequestObject
1223
+ :param _request_timeout: timeout setting for this request. If one
1224
+ number provided, it will be total request
1225
+ timeout. It can also be a pair (tuple) of
1226
+ (connection, read) timeouts.
1227
+ :type _request_timeout: int, tuple(int, int), optional
1228
+ :param _request_auth: set to override the auth_settings for an a single
1229
+ request; this effectively ignores the
1230
+ authentication in the spec for a single request.
1231
+ :type _request_auth: dict, optional
1232
+ :param _content_type: force content-type for the request.
1233
+ :type _content_type: str, Optional
1234
+ :param _headers: set to override the headers for a single
1235
+ request; this effectively ignores the headers
1236
+ in the spec for a single request.
1237
+ :type _headers: dict, optional
1238
+ :param _host_index: set to override the host_index for a single
1239
+ request; this effectively ignores the host_index
1240
+ in the spec for a single request.
1241
+ :type _host_index: int, optional
1242
+ :return: Returns the result object.
1243
+ """ # noqa: E501
1244
+
1245
+ _param = self._update_category_serialize(
1246
+ id=id,
1247
+ update_category_request_object=update_category_request_object,
1248
+ _request_auth=_request_auth,
1249
+ _content_type=_content_type,
1250
+ _headers=_headers,
1251
+ _host_index=_host_index
1252
+ )
1253
+
1254
+ _response_types_map: Dict[str, Optional[str]] = {
1255
+ '200': "CategoryObject",
1256
+ '400': "ErrorResponseObject",
1257
+ '401': "ErrorResponseObject",
1258
+ '404': "ErrorResponseObject",
1259
+ '429': "ErrorResponseObject",
1260
+ '500': "ErrorResponseObject",
1261
+ }
1262
+ response_data = self.api_client.call_api(
1263
+ *_param,
1264
+ _request_timeout=_request_timeout
1265
+ )
1266
+ response_data.read()
1267
+ return self.api_client.response_deserialize(
1268
+ response_data=response_data,
1269
+ response_types_map=_response_types_map,
1270
+ ).data
1271
+
1272
+
1273
+ @validate_call
1274
+ def update_category_with_http_info(
1275
+ self,
1276
+ id: Annotated[StrictInt, Field(description="ID of the category to update")],
1277
+ update_category_request_object: UpdateCategoryRequestObject,
1278
+ _request_timeout: Union[
1279
+ None,
1280
+ Annotated[StrictFloat, Field(gt=0)],
1281
+ Tuple[
1282
+ Annotated[StrictFloat, Field(gt=0)],
1283
+ Annotated[StrictFloat, Field(gt=0)]
1284
+ ]
1285
+ ] = None,
1286
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1287
+ _content_type: Optional[StrictStr] = None,
1288
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1289
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1290
+ ) -> ApiResponse[CategoryObject]:
1291
+ """Update an existing category or category group
1292
+
1293
+ Modifies the properties of an existing category or category group.<br><br> You may submit the response from a `GET /categories/{id}` as the request body; however, only certain properties can be updated using this API. The following properties are accepted in the request body but their values will be ignored: `id`, `is_group`,`archived_at`, `updated_at`, `created_at`, and `order`.<br><br> It is also possible to provide only the properties to be updated in the request body, as long as the request includes at least one of the properties that is not listed above. For example, a request body that contains only a `name` property is valid.<br><br> It is not possible to use this API to convert a category to a category group, or a vice versa, so while submitting a request body with the `is_group` property is tolerated, it will result in an error response if the value is changed.<br><br> It is possible to modify the children of an existing category group with this API by setting the `children` attribute. If this is set, it will replace the existing children with the newly specified children. If the intention is to add or remove a single category, it is more straightforward to update the child category by specifying the new `group_id` attribute. If the goal is to add multiple new children or remove multiple existing children, it is recommended to first call the `GET /categories/:id` endpoint to get the existing children and then modify the list as desired.<br><br>
1294
+
1295
+ :param id: ID of the category to update (required)
1296
+ :type id: int
1297
+ :param update_category_request_object: (required)
1298
+ :type update_category_request_object: UpdateCategoryRequestObject
1299
+ :param _request_timeout: timeout setting for this request. If one
1300
+ number provided, it will be total request
1301
+ timeout. It can also be a pair (tuple) of
1302
+ (connection, read) timeouts.
1303
+ :type _request_timeout: int, tuple(int, int), optional
1304
+ :param _request_auth: set to override the auth_settings for an a single
1305
+ request; this effectively ignores the
1306
+ authentication in the spec for a single request.
1307
+ :type _request_auth: dict, optional
1308
+ :param _content_type: force content-type for the request.
1309
+ :type _content_type: str, Optional
1310
+ :param _headers: set to override the headers for a single
1311
+ request; this effectively ignores the headers
1312
+ in the spec for a single request.
1313
+ :type _headers: dict, optional
1314
+ :param _host_index: set to override the host_index for a single
1315
+ request; this effectively ignores the host_index
1316
+ in the spec for a single request.
1317
+ :type _host_index: int, optional
1318
+ :return: Returns the result object.
1319
+ """ # noqa: E501
1320
+
1321
+ _param = self._update_category_serialize(
1322
+ id=id,
1323
+ update_category_request_object=update_category_request_object,
1324
+ _request_auth=_request_auth,
1325
+ _content_type=_content_type,
1326
+ _headers=_headers,
1327
+ _host_index=_host_index
1328
+ )
1329
+
1330
+ _response_types_map: Dict[str, Optional[str]] = {
1331
+ '200': "CategoryObject",
1332
+ '400': "ErrorResponseObject",
1333
+ '401': "ErrorResponseObject",
1334
+ '404': "ErrorResponseObject",
1335
+ '429': "ErrorResponseObject",
1336
+ '500': "ErrorResponseObject",
1337
+ }
1338
+ response_data = self.api_client.call_api(
1339
+ *_param,
1340
+ _request_timeout=_request_timeout
1341
+ )
1342
+ response_data.read()
1343
+ return self.api_client.response_deserialize(
1344
+ response_data=response_data,
1345
+ response_types_map=_response_types_map,
1346
+ )
1347
+
1348
+
1349
+ @validate_call
1350
+ def update_category_without_preload_content(
1351
+ self,
1352
+ id: Annotated[StrictInt, Field(description="ID of the category to update")],
1353
+ update_category_request_object: UpdateCategoryRequestObject,
1354
+ _request_timeout: Union[
1355
+ None,
1356
+ Annotated[StrictFloat, Field(gt=0)],
1357
+ Tuple[
1358
+ Annotated[StrictFloat, Field(gt=0)],
1359
+ Annotated[StrictFloat, Field(gt=0)]
1360
+ ]
1361
+ ] = None,
1362
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1363
+ _content_type: Optional[StrictStr] = None,
1364
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1365
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1366
+ ) -> RESTResponseType:
1367
+ """Update an existing category or category group
1368
+
1369
+ Modifies the properties of an existing category or category group.<br><br> You may submit the response from a `GET /categories/{id}` as the request body; however, only certain properties can be updated using this API. The following properties are accepted in the request body but their values will be ignored: `id`, `is_group`,`archived_at`, `updated_at`, `created_at`, and `order`.<br><br> It is also possible to provide only the properties to be updated in the request body, as long as the request includes at least one of the properties that is not listed above. For example, a request body that contains only a `name` property is valid.<br><br> It is not possible to use this API to convert a category to a category group, or a vice versa, so while submitting a request body with the `is_group` property is tolerated, it will result in an error response if the value is changed.<br><br> It is possible to modify the children of an existing category group with this API by setting the `children` attribute. If this is set, it will replace the existing children with the newly specified children. If the intention is to add or remove a single category, it is more straightforward to update the child category by specifying the new `group_id` attribute. If the goal is to add multiple new children or remove multiple existing children, it is recommended to first call the `GET /categories/:id` endpoint to get the existing children and then modify the list as desired.<br><br>
1370
+
1371
+ :param id: ID of the category to update (required)
1372
+ :type id: int
1373
+ :param update_category_request_object: (required)
1374
+ :type update_category_request_object: UpdateCategoryRequestObject
1375
+ :param _request_timeout: timeout setting for this request. If one
1376
+ number provided, it will be total request
1377
+ timeout. It can also be a pair (tuple) of
1378
+ (connection, read) timeouts.
1379
+ :type _request_timeout: int, tuple(int, int), optional
1380
+ :param _request_auth: set to override the auth_settings for an a single
1381
+ request; this effectively ignores the
1382
+ authentication in the spec for a single request.
1383
+ :type _request_auth: dict, optional
1384
+ :param _content_type: force content-type for the request.
1385
+ :type _content_type: str, Optional
1386
+ :param _headers: set to override the headers for a single
1387
+ request; this effectively ignores the headers
1388
+ in the spec for a single request.
1389
+ :type _headers: dict, optional
1390
+ :param _host_index: set to override the host_index for a single
1391
+ request; this effectively ignores the host_index
1392
+ in the spec for a single request.
1393
+ :type _host_index: int, optional
1394
+ :return: Returns the result object.
1395
+ """ # noqa: E501
1396
+
1397
+ _param = self._update_category_serialize(
1398
+ id=id,
1399
+ update_category_request_object=update_category_request_object,
1400
+ _request_auth=_request_auth,
1401
+ _content_type=_content_type,
1402
+ _headers=_headers,
1403
+ _host_index=_host_index
1404
+ )
1405
+
1406
+ _response_types_map: Dict[str, Optional[str]] = {
1407
+ '200': "CategoryObject",
1408
+ '400': "ErrorResponseObject",
1409
+ '401': "ErrorResponseObject",
1410
+ '404': "ErrorResponseObject",
1411
+ '429': "ErrorResponseObject",
1412
+ '500': "ErrorResponseObject",
1413
+ }
1414
+ response_data = self.api_client.call_api(
1415
+ *_param,
1416
+ _request_timeout=_request_timeout
1417
+ )
1418
+ return response_data.response
1419
+
1420
+
1421
+ def _update_category_serialize(
1422
+ self,
1423
+ id,
1424
+ update_category_request_object,
1425
+ _request_auth,
1426
+ _content_type,
1427
+ _headers,
1428
+ _host_index,
1429
+ ) -> RequestSerialized:
1430
+
1431
+ _host = None
1432
+
1433
+ _collection_formats: Dict[str, str] = {
1434
+ }
1435
+
1436
+ _path_params: Dict[str, str] = {}
1437
+ _query_params: List[Tuple[str, str]] = []
1438
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1439
+ _form_params: List[Tuple[str, str]] = []
1440
+ _files: Dict[
1441
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1442
+ ] = {}
1443
+ _body_params: Optional[bytes] = None
1444
+
1445
+ # process the path parameters
1446
+ if id is not None:
1447
+ _path_params['id'] = id
1448
+ # process the query parameters
1449
+ # process the header parameters
1450
+ # process the form parameters
1451
+ # process the body parameter
1452
+ if update_category_request_object is not None:
1453
+ _body_params = update_category_request_object
1454
+
1455
+
1456
+ # set the HTTP header `Accept`
1457
+ if 'Accept' not in _header_params:
1458
+ _header_params['Accept'] = self.api_client.select_header_accept(
1459
+ [
1460
+ 'application/json'
1461
+ ]
1462
+ )
1463
+
1464
+ # set the HTTP header `Content-Type`
1465
+ if _content_type:
1466
+ _header_params['Content-Type'] = _content_type
1467
+ else:
1468
+ _default_content_type = (
1469
+ self.api_client.select_header_content_type(
1470
+ [
1471
+ 'application/json'
1472
+ ]
1473
+ )
1474
+ )
1475
+ if _default_content_type is not None:
1476
+ _header_params['Content-Type'] = _default_content_type
1477
+
1478
+ # authentication setting
1479
+ _auth_settings: List[str] = [
1480
+ 'cookieAuth',
1481
+ 'bearerSecurity'
1482
+ ]
1483
+
1484
+ return self.api_client.param_serialize(
1485
+ method='PUT',
1486
+ resource_path='/categories/{id}',
1487
+ path_params=_path_params,
1488
+ query_params=_query_params,
1489
+ header_params=_header_params,
1490
+ body=_body_params,
1491
+ post_params=_form_params,
1492
+ files=_files,
1493
+ auth_settings=_auth_settings,
1494
+ collection_formats=_collection_formats,
1495
+ _host=_host,
1496
+ _request_auth=_request_auth
1497
+ )
1498
+
1499
+