stract-api 0.1.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 (61) hide show
  1. stract_api/__init__.py +141 -0
  2. stract_api/api/__init__.py +16 -0
  3. stract_api/api/account_api.py +1098 -0
  4. stract_api/api/account_credit_ledger_api.py +286 -0
  5. stract_api/api/api_key_api.py +286 -0
  6. stract_api/api/catalog_api.py +837 -0
  7. stract_api/api/credits_api.py +534 -0
  8. stract_api/api/document_api.py +2799 -0
  9. stract_api/api/field_api.py +1168 -0
  10. stract_api/api/job_api.py +2857 -0
  11. stract_api/api/job_document_api.py +575 -0
  12. stract_api/api/llm_model_api.py +286 -0
  13. stract_api/api/struct_api.py +837 -0
  14. stract_api/api/user_api.py +572 -0
  15. stract_api/api_client.py +866 -0
  16. stract_api/api_response.py +21 -0
  17. stract_api/configuration.py +655 -0
  18. stract_api/exceptions.py +219 -0
  19. stract_api/models/__init__.py +52 -0
  20. stract_api/models/account.py +130 -0
  21. stract_api/models/account_credit_cache.py +112 -0
  22. stract_api/models/account_credit_ledger.py +125 -0
  23. stract_api/models/account_user.py +104 -0
  24. stract_api/models/account_user_role.py +38 -0
  25. stract_api/models/api_key.py +102 -0
  26. stract_api/models/catalog.py +100 -0
  27. stract_api/models/create_account_user_request.py +97 -0
  28. stract_api/models/create_catalog_request.py +90 -0
  29. stract_api/models/create_field_request.py +102 -0
  30. stract_api/models/create_job_request.py +109 -0
  31. stract_api/models/create_struct_request.py +90 -0
  32. stract_api/models/deleted_document.py +91 -0
  33. stract_api/models/deleted_field.py +91 -0
  34. stract_api/models/document.py +107 -0
  35. stract_api/models/document_link.py +90 -0
  36. stract_api/models/document_processing_status.py +39 -0
  37. stract_api/models/document_text.py +95 -0
  38. stract_api/models/edit_account_request.py +90 -0
  39. stract_api/models/edit_field_request.py +102 -0
  40. stract_api/models/edit_my_user_request.py +92 -0
  41. stract_api/models/field_type.py +42 -0
  42. stract_api/models/job.py +129 -0
  43. stract_api/models/job_document.py +123 -0
  44. stract_api/models/job_output.py +98 -0
  45. stract_api/models/job_output_record.py +103 -0
  46. stract_api/models/job_status.py +41 -0
  47. stract_api/models/llm_model.py +126 -0
  48. stract_api/models/login_request.py +92 -0
  49. stract_api/models/login_response.py +90 -0
  50. stract_api/models/model_field.py +110 -0
  51. stract_api/models/struct.py +100 -0
  52. stract_api/models/sync_text_job_request.py +118 -0
  53. stract_api/models/upload_text_document_request.py +93 -0
  54. stract_api/models/user.py +102 -0
  55. stract_api/py.typed +0 -0
  56. stract_api/rest.py +335 -0
  57. stract_api-0.1.0.dist-info/METADATA +266 -0
  58. stract_api-0.1.0.dist-info/RECORD +61 -0
  59. stract_api-0.1.0.dist-info/WHEEL +5 -0
  60. stract_api-0.1.0.dist-info/licenses/LICENSE +21 -0
  61. stract_api-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1098 @@
1
+ """
2
+ Stract API
3
+
4
+ Get structured output from unstructured inputs ## Machine authentication Programmatic access to the API is authenticated with an API key. Include the API key in every request as a bearer token in the `authorization` header: ``` authorization: bearer [apiKey] ``` ## SDKs Official SDKs are available for the following languages: - **Node (JavaScript / TypeScript)**: [`stract-api` on npm](https://www.npmjs.com/package/stract-api) - **Java (17+)**: [`com.stract-api:stract-api` on Maven Central](https://central.sonatype.com/artifact/com.stract-api/stract-api)
5
+
6
+ The version of the OpenAPI document: 0.9.4
7
+ Contact: matt@stract-api.com
8
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
9
+
10
+ Do not edit the class manually.
11
+ """ # noqa: E501
12
+
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from typing import List
20
+ from stract_api.models.account import Account
21
+ from stract_api.models.account_user import AccountUser
22
+ from stract_api.models.create_account_user_request import CreateAccountUserRequest
23
+ from stract_api.models.edit_account_request import EditAccountRequest
24
+
25
+ from stract_api.api_client import ApiClient, RequestSerialized
26
+ from stract_api.api_response import ApiResponse
27
+ from stract_api.rest import RESTResponseType
28
+
29
+
30
+ class AccountApi:
31
+ """NOTE: This class is auto generated by OpenAPI Generator
32
+ Ref: https://openapi-generator.tech
33
+
34
+ Do not edit the class manually.
35
+ """
36
+
37
+ def __init__(self, api_client=None) -> None:
38
+ if api_client is None:
39
+ api_client = ApiClient.get_default()
40
+ self.api_client = api_client
41
+
42
+
43
+ @validate_call
44
+ def create_account_user(
45
+ self,
46
+ create_account_user_request: CreateAccountUserRequest,
47
+ _request_timeout: Union[
48
+ None,
49
+ Annotated[StrictFloat, Field(gt=0)],
50
+ Tuple[
51
+ Annotated[StrictFloat, Field(gt=0)],
52
+ Annotated[StrictFloat, Field(gt=0)]
53
+ ]
54
+ ] = None,
55
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
56
+ _content_type: Optional[StrictStr] = None,
57
+ _headers: Optional[Dict[StrictStr, Any]] = None,
58
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
59
+ ) -> AccountUser:
60
+ """Add a user to the current account
61
+
62
+ Create a new user and add them to the current user's account. Only account admins may perform this action, and the account must have an active subscription to add other users. Accounts with a team subscription are limited to 10 users.
63
+
64
+ :param create_account_user_request: (required)
65
+ :type create_account_user_request: CreateAccountUserRequest
66
+ :param _request_timeout: timeout setting for this request. If one
67
+ number provided, it will be total request
68
+ timeout. It can also be a pair (tuple) of
69
+ (connection, read) timeouts.
70
+ :type _request_timeout: int, tuple(int, int), optional
71
+ :param _request_auth: set to override the auth_settings for an a single
72
+ request; this effectively ignores the
73
+ authentication in the spec for a single request.
74
+ :type _request_auth: dict, optional
75
+ :param _content_type: force content-type for the request.
76
+ :type _content_type: str, Optional
77
+ :param _headers: set to override the headers for a single
78
+ request; this effectively ignores the headers
79
+ in the spec for a single request.
80
+ :type _headers: dict, optional
81
+ :param _host_index: set to override the host_index for a single
82
+ request; this effectively ignores the host_index
83
+ in the spec for a single request.
84
+ :type _host_index: int, optional
85
+ :return: Returns the result object.
86
+ """ # noqa: E501
87
+
88
+ _param = self._create_account_user_serialize(
89
+ create_account_user_request=create_account_user_request,
90
+ _request_auth=_request_auth,
91
+ _content_type=_content_type,
92
+ _headers=_headers,
93
+ _host_index=_host_index
94
+ )
95
+
96
+ _response_types_map: Dict[str, Optional[str]] = {
97
+ '200': "AccountUser",
98
+ '400': "str",
99
+ '401': "str",
100
+ }
101
+ response_data = self.api_client.call_api(
102
+ *_param,
103
+ _request_timeout=_request_timeout
104
+ )
105
+ response_data.read()
106
+ return self.api_client.response_deserialize(
107
+ response_data=response_data,
108
+ response_types_map=_response_types_map,
109
+ ).data
110
+
111
+
112
+ @validate_call
113
+ def create_account_user_with_http_info(
114
+ self,
115
+ create_account_user_request: CreateAccountUserRequest,
116
+ _request_timeout: Union[
117
+ None,
118
+ Annotated[StrictFloat, Field(gt=0)],
119
+ Tuple[
120
+ Annotated[StrictFloat, Field(gt=0)],
121
+ Annotated[StrictFloat, Field(gt=0)]
122
+ ]
123
+ ] = None,
124
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
125
+ _content_type: Optional[StrictStr] = None,
126
+ _headers: Optional[Dict[StrictStr, Any]] = None,
127
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
128
+ ) -> ApiResponse[AccountUser]:
129
+ """Add a user to the current account
130
+
131
+ Create a new user and add them to the current user's account. Only account admins may perform this action, and the account must have an active subscription to add other users. Accounts with a team subscription are limited to 10 users.
132
+
133
+ :param create_account_user_request: (required)
134
+ :type create_account_user_request: CreateAccountUserRequest
135
+ :param _request_timeout: timeout setting for this request. If one
136
+ number provided, it will be total request
137
+ timeout. It can also be a pair (tuple) of
138
+ (connection, read) timeouts.
139
+ :type _request_timeout: int, tuple(int, int), optional
140
+ :param _request_auth: set to override the auth_settings for an a single
141
+ request; this effectively ignores the
142
+ authentication in the spec for a single request.
143
+ :type _request_auth: dict, optional
144
+ :param _content_type: force content-type for the request.
145
+ :type _content_type: str, Optional
146
+ :param _headers: set to override the headers for a single
147
+ request; this effectively ignores the headers
148
+ in the spec for a single request.
149
+ :type _headers: dict, optional
150
+ :param _host_index: set to override the host_index for a single
151
+ request; this effectively ignores the host_index
152
+ in the spec for a single request.
153
+ :type _host_index: int, optional
154
+ :return: Returns the result object.
155
+ """ # noqa: E501
156
+
157
+ _param = self._create_account_user_serialize(
158
+ create_account_user_request=create_account_user_request,
159
+ _request_auth=_request_auth,
160
+ _content_type=_content_type,
161
+ _headers=_headers,
162
+ _host_index=_host_index
163
+ )
164
+
165
+ _response_types_map: Dict[str, Optional[str]] = {
166
+ '200': "AccountUser",
167
+ '400': "str",
168
+ '401': "str",
169
+ }
170
+ response_data = self.api_client.call_api(
171
+ *_param,
172
+ _request_timeout=_request_timeout
173
+ )
174
+ response_data.read()
175
+ return self.api_client.response_deserialize(
176
+ response_data=response_data,
177
+ response_types_map=_response_types_map,
178
+ )
179
+
180
+
181
+ @validate_call
182
+ def create_account_user_without_preload_content(
183
+ self,
184
+ create_account_user_request: CreateAccountUserRequest,
185
+ _request_timeout: Union[
186
+ None,
187
+ Annotated[StrictFloat, Field(gt=0)],
188
+ Tuple[
189
+ Annotated[StrictFloat, Field(gt=0)],
190
+ Annotated[StrictFloat, Field(gt=0)]
191
+ ]
192
+ ] = None,
193
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
194
+ _content_type: Optional[StrictStr] = None,
195
+ _headers: Optional[Dict[StrictStr, Any]] = None,
196
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
197
+ ) -> RESTResponseType:
198
+ """Add a user to the current account
199
+
200
+ Create a new user and add them to the current user's account. Only account admins may perform this action, and the account must have an active subscription to add other users. Accounts with a team subscription are limited to 10 users.
201
+
202
+ :param create_account_user_request: (required)
203
+ :type create_account_user_request: CreateAccountUserRequest
204
+ :param _request_timeout: timeout setting for this request. If one
205
+ number provided, it will be total request
206
+ timeout. It can also be a pair (tuple) of
207
+ (connection, read) timeouts.
208
+ :type _request_timeout: int, tuple(int, int), optional
209
+ :param _request_auth: set to override the auth_settings for an a single
210
+ request; this effectively ignores the
211
+ authentication in the spec for a single request.
212
+ :type _request_auth: dict, optional
213
+ :param _content_type: force content-type for the request.
214
+ :type _content_type: str, Optional
215
+ :param _headers: set to override the headers for a single
216
+ request; this effectively ignores the headers
217
+ in the spec for a single request.
218
+ :type _headers: dict, optional
219
+ :param _host_index: set to override the host_index for a single
220
+ request; this effectively ignores the host_index
221
+ in the spec for a single request.
222
+ :type _host_index: int, optional
223
+ :return: Returns the result object.
224
+ """ # noqa: E501
225
+
226
+ _param = self._create_account_user_serialize(
227
+ create_account_user_request=create_account_user_request,
228
+ _request_auth=_request_auth,
229
+ _content_type=_content_type,
230
+ _headers=_headers,
231
+ _host_index=_host_index
232
+ )
233
+
234
+ _response_types_map: Dict[str, Optional[str]] = {
235
+ '200': "AccountUser",
236
+ '400': "str",
237
+ '401': "str",
238
+ }
239
+ response_data = self.api_client.call_api(
240
+ *_param,
241
+ _request_timeout=_request_timeout
242
+ )
243
+ return response_data.response
244
+
245
+
246
+ def _create_account_user_serialize(
247
+ self,
248
+ create_account_user_request,
249
+ _request_auth,
250
+ _content_type,
251
+ _headers,
252
+ _host_index,
253
+ ) -> RequestSerialized:
254
+
255
+ _host = None
256
+
257
+ _collection_formats: Dict[str, str] = {
258
+ }
259
+
260
+ _path_params: Dict[str, str] = {}
261
+ _query_params: List[Tuple[str, str]] = []
262
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
263
+ _form_params: List[Tuple[str, str]] = []
264
+ _files: Dict[
265
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
266
+ ] = {}
267
+ _body_params: Optional[bytes] = None
268
+
269
+ # process the path parameters
270
+ # process the query parameters
271
+ # process the header parameters
272
+ # process the form parameters
273
+ # process the body parameter
274
+ if create_account_user_request is not None:
275
+ _body_params = create_account_user_request
276
+
277
+
278
+ # set the HTTP header `Accept`
279
+ if not any(key.lower() == 'accept' for key in _header_params):
280
+ _header_params['Accept'] = self.api_client.select_header_accept(
281
+ [
282
+ 'application/json'
283
+ ]
284
+ )
285
+
286
+ # set the HTTP header `Content-Type`
287
+ if _content_type:
288
+ self.api_client._set_header(_header_params, 'Content-Type', _content_type)
289
+ else:
290
+ _default_content_type = (
291
+ self.api_client.select_header_content_type(
292
+ [
293
+ 'application/json'
294
+ ]
295
+ )
296
+ )
297
+ if _default_content_type is not None:
298
+ self.api_client._set_header(_header_params, 'Content-Type', _default_content_type)
299
+
300
+ # authentication setting
301
+ _auth_settings: List[str] = [
302
+ 'bearerAuth'
303
+ ]
304
+
305
+ return self.api_client.param_serialize(
306
+ method='POST',
307
+ resource_path='/account/user',
308
+ path_params=_path_params,
309
+ query_params=_query_params,
310
+ header_params=_header_params,
311
+ body=_body_params,
312
+ post_params=_form_params,
313
+ files=_files,
314
+ auth_settings=_auth_settings,
315
+ collection_formats=_collection_formats,
316
+ _host=_host,
317
+ _request_auth=_request_auth
318
+ )
319
+
320
+
321
+
322
+
323
+ @validate_call
324
+ def edit_account(
325
+ self,
326
+ edit_account_request: EditAccountRequest,
327
+ _request_timeout: Union[
328
+ None,
329
+ Annotated[StrictFloat, Field(gt=0)],
330
+ Tuple[
331
+ Annotated[StrictFloat, Field(gt=0)],
332
+ Annotated[StrictFloat, Field(gt=0)]
333
+ ]
334
+ ] = None,
335
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
336
+ _content_type: Optional[StrictStr] = None,
337
+ _headers: Optional[Dict[StrictStr, Any]] = None,
338
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
339
+ ) -> Account:
340
+ """Edit the current account
341
+
342
+ Update the account the current user belongs to. Only account admins may perform this action.
343
+
344
+ :param edit_account_request: (required)
345
+ :type edit_account_request: EditAccountRequest
346
+ :param _request_timeout: timeout setting for this request. If one
347
+ number provided, it will be total request
348
+ timeout. It can also be a pair (tuple) of
349
+ (connection, read) timeouts.
350
+ :type _request_timeout: int, tuple(int, int), optional
351
+ :param _request_auth: set to override the auth_settings for an a single
352
+ request; this effectively ignores the
353
+ authentication in the spec for a single request.
354
+ :type _request_auth: dict, optional
355
+ :param _content_type: force content-type for the request.
356
+ :type _content_type: str, Optional
357
+ :param _headers: set to override the headers for a single
358
+ request; this effectively ignores the headers
359
+ in the spec for a single request.
360
+ :type _headers: dict, optional
361
+ :param _host_index: set to override the host_index for a single
362
+ request; this effectively ignores the host_index
363
+ in the spec for a single request.
364
+ :type _host_index: int, optional
365
+ :return: Returns the result object.
366
+ """ # noqa: E501
367
+
368
+ _param = self._edit_account_serialize(
369
+ edit_account_request=edit_account_request,
370
+ _request_auth=_request_auth,
371
+ _content_type=_content_type,
372
+ _headers=_headers,
373
+ _host_index=_host_index
374
+ )
375
+
376
+ _response_types_map: Dict[str, Optional[str]] = {
377
+ '200': "Account",
378
+ '400': "str",
379
+ '401': "str",
380
+ }
381
+ response_data = self.api_client.call_api(
382
+ *_param,
383
+ _request_timeout=_request_timeout
384
+ )
385
+ response_data.read()
386
+ return self.api_client.response_deserialize(
387
+ response_data=response_data,
388
+ response_types_map=_response_types_map,
389
+ ).data
390
+
391
+
392
+ @validate_call
393
+ def edit_account_with_http_info(
394
+ self,
395
+ edit_account_request: EditAccountRequest,
396
+ _request_timeout: Union[
397
+ None,
398
+ Annotated[StrictFloat, Field(gt=0)],
399
+ Tuple[
400
+ Annotated[StrictFloat, Field(gt=0)],
401
+ Annotated[StrictFloat, Field(gt=0)]
402
+ ]
403
+ ] = None,
404
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
405
+ _content_type: Optional[StrictStr] = None,
406
+ _headers: Optional[Dict[StrictStr, Any]] = None,
407
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
408
+ ) -> ApiResponse[Account]:
409
+ """Edit the current account
410
+
411
+ Update the account the current user belongs to. Only account admins may perform this action.
412
+
413
+ :param edit_account_request: (required)
414
+ :type edit_account_request: EditAccountRequest
415
+ :param _request_timeout: timeout setting for this request. If one
416
+ number provided, it will be total request
417
+ timeout. It can also be a pair (tuple) of
418
+ (connection, read) timeouts.
419
+ :type _request_timeout: int, tuple(int, int), optional
420
+ :param _request_auth: set to override the auth_settings for an a single
421
+ request; this effectively ignores the
422
+ authentication in the spec for a single request.
423
+ :type _request_auth: dict, optional
424
+ :param _content_type: force content-type for the request.
425
+ :type _content_type: str, Optional
426
+ :param _headers: set to override the headers for a single
427
+ request; this effectively ignores the headers
428
+ in the spec for a single request.
429
+ :type _headers: dict, optional
430
+ :param _host_index: set to override the host_index for a single
431
+ request; this effectively ignores the host_index
432
+ in the spec for a single request.
433
+ :type _host_index: int, optional
434
+ :return: Returns the result object.
435
+ """ # noqa: E501
436
+
437
+ _param = self._edit_account_serialize(
438
+ edit_account_request=edit_account_request,
439
+ _request_auth=_request_auth,
440
+ _content_type=_content_type,
441
+ _headers=_headers,
442
+ _host_index=_host_index
443
+ )
444
+
445
+ _response_types_map: Dict[str, Optional[str]] = {
446
+ '200': "Account",
447
+ '400': "str",
448
+ '401': "str",
449
+ }
450
+ response_data = self.api_client.call_api(
451
+ *_param,
452
+ _request_timeout=_request_timeout
453
+ )
454
+ response_data.read()
455
+ return self.api_client.response_deserialize(
456
+ response_data=response_data,
457
+ response_types_map=_response_types_map,
458
+ )
459
+
460
+
461
+ @validate_call
462
+ def edit_account_without_preload_content(
463
+ self,
464
+ edit_account_request: EditAccountRequest,
465
+ _request_timeout: Union[
466
+ None,
467
+ Annotated[StrictFloat, Field(gt=0)],
468
+ Tuple[
469
+ Annotated[StrictFloat, Field(gt=0)],
470
+ Annotated[StrictFloat, Field(gt=0)]
471
+ ]
472
+ ] = None,
473
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
474
+ _content_type: Optional[StrictStr] = None,
475
+ _headers: Optional[Dict[StrictStr, Any]] = None,
476
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
477
+ ) -> RESTResponseType:
478
+ """Edit the current account
479
+
480
+ Update the account the current user belongs to. Only account admins may perform this action.
481
+
482
+ :param edit_account_request: (required)
483
+ :type edit_account_request: EditAccountRequest
484
+ :param _request_timeout: timeout setting for this request. If one
485
+ number provided, it will be total request
486
+ timeout. It can also be a pair (tuple) of
487
+ (connection, read) timeouts.
488
+ :type _request_timeout: int, tuple(int, int), optional
489
+ :param _request_auth: set to override the auth_settings for an a single
490
+ request; this effectively ignores the
491
+ authentication in the spec for a single request.
492
+ :type _request_auth: dict, optional
493
+ :param _content_type: force content-type for the request.
494
+ :type _content_type: str, Optional
495
+ :param _headers: set to override the headers for a single
496
+ request; this effectively ignores the headers
497
+ in the spec for a single request.
498
+ :type _headers: dict, optional
499
+ :param _host_index: set to override the host_index for a single
500
+ request; this effectively ignores the host_index
501
+ in the spec for a single request.
502
+ :type _host_index: int, optional
503
+ :return: Returns the result object.
504
+ """ # noqa: E501
505
+
506
+ _param = self._edit_account_serialize(
507
+ edit_account_request=edit_account_request,
508
+ _request_auth=_request_auth,
509
+ _content_type=_content_type,
510
+ _headers=_headers,
511
+ _host_index=_host_index
512
+ )
513
+
514
+ _response_types_map: Dict[str, Optional[str]] = {
515
+ '200': "Account",
516
+ '400': "str",
517
+ '401': "str",
518
+ }
519
+ response_data = self.api_client.call_api(
520
+ *_param,
521
+ _request_timeout=_request_timeout
522
+ )
523
+ return response_data.response
524
+
525
+
526
+ def _edit_account_serialize(
527
+ self,
528
+ edit_account_request,
529
+ _request_auth,
530
+ _content_type,
531
+ _headers,
532
+ _host_index,
533
+ ) -> RequestSerialized:
534
+
535
+ _host = None
536
+
537
+ _collection_formats: Dict[str, str] = {
538
+ }
539
+
540
+ _path_params: Dict[str, str] = {}
541
+ _query_params: List[Tuple[str, str]] = []
542
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
543
+ _form_params: List[Tuple[str, str]] = []
544
+ _files: Dict[
545
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
546
+ ] = {}
547
+ _body_params: Optional[bytes] = None
548
+
549
+ # process the path parameters
550
+ # process the query parameters
551
+ # process the header parameters
552
+ # process the form parameters
553
+ # process the body parameter
554
+ if edit_account_request is not None:
555
+ _body_params = edit_account_request
556
+
557
+
558
+ # set the HTTP header `Accept`
559
+ if not any(key.lower() == 'accept' for key in _header_params):
560
+ _header_params['Accept'] = self.api_client.select_header_accept(
561
+ [
562
+ 'application/json'
563
+ ]
564
+ )
565
+
566
+ # set the HTTP header `Content-Type`
567
+ if _content_type:
568
+ self.api_client._set_header(_header_params, 'Content-Type', _content_type)
569
+ else:
570
+ _default_content_type = (
571
+ self.api_client.select_header_content_type(
572
+ [
573
+ 'application/json'
574
+ ]
575
+ )
576
+ )
577
+ if _default_content_type is not None:
578
+ self.api_client._set_header(_header_params, 'Content-Type', _default_content_type)
579
+
580
+ # authentication setting
581
+ _auth_settings: List[str] = [
582
+ 'bearerAuth'
583
+ ]
584
+
585
+ return self.api_client.param_serialize(
586
+ method='PUT',
587
+ resource_path='/account',
588
+ path_params=_path_params,
589
+ query_params=_query_params,
590
+ header_params=_header_params,
591
+ body=_body_params,
592
+ post_params=_form_params,
593
+ files=_files,
594
+ auth_settings=_auth_settings,
595
+ collection_formats=_collection_formats,
596
+ _host=_host,
597
+ _request_auth=_request_auth
598
+ )
599
+
600
+
601
+
602
+
603
+ @validate_call
604
+ def get_account(
605
+ self,
606
+ _request_timeout: Union[
607
+ None,
608
+ Annotated[StrictFloat, Field(gt=0)],
609
+ Tuple[
610
+ Annotated[StrictFloat, Field(gt=0)],
611
+ Annotated[StrictFloat, Field(gt=0)]
612
+ ]
613
+ ] = None,
614
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
615
+ _content_type: Optional[StrictStr] = None,
616
+ _headers: Optional[Dict[StrictStr, Any]] = None,
617
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
618
+ ) -> Account:
619
+ """Get information about user's account
620
+
621
+ Retrieve information about the account the current user belongs to
622
+
623
+ :param _request_timeout: timeout setting for this request. If one
624
+ number provided, it will be total request
625
+ timeout. It can also be a pair (tuple) of
626
+ (connection, read) timeouts.
627
+ :type _request_timeout: int, tuple(int, int), optional
628
+ :param _request_auth: set to override the auth_settings for an a single
629
+ request; this effectively ignores the
630
+ authentication in the spec for a single request.
631
+ :type _request_auth: dict, optional
632
+ :param _content_type: force content-type for the request.
633
+ :type _content_type: str, Optional
634
+ :param _headers: set to override the headers for a single
635
+ request; this effectively ignores the headers
636
+ in the spec for a single request.
637
+ :type _headers: dict, optional
638
+ :param _host_index: set to override the host_index for a single
639
+ request; this effectively ignores the host_index
640
+ in the spec for a single request.
641
+ :type _host_index: int, optional
642
+ :return: Returns the result object.
643
+ """ # noqa: E501
644
+
645
+ _param = self._get_account_serialize(
646
+ _request_auth=_request_auth,
647
+ _content_type=_content_type,
648
+ _headers=_headers,
649
+ _host_index=_host_index
650
+ )
651
+
652
+ _response_types_map: Dict[str, Optional[str]] = {
653
+ '200': "Account",
654
+ '401': "str",
655
+ }
656
+ response_data = self.api_client.call_api(
657
+ *_param,
658
+ _request_timeout=_request_timeout
659
+ )
660
+ response_data.read()
661
+ return self.api_client.response_deserialize(
662
+ response_data=response_data,
663
+ response_types_map=_response_types_map,
664
+ ).data
665
+
666
+
667
+ @validate_call
668
+ def get_account_with_http_info(
669
+ self,
670
+ _request_timeout: Union[
671
+ None,
672
+ Annotated[StrictFloat, Field(gt=0)],
673
+ Tuple[
674
+ Annotated[StrictFloat, Field(gt=0)],
675
+ Annotated[StrictFloat, Field(gt=0)]
676
+ ]
677
+ ] = None,
678
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
679
+ _content_type: Optional[StrictStr] = None,
680
+ _headers: Optional[Dict[StrictStr, Any]] = None,
681
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
682
+ ) -> ApiResponse[Account]:
683
+ """Get information about user's account
684
+
685
+ Retrieve information about the account the current user belongs to
686
+
687
+ :param _request_timeout: timeout setting for this request. If one
688
+ number provided, it will be total request
689
+ timeout. It can also be a pair (tuple) of
690
+ (connection, read) timeouts.
691
+ :type _request_timeout: int, tuple(int, int), optional
692
+ :param _request_auth: set to override the auth_settings for an a single
693
+ request; this effectively ignores the
694
+ authentication in the spec for a single request.
695
+ :type _request_auth: dict, optional
696
+ :param _content_type: force content-type for the request.
697
+ :type _content_type: str, Optional
698
+ :param _headers: set to override the headers for a single
699
+ request; this effectively ignores the headers
700
+ in the spec for a single request.
701
+ :type _headers: dict, optional
702
+ :param _host_index: set to override the host_index for a single
703
+ request; this effectively ignores the host_index
704
+ in the spec for a single request.
705
+ :type _host_index: int, optional
706
+ :return: Returns the result object.
707
+ """ # noqa: E501
708
+
709
+ _param = self._get_account_serialize(
710
+ _request_auth=_request_auth,
711
+ _content_type=_content_type,
712
+ _headers=_headers,
713
+ _host_index=_host_index
714
+ )
715
+
716
+ _response_types_map: Dict[str, Optional[str]] = {
717
+ '200': "Account",
718
+ '401': "str",
719
+ }
720
+ response_data = self.api_client.call_api(
721
+ *_param,
722
+ _request_timeout=_request_timeout
723
+ )
724
+ response_data.read()
725
+ return self.api_client.response_deserialize(
726
+ response_data=response_data,
727
+ response_types_map=_response_types_map,
728
+ )
729
+
730
+
731
+ @validate_call
732
+ def get_account_without_preload_content(
733
+ self,
734
+ _request_timeout: Union[
735
+ None,
736
+ Annotated[StrictFloat, Field(gt=0)],
737
+ Tuple[
738
+ Annotated[StrictFloat, Field(gt=0)],
739
+ Annotated[StrictFloat, Field(gt=0)]
740
+ ]
741
+ ] = None,
742
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
743
+ _content_type: Optional[StrictStr] = None,
744
+ _headers: Optional[Dict[StrictStr, Any]] = None,
745
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
746
+ ) -> RESTResponseType:
747
+ """Get information about user's account
748
+
749
+ Retrieve information about the account the current user belongs to
750
+
751
+ :param _request_timeout: timeout setting for this request. If one
752
+ number provided, it will be total request
753
+ timeout. It can also be a pair (tuple) of
754
+ (connection, read) timeouts.
755
+ :type _request_timeout: int, tuple(int, int), optional
756
+ :param _request_auth: set to override the auth_settings for an a single
757
+ request; this effectively ignores the
758
+ authentication in the spec for a single request.
759
+ :type _request_auth: dict, optional
760
+ :param _content_type: force content-type for the request.
761
+ :type _content_type: str, Optional
762
+ :param _headers: set to override the headers for a single
763
+ request; this effectively ignores the headers
764
+ in the spec for a single request.
765
+ :type _headers: dict, optional
766
+ :param _host_index: set to override the host_index for a single
767
+ request; this effectively ignores the host_index
768
+ in the spec for a single request.
769
+ :type _host_index: int, optional
770
+ :return: Returns the result object.
771
+ """ # noqa: E501
772
+
773
+ _param = self._get_account_serialize(
774
+ _request_auth=_request_auth,
775
+ _content_type=_content_type,
776
+ _headers=_headers,
777
+ _host_index=_host_index
778
+ )
779
+
780
+ _response_types_map: Dict[str, Optional[str]] = {
781
+ '200': "Account",
782
+ '401': "str",
783
+ }
784
+ response_data = self.api_client.call_api(
785
+ *_param,
786
+ _request_timeout=_request_timeout
787
+ )
788
+ return response_data.response
789
+
790
+
791
+ def _get_account_serialize(
792
+ self,
793
+ _request_auth,
794
+ _content_type,
795
+ _headers,
796
+ _host_index,
797
+ ) -> RequestSerialized:
798
+
799
+ _host = None
800
+
801
+ _collection_formats: Dict[str, str] = {
802
+ }
803
+
804
+ _path_params: Dict[str, str] = {}
805
+ _query_params: List[Tuple[str, str]] = []
806
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
807
+ _form_params: List[Tuple[str, str]] = []
808
+ _files: Dict[
809
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
810
+ ] = {}
811
+ _body_params: Optional[bytes] = None
812
+
813
+ # process the path parameters
814
+ # process the query parameters
815
+ # process the header parameters
816
+ # process the form parameters
817
+ # process the body parameter
818
+
819
+
820
+ # set the HTTP header `Accept`
821
+ if not any(key.lower() == 'accept' for key in _header_params):
822
+ _header_params['Accept'] = self.api_client.select_header_accept(
823
+ [
824
+ 'application/json'
825
+ ]
826
+ )
827
+
828
+
829
+ # authentication setting
830
+ _auth_settings: List[str] = [
831
+ 'bearerAuth'
832
+ ]
833
+
834
+ return self.api_client.param_serialize(
835
+ method='GET',
836
+ resource_path='/account',
837
+ path_params=_path_params,
838
+ query_params=_query_params,
839
+ header_params=_header_params,
840
+ body=_body_params,
841
+ post_params=_form_params,
842
+ files=_files,
843
+ auth_settings=_auth_settings,
844
+ collection_formats=_collection_formats,
845
+ _host=_host,
846
+ _request_auth=_request_auth
847
+ )
848
+
849
+
850
+
851
+
852
+ @validate_call
853
+ def get_account_users(
854
+ self,
855
+ _request_timeout: Union[
856
+ None,
857
+ Annotated[StrictFloat, Field(gt=0)],
858
+ Tuple[
859
+ Annotated[StrictFloat, Field(gt=0)],
860
+ Annotated[StrictFloat, Field(gt=0)]
861
+ ]
862
+ ] = None,
863
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
864
+ _content_type: Optional[StrictStr] = None,
865
+ _headers: Optional[Dict[StrictStr, Any]] = None,
866
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
867
+ ) -> List[AccountUser]:
868
+ """Get the users in the current account
869
+
870
+ Retrieve all users belonging to the current user's account. Only account admins may perform this action.
871
+
872
+ :param _request_timeout: timeout setting for this request. If one
873
+ number provided, it will be total request
874
+ timeout. It can also be a pair (tuple) of
875
+ (connection, read) timeouts.
876
+ :type _request_timeout: int, tuple(int, int), optional
877
+ :param _request_auth: set to override the auth_settings for an a single
878
+ request; this effectively ignores the
879
+ authentication in the spec for a single request.
880
+ :type _request_auth: dict, optional
881
+ :param _content_type: force content-type for the request.
882
+ :type _content_type: str, Optional
883
+ :param _headers: set to override the headers for a single
884
+ request; this effectively ignores the headers
885
+ in the spec for a single request.
886
+ :type _headers: dict, optional
887
+ :param _host_index: set to override the host_index for a single
888
+ request; this effectively ignores the host_index
889
+ in the spec for a single request.
890
+ :type _host_index: int, optional
891
+ :return: Returns the result object.
892
+ """ # noqa: E501
893
+
894
+ _param = self._get_account_users_serialize(
895
+ _request_auth=_request_auth,
896
+ _content_type=_content_type,
897
+ _headers=_headers,
898
+ _host_index=_host_index
899
+ )
900
+
901
+ _response_types_map: Dict[str, Optional[str]] = {
902
+ '200': "List[AccountUser]",
903
+ '401': "str",
904
+ }
905
+ response_data = self.api_client.call_api(
906
+ *_param,
907
+ _request_timeout=_request_timeout
908
+ )
909
+ response_data.read()
910
+ return self.api_client.response_deserialize(
911
+ response_data=response_data,
912
+ response_types_map=_response_types_map,
913
+ ).data
914
+
915
+
916
+ @validate_call
917
+ def get_account_users_with_http_info(
918
+ self,
919
+ _request_timeout: Union[
920
+ None,
921
+ Annotated[StrictFloat, Field(gt=0)],
922
+ Tuple[
923
+ Annotated[StrictFloat, Field(gt=0)],
924
+ Annotated[StrictFloat, Field(gt=0)]
925
+ ]
926
+ ] = None,
927
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
928
+ _content_type: Optional[StrictStr] = None,
929
+ _headers: Optional[Dict[StrictStr, Any]] = None,
930
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
931
+ ) -> ApiResponse[List[AccountUser]]:
932
+ """Get the users in the current account
933
+
934
+ Retrieve all users belonging to the current user's account. Only account admins may perform this action.
935
+
936
+ :param _request_timeout: timeout setting for this request. If one
937
+ number provided, it will be total request
938
+ timeout. It can also be a pair (tuple) of
939
+ (connection, read) timeouts.
940
+ :type _request_timeout: int, tuple(int, int), optional
941
+ :param _request_auth: set to override the auth_settings for an a single
942
+ request; this effectively ignores the
943
+ authentication in the spec for a single request.
944
+ :type _request_auth: dict, optional
945
+ :param _content_type: force content-type for the request.
946
+ :type _content_type: str, Optional
947
+ :param _headers: set to override the headers for a single
948
+ request; this effectively ignores the headers
949
+ in the spec for a single request.
950
+ :type _headers: dict, optional
951
+ :param _host_index: set to override the host_index for a single
952
+ request; this effectively ignores the host_index
953
+ in the spec for a single request.
954
+ :type _host_index: int, optional
955
+ :return: Returns the result object.
956
+ """ # noqa: E501
957
+
958
+ _param = self._get_account_users_serialize(
959
+ _request_auth=_request_auth,
960
+ _content_type=_content_type,
961
+ _headers=_headers,
962
+ _host_index=_host_index
963
+ )
964
+
965
+ _response_types_map: Dict[str, Optional[str]] = {
966
+ '200': "List[AccountUser]",
967
+ '401': "str",
968
+ }
969
+ response_data = self.api_client.call_api(
970
+ *_param,
971
+ _request_timeout=_request_timeout
972
+ )
973
+ response_data.read()
974
+ return self.api_client.response_deserialize(
975
+ response_data=response_data,
976
+ response_types_map=_response_types_map,
977
+ )
978
+
979
+
980
+ @validate_call
981
+ def get_account_users_without_preload_content(
982
+ self,
983
+ _request_timeout: Union[
984
+ None,
985
+ Annotated[StrictFloat, Field(gt=0)],
986
+ Tuple[
987
+ Annotated[StrictFloat, Field(gt=0)],
988
+ Annotated[StrictFloat, Field(gt=0)]
989
+ ]
990
+ ] = None,
991
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
992
+ _content_type: Optional[StrictStr] = None,
993
+ _headers: Optional[Dict[StrictStr, Any]] = None,
994
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
995
+ ) -> RESTResponseType:
996
+ """Get the users in the current account
997
+
998
+ Retrieve all users belonging to the current user's account. Only account admins may perform this action.
999
+
1000
+ :param _request_timeout: timeout setting for this request. If one
1001
+ number provided, it will be total request
1002
+ timeout. It can also be a pair (tuple) of
1003
+ (connection, read) timeouts.
1004
+ :type _request_timeout: int, tuple(int, int), optional
1005
+ :param _request_auth: set to override the auth_settings for an a single
1006
+ request; this effectively ignores the
1007
+ authentication in the spec for a single request.
1008
+ :type _request_auth: dict, optional
1009
+ :param _content_type: force content-type for the request.
1010
+ :type _content_type: str, Optional
1011
+ :param _headers: set to override the headers for a single
1012
+ request; this effectively ignores the headers
1013
+ in the spec for a single request.
1014
+ :type _headers: dict, optional
1015
+ :param _host_index: set to override the host_index for a single
1016
+ request; this effectively ignores the host_index
1017
+ in the spec for a single request.
1018
+ :type _host_index: int, optional
1019
+ :return: Returns the result object.
1020
+ """ # noqa: E501
1021
+
1022
+ _param = self._get_account_users_serialize(
1023
+ _request_auth=_request_auth,
1024
+ _content_type=_content_type,
1025
+ _headers=_headers,
1026
+ _host_index=_host_index
1027
+ )
1028
+
1029
+ _response_types_map: Dict[str, Optional[str]] = {
1030
+ '200': "List[AccountUser]",
1031
+ '401': "str",
1032
+ }
1033
+ response_data = self.api_client.call_api(
1034
+ *_param,
1035
+ _request_timeout=_request_timeout
1036
+ )
1037
+ return response_data.response
1038
+
1039
+
1040
+ def _get_account_users_serialize(
1041
+ self,
1042
+ _request_auth,
1043
+ _content_type,
1044
+ _headers,
1045
+ _host_index,
1046
+ ) -> RequestSerialized:
1047
+
1048
+ _host = None
1049
+
1050
+ _collection_formats: Dict[str, str] = {
1051
+ }
1052
+
1053
+ _path_params: Dict[str, str] = {}
1054
+ _query_params: List[Tuple[str, str]] = []
1055
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
1056
+ _form_params: List[Tuple[str, str]] = []
1057
+ _files: Dict[
1058
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1059
+ ] = {}
1060
+ _body_params: Optional[bytes] = None
1061
+
1062
+ # process the path parameters
1063
+ # process the query parameters
1064
+ # process the header parameters
1065
+ # process the form parameters
1066
+ # process the body parameter
1067
+
1068
+
1069
+ # set the HTTP header `Accept`
1070
+ if not any(key.lower() == 'accept' for key in _header_params):
1071
+ _header_params['Accept'] = self.api_client.select_header_accept(
1072
+ [
1073
+ 'application/json'
1074
+ ]
1075
+ )
1076
+
1077
+
1078
+ # authentication setting
1079
+ _auth_settings: List[str] = [
1080
+ 'bearerAuth'
1081
+ ]
1082
+
1083
+ return self.api_client.param_serialize(
1084
+ method='GET',
1085
+ resource_path='/account/user',
1086
+ path_params=_path_params,
1087
+ query_params=_query_params,
1088
+ header_params=_header_params,
1089
+ body=_body_params,
1090
+ post_params=_form_params,
1091
+ files=_files,
1092
+ auth_settings=_auth_settings,
1093
+ collection_formats=_collection_formats,
1094
+ _host=_host,
1095
+ _request_auth=_request_auth
1096
+ )
1097
+
1098
+