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,2799 @@
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 pydantic import Field, StrictBytes, StrictStr
20
+ from typing import List, Tuple, Union
21
+ from typing_extensions import Annotated
22
+ from uuid import UUID
23
+ from stract_api.models.deleted_document import DeletedDocument
24
+ from stract_api.models.document import Document
25
+ from stract_api.models.document_link import DocumentLink
26
+ from stract_api.models.document_text import DocumentText
27
+ from stract_api.models.upload_text_document_request import UploadTextDocumentRequest
28
+
29
+ from stract_api.api_client import ApiClient, RequestSerialized
30
+ from stract_api.api_response import ApiResponse
31
+ from stract_api.rest import RESTResponseType
32
+
33
+
34
+ class DocumentApi:
35
+ """NOTE: This class is auto generated by OpenAPI Generator
36
+ Ref: https://openapi-generator.tech
37
+
38
+ Do not edit the class manually.
39
+ """
40
+
41
+ def __init__(self, api_client=None) -> None:
42
+ if api_client is None:
43
+ api_client = ApiClient.get_default()
44
+ self.api_client = api_client
45
+
46
+
47
+ @validate_call
48
+ def delete_document(
49
+ self,
50
+ document_id: Annotated[UUID, Field(description="Unique identifier of the document")],
51
+ _request_timeout: Union[
52
+ None,
53
+ Annotated[StrictFloat, Field(gt=0)],
54
+ Tuple[
55
+ Annotated[StrictFloat, Field(gt=0)],
56
+ Annotated[StrictFloat, Field(gt=0)]
57
+ ]
58
+ ] = None,
59
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
60
+ _content_type: Optional[StrictStr] = None,
61
+ _headers: Optional[Dict[StrictStr, Any]] = None,
62
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
63
+ ) -> DeletedDocument:
64
+ """Delete a document
65
+
66
+ Deletes the specified document and its stored file. The document is also removed from any jobs it was part of, along with its associated processing details.
67
+
68
+ :param document_id: Unique identifier of the document (required)
69
+ :type document_id: UUID
70
+ :param _request_timeout: timeout setting for this request. If one
71
+ number provided, it will be total request
72
+ timeout. It can also be a pair (tuple) of
73
+ (connection, read) timeouts.
74
+ :type _request_timeout: int, tuple(int, int), optional
75
+ :param _request_auth: set to override the auth_settings for an a single
76
+ request; this effectively ignores the
77
+ authentication in the spec for a single request.
78
+ :type _request_auth: dict, optional
79
+ :param _content_type: force content-type for the request.
80
+ :type _content_type: str, Optional
81
+ :param _headers: set to override the headers for a single
82
+ request; this effectively ignores the headers
83
+ in the spec for a single request.
84
+ :type _headers: dict, optional
85
+ :param _host_index: set to override the host_index for a single
86
+ request; this effectively ignores the host_index
87
+ in the spec for a single request.
88
+ :type _host_index: int, optional
89
+ :return: Returns the result object.
90
+ """ # noqa: E501
91
+
92
+ _param = self._delete_document_serialize(
93
+ document_id=document_id,
94
+ _request_auth=_request_auth,
95
+ _content_type=_content_type,
96
+ _headers=_headers,
97
+ _host_index=_host_index
98
+ )
99
+
100
+ _response_types_map: Dict[str, Optional[str]] = {
101
+ '200': "DeletedDocument",
102
+ '400': "str",
103
+ '401': "str",
104
+ }
105
+ response_data = self.api_client.call_api(
106
+ *_param,
107
+ _request_timeout=_request_timeout
108
+ )
109
+ response_data.read()
110
+ return self.api_client.response_deserialize(
111
+ response_data=response_data,
112
+ response_types_map=_response_types_map,
113
+ ).data
114
+
115
+
116
+ @validate_call
117
+ def delete_document_with_http_info(
118
+ self,
119
+ document_id: Annotated[UUID, Field(description="Unique identifier of the document")],
120
+ _request_timeout: Union[
121
+ None,
122
+ Annotated[StrictFloat, Field(gt=0)],
123
+ Tuple[
124
+ Annotated[StrictFloat, Field(gt=0)],
125
+ Annotated[StrictFloat, Field(gt=0)]
126
+ ]
127
+ ] = None,
128
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
129
+ _content_type: Optional[StrictStr] = None,
130
+ _headers: Optional[Dict[StrictStr, Any]] = None,
131
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
132
+ ) -> ApiResponse[DeletedDocument]:
133
+ """Delete a document
134
+
135
+ Deletes the specified document and its stored file. The document is also removed from any jobs it was part of, along with its associated processing details.
136
+
137
+ :param document_id: Unique identifier of the document (required)
138
+ :type document_id: UUID
139
+ :param _request_timeout: timeout setting for this request. If one
140
+ number provided, it will be total request
141
+ timeout. It can also be a pair (tuple) of
142
+ (connection, read) timeouts.
143
+ :type _request_timeout: int, tuple(int, int), optional
144
+ :param _request_auth: set to override the auth_settings for an a single
145
+ request; this effectively ignores the
146
+ authentication in the spec for a single request.
147
+ :type _request_auth: dict, optional
148
+ :param _content_type: force content-type for the request.
149
+ :type _content_type: str, Optional
150
+ :param _headers: set to override the headers for a single
151
+ request; this effectively ignores the headers
152
+ in the spec for a single request.
153
+ :type _headers: dict, optional
154
+ :param _host_index: set to override the host_index for a single
155
+ request; this effectively ignores the host_index
156
+ in the spec for a single request.
157
+ :type _host_index: int, optional
158
+ :return: Returns the result object.
159
+ """ # noqa: E501
160
+
161
+ _param = self._delete_document_serialize(
162
+ document_id=document_id,
163
+ _request_auth=_request_auth,
164
+ _content_type=_content_type,
165
+ _headers=_headers,
166
+ _host_index=_host_index
167
+ )
168
+
169
+ _response_types_map: Dict[str, Optional[str]] = {
170
+ '200': "DeletedDocument",
171
+ '400': "str",
172
+ '401': "str",
173
+ }
174
+ response_data = self.api_client.call_api(
175
+ *_param,
176
+ _request_timeout=_request_timeout
177
+ )
178
+ response_data.read()
179
+ return self.api_client.response_deserialize(
180
+ response_data=response_data,
181
+ response_types_map=_response_types_map,
182
+ )
183
+
184
+
185
+ @validate_call
186
+ def delete_document_without_preload_content(
187
+ self,
188
+ document_id: Annotated[UUID, Field(description="Unique identifier of the document")],
189
+ _request_timeout: Union[
190
+ None,
191
+ Annotated[StrictFloat, Field(gt=0)],
192
+ Tuple[
193
+ Annotated[StrictFloat, Field(gt=0)],
194
+ Annotated[StrictFloat, Field(gt=0)]
195
+ ]
196
+ ] = None,
197
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
198
+ _content_type: Optional[StrictStr] = None,
199
+ _headers: Optional[Dict[StrictStr, Any]] = None,
200
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
201
+ ) -> RESTResponseType:
202
+ """Delete a document
203
+
204
+ Deletes the specified document and its stored file. The document is also removed from any jobs it was part of, along with its associated processing details.
205
+
206
+ :param document_id: Unique identifier of the document (required)
207
+ :type document_id: UUID
208
+ :param _request_timeout: timeout setting for this request. If one
209
+ number provided, it will be total request
210
+ timeout. It can also be a pair (tuple) of
211
+ (connection, read) timeouts.
212
+ :type _request_timeout: int, tuple(int, int), optional
213
+ :param _request_auth: set to override the auth_settings for an a single
214
+ request; this effectively ignores the
215
+ authentication in the spec for a single request.
216
+ :type _request_auth: dict, optional
217
+ :param _content_type: force content-type for the request.
218
+ :type _content_type: str, Optional
219
+ :param _headers: set to override the headers for a single
220
+ request; this effectively ignores the headers
221
+ in the spec for a single request.
222
+ :type _headers: dict, optional
223
+ :param _host_index: set to override the host_index for a single
224
+ request; this effectively ignores the host_index
225
+ in the spec for a single request.
226
+ :type _host_index: int, optional
227
+ :return: Returns the result object.
228
+ """ # noqa: E501
229
+
230
+ _param = self._delete_document_serialize(
231
+ document_id=document_id,
232
+ _request_auth=_request_auth,
233
+ _content_type=_content_type,
234
+ _headers=_headers,
235
+ _host_index=_host_index
236
+ )
237
+
238
+ _response_types_map: Dict[str, Optional[str]] = {
239
+ '200': "DeletedDocument",
240
+ '400': "str",
241
+ '401': "str",
242
+ }
243
+ response_data = self.api_client.call_api(
244
+ *_param,
245
+ _request_timeout=_request_timeout
246
+ )
247
+ return response_data.response
248
+
249
+
250
+ def _delete_document_serialize(
251
+ self,
252
+ document_id,
253
+ _request_auth,
254
+ _content_type,
255
+ _headers,
256
+ _host_index,
257
+ ) -> RequestSerialized:
258
+
259
+ _host = None
260
+
261
+ _collection_formats: Dict[str, str] = {
262
+ }
263
+
264
+ _path_params: Dict[str, str] = {}
265
+ _query_params: List[Tuple[str, str]] = []
266
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
267
+ _form_params: List[Tuple[str, str]] = []
268
+ _files: Dict[
269
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
270
+ ] = {}
271
+ _body_params: Optional[bytes] = None
272
+
273
+ # process the path parameters
274
+ if document_id is not None:
275
+ _path_params['documentId'] = document_id
276
+ # process the query parameters
277
+ # process the header parameters
278
+ # process the form parameters
279
+ # process the body parameter
280
+
281
+
282
+ # set the HTTP header `Accept`
283
+ if not any(key.lower() == 'accept' for key in _header_params):
284
+ _header_params['Accept'] = self.api_client.select_header_accept(
285
+ [
286
+ 'application/json'
287
+ ]
288
+ )
289
+
290
+
291
+ # authentication setting
292
+ _auth_settings: List[str] = [
293
+ 'bearerAuth'
294
+ ]
295
+
296
+ return self.api_client.param_serialize(
297
+ method='DELETE',
298
+ resource_path='/document/{documentId}',
299
+ path_params=_path_params,
300
+ query_params=_query_params,
301
+ header_params=_header_params,
302
+ body=_body_params,
303
+ post_params=_form_params,
304
+ files=_files,
305
+ auth_settings=_auth_settings,
306
+ collection_formats=_collection_formats,
307
+ _host=_host,
308
+ _request_auth=_request_auth
309
+ )
310
+
311
+
312
+
313
+
314
+ @validate_call
315
+ def get_catalog_documents(
316
+ self,
317
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
318
+ _request_timeout: Union[
319
+ None,
320
+ Annotated[StrictFloat, Field(gt=0)],
321
+ Tuple[
322
+ Annotated[StrictFloat, Field(gt=0)],
323
+ Annotated[StrictFloat, Field(gt=0)]
324
+ ]
325
+ ] = None,
326
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
327
+ _content_type: Optional[StrictStr] = None,
328
+ _headers: Optional[Dict[StrictStr, Any]] = None,
329
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
330
+ ) -> List[Document]:
331
+ """Get documents for a catalog
332
+
333
+ Retrieve all documents belonging to the specified catalog
334
+
335
+ :param catalog_id: Unique identifier of the catalog (required)
336
+ :type catalog_id: UUID
337
+ :param _request_timeout: timeout setting for this request. If one
338
+ number provided, it will be total request
339
+ timeout. It can also be a pair (tuple) of
340
+ (connection, read) timeouts.
341
+ :type _request_timeout: int, tuple(int, int), optional
342
+ :param _request_auth: set to override the auth_settings for an a single
343
+ request; this effectively ignores the
344
+ authentication in the spec for a single request.
345
+ :type _request_auth: dict, optional
346
+ :param _content_type: force content-type for the request.
347
+ :type _content_type: str, Optional
348
+ :param _headers: set to override the headers for a single
349
+ request; this effectively ignores the headers
350
+ in the spec for a single request.
351
+ :type _headers: dict, optional
352
+ :param _host_index: set to override the host_index for a single
353
+ request; this effectively ignores the host_index
354
+ in the spec for a single request.
355
+ :type _host_index: int, optional
356
+ :return: Returns the result object.
357
+ """ # noqa: E501
358
+
359
+ _param = self._get_catalog_documents_serialize(
360
+ catalog_id=catalog_id,
361
+ _request_auth=_request_auth,
362
+ _content_type=_content_type,
363
+ _headers=_headers,
364
+ _host_index=_host_index
365
+ )
366
+
367
+ _response_types_map: Dict[str, Optional[str]] = {
368
+ '200': "List[Document]",
369
+ '400': "str",
370
+ '401': "str",
371
+ }
372
+ response_data = self.api_client.call_api(
373
+ *_param,
374
+ _request_timeout=_request_timeout
375
+ )
376
+ response_data.read()
377
+ return self.api_client.response_deserialize(
378
+ response_data=response_data,
379
+ response_types_map=_response_types_map,
380
+ ).data
381
+
382
+
383
+ @validate_call
384
+ def get_catalog_documents_with_http_info(
385
+ self,
386
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
387
+ _request_timeout: Union[
388
+ None,
389
+ Annotated[StrictFloat, Field(gt=0)],
390
+ Tuple[
391
+ Annotated[StrictFloat, Field(gt=0)],
392
+ Annotated[StrictFloat, Field(gt=0)]
393
+ ]
394
+ ] = None,
395
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
396
+ _content_type: Optional[StrictStr] = None,
397
+ _headers: Optional[Dict[StrictStr, Any]] = None,
398
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
399
+ ) -> ApiResponse[List[Document]]:
400
+ """Get documents for a catalog
401
+
402
+ Retrieve all documents belonging to the specified catalog
403
+
404
+ :param catalog_id: Unique identifier of the catalog (required)
405
+ :type catalog_id: UUID
406
+ :param _request_timeout: timeout setting for this request. If one
407
+ number provided, it will be total request
408
+ timeout. It can also be a pair (tuple) of
409
+ (connection, read) timeouts.
410
+ :type _request_timeout: int, tuple(int, int), optional
411
+ :param _request_auth: set to override the auth_settings for an a single
412
+ request; this effectively ignores the
413
+ authentication in the spec for a single request.
414
+ :type _request_auth: dict, optional
415
+ :param _content_type: force content-type for the request.
416
+ :type _content_type: str, Optional
417
+ :param _headers: set to override the headers for a single
418
+ request; this effectively ignores the headers
419
+ in the spec for a single request.
420
+ :type _headers: dict, optional
421
+ :param _host_index: set to override the host_index for a single
422
+ request; this effectively ignores the host_index
423
+ in the spec for a single request.
424
+ :type _host_index: int, optional
425
+ :return: Returns the result object.
426
+ """ # noqa: E501
427
+
428
+ _param = self._get_catalog_documents_serialize(
429
+ catalog_id=catalog_id,
430
+ _request_auth=_request_auth,
431
+ _content_type=_content_type,
432
+ _headers=_headers,
433
+ _host_index=_host_index
434
+ )
435
+
436
+ _response_types_map: Dict[str, Optional[str]] = {
437
+ '200': "List[Document]",
438
+ '400': "str",
439
+ '401': "str",
440
+ }
441
+ response_data = self.api_client.call_api(
442
+ *_param,
443
+ _request_timeout=_request_timeout
444
+ )
445
+ response_data.read()
446
+ return self.api_client.response_deserialize(
447
+ response_data=response_data,
448
+ response_types_map=_response_types_map,
449
+ )
450
+
451
+
452
+ @validate_call
453
+ def get_catalog_documents_without_preload_content(
454
+ self,
455
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
456
+ _request_timeout: Union[
457
+ None,
458
+ Annotated[StrictFloat, Field(gt=0)],
459
+ Tuple[
460
+ Annotated[StrictFloat, Field(gt=0)],
461
+ Annotated[StrictFloat, Field(gt=0)]
462
+ ]
463
+ ] = None,
464
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
465
+ _content_type: Optional[StrictStr] = None,
466
+ _headers: Optional[Dict[StrictStr, Any]] = None,
467
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
468
+ ) -> RESTResponseType:
469
+ """Get documents for a catalog
470
+
471
+ Retrieve all documents belonging to the specified catalog
472
+
473
+ :param catalog_id: Unique identifier of the catalog (required)
474
+ :type catalog_id: UUID
475
+ :param _request_timeout: timeout setting for this request. If one
476
+ number provided, it will be total request
477
+ timeout. It can also be a pair (tuple) of
478
+ (connection, read) timeouts.
479
+ :type _request_timeout: int, tuple(int, int), optional
480
+ :param _request_auth: set to override the auth_settings for an a single
481
+ request; this effectively ignores the
482
+ authentication in the spec for a single request.
483
+ :type _request_auth: dict, optional
484
+ :param _content_type: force content-type for the request.
485
+ :type _content_type: str, Optional
486
+ :param _headers: set to override the headers for a single
487
+ request; this effectively ignores the headers
488
+ in the spec for a single request.
489
+ :type _headers: dict, optional
490
+ :param _host_index: set to override the host_index for a single
491
+ request; this effectively ignores the host_index
492
+ in the spec for a single request.
493
+ :type _host_index: int, optional
494
+ :return: Returns the result object.
495
+ """ # noqa: E501
496
+
497
+ _param = self._get_catalog_documents_serialize(
498
+ catalog_id=catalog_id,
499
+ _request_auth=_request_auth,
500
+ _content_type=_content_type,
501
+ _headers=_headers,
502
+ _host_index=_host_index
503
+ )
504
+
505
+ _response_types_map: Dict[str, Optional[str]] = {
506
+ '200': "List[Document]",
507
+ '400': "str",
508
+ '401': "str",
509
+ }
510
+ response_data = self.api_client.call_api(
511
+ *_param,
512
+ _request_timeout=_request_timeout
513
+ )
514
+ return response_data.response
515
+
516
+
517
+ def _get_catalog_documents_serialize(
518
+ self,
519
+ catalog_id,
520
+ _request_auth,
521
+ _content_type,
522
+ _headers,
523
+ _host_index,
524
+ ) -> RequestSerialized:
525
+
526
+ _host = None
527
+
528
+ _collection_formats: Dict[str, str] = {
529
+ }
530
+
531
+ _path_params: Dict[str, str] = {}
532
+ _query_params: List[Tuple[str, str]] = []
533
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
534
+ _form_params: List[Tuple[str, str]] = []
535
+ _files: Dict[
536
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
537
+ ] = {}
538
+ _body_params: Optional[bytes] = None
539
+
540
+ # process the path parameters
541
+ if catalog_id is not None:
542
+ _path_params['catalogId'] = catalog_id
543
+ # process the query parameters
544
+ # process the header parameters
545
+ # process the form parameters
546
+ # process the body parameter
547
+
548
+
549
+ # set the HTTP header `Accept`
550
+ if not any(key.lower() == 'accept' for key in _header_params):
551
+ _header_params['Accept'] = self.api_client.select_header_accept(
552
+ [
553
+ 'application/json'
554
+ ]
555
+ )
556
+
557
+
558
+ # authentication setting
559
+ _auth_settings: List[str] = [
560
+ 'bearerAuth'
561
+ ]
562
+
563
+ return self.api_client.param_serialize(
564
+ method='GET',
565
+ resource_path='/catalog/{catalogId}/document',
566
+ path_params=_path_params,
567
+ query_params=_query_params,
568
+ header_params=_header_params,
569
+ body=_body_params,
570
+ post_params=_form_params,
571
+ files=_files,
572
+ auth_settings=_auth_settings,
573
+ collection_formats=_collection_formats,
574
+ _host=_host,
575
+ _request_auth=_request_auth
576
+ )
577
+
578
+
579
+
580
+
581
+ @validate_call
582
+ def get_document_link(
583
+ self,
584
+ document_id: Annotated[UUID, Field(description="Unique identifier of the document")],
585
+ _request_timeout: Union[
586
+ None,
587
+ Annotated[StrictFloat, Field(gt=0)],
588
+ Tuple[
589
+ Annotated[StrictFloat, Field(gt=0)],
590
+ Annotated[StrictFloat, Field(gt=0)]
591
+ ]
592
+ ] = None,
593
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
594
+ _content_type: Optional[StrictStr] = None,
595
+ _headers: Optional[Dict[StrictStr, Any]] = None,
596
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
597
+ ) -> DocumentLink:
598
+ """Get a link to a document
599
+
600
+ Retrieve a link to download the specified document
601
+
602
+ :param document_id: Unique identifier of the document (required)
603
+ :type document_id: UUID
604
+ :param _request_timeout: timeout setting for this request. If one
605
+ number provided, it will be total request
606
+ timeout. It can also be a pair (tuple) of
607
+ (connection, read) timeouts.
608
+ :type _request_timeout: int, tuple(int, int), optional
609
+ :param _request_auth: set to override the auth_settings for an a single
610
+ request; this effectively ignores the
611
+ authentication in the spec for a single request.
612
+ :type _request_auth: dict, optional
613
+ :param _content_type: force content-type for the request.
614
+ :type _content_type: str, Optional
615
+ :param _headers: set to override the headers for a single
616
+ request; this effectively ignores the headers
617
+ in the spec for a single request.
618
+ :type _headers: dict, optional
619
+ :param _host_index: set to override the host_index for a single
620
+ request; this effectively ignores the host_index
621
+ in the spec for a single request.
622
+ :type _host_index: int, optional
623
+ :return: Returns the result object.
624
+ """ # noqa: E501
625
+
626
+ _param = self._get_document_link_serialize(
627
+ document_id=document_id,
628
+ _request_auth=_request_auth,
629
+ _content_type=_content_type,
630
+ _headers=_headers,
631
+ _host_index=_host_index
632
+ )
633
+
634
+ _response_types_map: Dict[str, Optional[str]] = {
635
+ '200': "DocumentLink",
636
+ '400': "str",
637
+ '401': "str",
638
+ }
639
+ response_data = self.api_client.call_api(
640
+ *_param,
641
+ _request_timeout=_request_timeout
642
+ )
643
+ response_data.read()
644
+ return self.api_client.response_deserialize(
645
+ response_data=response_data,
646
+ response_types_map=_response_types_map,
647
+ ).data
648
+
649
+
650
+ @validate_call
651
+ def get_document_link_with_http_info(
652
+ self,
653
+ document_id: Annotated[UUID, Field(description="Unique identifier of the document")],
654
+ _request_timeout: Union[
655
+ None,
656
+ Annotated[StrictFloat, Field(gt=0)],
657
+ Tuple[
658
+ Annotated[StrictFloat, Field(gt=0)],
659
+ Annotated[StrictFloat, Field(gt=0)]
660
+ ]
661
+ ] = None,
662
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
663
+ _content_type: Optional[StrictStr] = None,
664
+ _headers: Optional[Dict[StrictStr, Any]] = None,
665
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
666
+ ) -> ApiResponse[DocumentLink]:
667
+ """Get a link to a document
668
+
669
+ Retrieve a link to download the specified document
670
+
671
+ :param document_id: Unique identifier of the document (required)
672
+ :type document_id: UUID
673
+ :param _request_timeout: timeout setting for this request. If one
674
+ number provided, it will be total request
675
+ timeout. It can also be a pair (tuple) of
676
+ (connection, read) timeouts.
677
+ :type _request_timeout: int, tuple(int, int), optional
678
+ :param _request_auth: set to override the auth_settings for an a single
679
+ request; this effectively ignores the
680
+ authentication in the spec for a single request.
681
+ :type _request_auth: dict, optional
682
+ :param _content_type: force content-type for the request.
683
+ :type _content_type: str, Optional
684
+ :param _headers: set to override the headers for a single
685
+ request; this effectively ignores the headers
686
+ in the spec for a single request.
687
+ :type _headers: dict, optional
688
+ :param _host_index: set to override the host_index for a single
689
+ request; this effectively ignores the host_index
690
+ in the spec for a single request.
691
+ :type _host_index: int, optional
692
+ :return: Returns the result object.
693
+ """ # noqa: E501
694
+
695
+ _param = self._get_document_link_serialize(
696
+ document_id=document_id,
697
+ _request_auth=_request_auth,
698
+ _content_type=_content_type,
699
+ _headers=_headers,
700
+ _host_index=_host_index
701
+ )
702
+
703
+ _response_types_map: Dict[str, Optional[str]] = {
704
+ '200': "DocumentLink",
705
+ '400': "str",
706
+ '401': "str",
707
+ }
708
+ response_data = self.api_client.call_api(
709
+ *_param,
710
+ _request_timeout=_request_timeout
711
+ )
712
+ response_data.read()
713
+ return self.api_client.response_deserialize(
714
+ response_data=response_data,
715
+ response_types_map=_response_types_map,
716
+ )
717
+
718
+
719
+ @validate_call
720
+ def get_document_link_without_preload_content(
721
+ self,
722
+ document_id: Annotated[UUID, Field(description="Unique identifier of the document")],
723
+ _request_timeout: Union[
724
+ None,
725
+ Annotated[StrictFloat, Field(gt=0)],
726
+ Tuple[
727
+ Annotated[StrictFloat, Field(gt=0)],
728
+ Annotated[StrictFloat, Field(gt=0)]
729
+ ]
730
+ ] = None,
731
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
732
+ _content_type: Optional[StrictStr] = None,
733
+ _headers: Optional[Dict[StrictStr, Any]] = None,
734
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
735
+ ) -> RESTResponseType:
736
+ """Get a link to a document
737
+
738
+ Retrieve a link to download the specified document
739
+
740
+ :param document_id: Unique identifier of the document (required)
741
+ :type document_id: UUID
742
+ :param _request_timeout: timeout setting for this request. If one
743
+ number provided, it will be total request
744
+ timeout. It can also be a pair (tuple) of
745
+ (connection, read) timeouts.
746
+ :type _request_timeout: int, tuple(int, int), optional
747
+ :param _request_auth: set to override the auth_settings for an a single
748
+ request; this effectively ignores the
749
+ authentication in the spec for a single request.
750
+ :type _request_auth: dict, optional
751
+ :param _content_type: force content-type for the request.
752
+ :type _content_type: str, Optional
753
+ :param _headers: set to override the headers for a single
754
+ request; this effectively ignores the headers
755
+ in the spec for a single request.
756
+ :type _headers: dict, optional
757
+ :param _host_index: set to override the host_index for a single
758
+ request; this effectively ignores the host_index
759
+ in the spec for a single request.
760
+ :type _host_index: int, optional
761
+ :return: Returns the result object.
762
+ """ # noqa: E501
763
+
764
+ _param = self._get_document_link_serialize(
765
+ document_id=document_id,
766
+ _request_auth=_request_auth,
767
+ _content_type=_content_type,
768
+ _headers=_headers,
769
+ _host_index=_host_index
770
+ )
771
+
772
+ _response_types_map: Dict[str, Optional[str]] = {
773
+ '200': "DocumentLink",
774
+ '400': "str",
775
+ '401': "str",
776
+ }
777
+ response_data = self.api_client.call_api(
778
+ *_param,
779
+ _request_timeout=_request_timeout
780
+ )
781
+ return response_data.response
782
+
783
+
784
+ def _get_document_link_serialize(
785
+ self,
786
+ document_id,
787
+ _request_auth,
788
+ _content_type,
789
+ _headers,
790
+ _host_index,
791
+ ) -> RequestSerialized:
792
+
793
+ _host = None
794
+
795
+ _collection_formats: Dict[str, str] = {
796
+ }
797
+
798
+ _path_params: Dict[str, str] = {}
799
+ _query_params: List[Tuple[str, str]] = []
800
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
801
+ _form_params: List[Tuple[str, str]] = []
802
+ _files: Dict[
803
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
804
+ ] = {}
805
+ _body_params: Optional[bytes] = None
806
+
807
+ # process the path parameters
808
+ if document_id is not None:
809
+ _path_params['documentId'] = document_id
810
+ # process the query parameters
811
+ # process the header parameters
812
+ # process the form parameters
813
+ # process the body parameter
814
+
815
+
816
+ # set the HTTP header `Accept`
817
+ if not any(key.lower() == 'accept' for key in _header_params):
818
+ _header_params['Accept'] = self.api_client.select_header_accept(
819
+ [
820
+ 'application/json'
821
+ ]
822
+ )
823
+
824
+
825
+ # authentication setting
826
+ _auth_settings: List[str] = [
827
+ 'bearerAuth'
828
+ ]
829
+
830
+ return self.api_client.param_serialize(
831
+ method='GET',
832
+ resource_path='/document/{documentId}/link',
833
+ path_params=_path_params,
834
+ query_params=_query_params,
835
+ header_params=_header_params,
836
+ body=_body_params,
837
+ post_params=_form_params,
838
+ files=_files,
839
+ auth_settings=_auth_settings,
840
+ collection_formats=_collection_formats,
841
+ _host=_host,
842
+ _request_auth=_request_auth
843
+ )
844
+
845
+
846
+
847
+
848
+ @validate_call
849
+ def get_document_text(
850
+ self,
851
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
852
+ document_id: Annotated[UUID, Field(description="Unique identifier of the document")],
853
+ _request_timeout: Union[
854
+ None,
855
+ Annotated[StrictFloat, Field(gt=0)],
856
+ Tuple[
857
+ Annotated[StrictFloat, Field(gt=0)],
858
+ Annotated[StrictFloat, Field(gt=0)]
859
+ ]
860
+ ] = None,
861
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
862
+ _content_type: Optional[StrictStr] = None,
863
+ _headers: Optional[Dict[StrictStr, Any]] = None,
864
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
865
+ ) -> DocumentText:
866
+ """Get the extracted text of a document
867
+
868
+ Retrieve the extracted text content of the specified document, if it has been processed
869
+
870
+ :param catalog_id: Unique identifier of the catalog (required)
871
+ :type catalog_id: UUID
872
+ :param document_id: Unique identifier of the document (required)
873
+ :type document_id: UUID
874
+ :param _request_timeout: timeout setting for this request. If one
875
+ number provided, it will be total request
876
+ timeout. It can also be a pair (tuple) of
877
+ (connection, read) timeouts.
878
+ :type _request_timeout: int, tuple(int, int), optional
879
+ :param _request_auth: set to override the auth_settings for an a single
880
+ request; this effectively ignores the
881
+ authentication in the spec for a single request.
882
+ :type _request_auth: dict, optional
883
+ :param _content_type: force content-type for the request.
884
+ :type _content_type: str, Optional
885
+ :param _headers: set to override the headers for a single
886
+ request; this effectively ignores the headers
887
+ in the spec for a single request.
888
+ :type _headers: dict, optional
889
+ :param _host_index: set to override the host_index for a single
890
+ request; this effectively ignores the host_index
891
+ in the spec for a single request.
892
+ :type _host_index: int, optional
893
+ :return: Returns the result object.
894
+ """ # noqa: E501
895
+
896
+ _param = self._get_document_text_serialize(
897
+ catalog_id=catalog_id,
898
+ document_id=document_id,
899
+ _request_auth=_request_auth,
900
+ _content_type=_content_type,
901
+ _headers=_headers,
902
+ _host_index=_host_index
903
+ )
904
+
905
+ _response_types_map: Dict[str, Optional[str]] = {
906
+ '200': "DocumentText",
907
+ '400': "str",
908
+ '401': "str",
909
+ }
910
+ response_data = self.api_client.call_api(
911
+ *_param,
912
+ _request_timeout=_request_timeout
913
+ )
914
+ response_data.read()
915
+ return self.api_client.response_deserialize(
916
+ response_data=response_data,
917
+ response_types_map=_response_types_map,
918
+ ).data
919
+
920
+
921
+ @validate_call
922
+ def get_document_text_with_http_info(
923
+ self,
924
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
925
+ document_id: Annotated[UUID, Field(description="Unique identifier of the document")],
926
+ _request_timeout: Union[
927
+ None,
928
+ Annotated[StrictFloat, Field(gt=0)],
929
+ Tuple[
930
+ Annotated[StrictFloat, Field(gt=0)],
931
+ Annotated[StrictFloat, Field(gt=0)]
932
+ ]
933
+ ] = None,
934
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
935
+ _content_type: Optional[StrictStr] = None,
936
+ _headers: Optional[Dict[StrictStr, Any]] = None,
937
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
938
+ ) -> ApiResponse[DocumentText]:
939
+ """Get the extracted text of a document
940
+
941
+ Retrieve the extracted text content of the specified document, if it has been processed
942
+
943
+ :param catalog_id: Unique identifier of the catalog (required)
944
+ :type catalog_id: UUID
945
+ :param document_id: Unique identifier of the document (required)
946
+ :type document_id: UUID
947
+ :param _request_timeout: timeout setting for this request. If one
948
+ number provided, it will be total request
949
+ timeout. It can also be a pair (tuple) of
950
+ (connection, read) timeouts.
951
+ :type _request_timeout: int, tuple(int, int), optional
952
+ :param _request_auth: set to override the auth_settings for an a single
953
+ request; this effectively ignores the
954
+ authentication in the spec for a single request.
955
+ :type _request_auth: dict, optional
956
+ :param _content_type: force content-type for the request.
957
+ :type _content_type: str, Optional
958
+ :param _headers: set to override the headers for a single
959
+ request; this effectively ignores the headers
960
+ in the spec for a single request.
961
+ :type _headers: dict, optional
962
+ :param _host_index: set to override the host_index for a single
963
+ request; this effectively ignores the host_index
964
+ in the spec for a single request.
965
+ :type _host_index: int, optional
966
+ :return: Returns the result object.
967
+ """ # noqa: E501
968
+
969
+ _param = self._get_document_text_serialize(
970
+ catalog_id=catalog_id,
971
+ document_id=document_id,
972
+ _request_auth=_request_auth,
973
+ _content_type=_content_type,
974
+ _headers=_headers,
975
+ _host_index=_host_index
976
+ )
977
+
978
+ _response_types_map: Dict[str, Optional[str]] = {
979
+ '200': "DocumentText",
980
+ '400': "str",
981
+ '401': "str",
982
+ }
983
+ response_data = self.api_client.call_api(
984
+ *_param,
985
+ _request_timeout=_request_timeout
986
+ )
987
+ response_data.read()
988
+ return self.api_client.response_deserialize(
989
+ response_data=response_data,
990
+ response_types_map=_response_types_map,
991
+ )
992
+
993
+
994
+ @validate_call
995
+ def get_document_text_without_preload_content(
996
+ self,
997
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
998
+ document_id: Annotated[UUID, Field(description="Unique identifier of the document")],
999
+ _request_timeout: Union[
1000
+ None,
1001
+ Annotated[StrictFloat, Field(gt=0)],
1002
+ Tuple[
1003
+ Annotated[StrictFloat, Field(gt=0)],
1004
+ Annotated[StrictFloat, Field(gt=0)]
1005
+ ]
1006
+ ] = None,
1007
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1008
+ _content_type: Optional[StrictStr] = None,
1009
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1010
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1011
+ ) -> RESTResponseType:
1012
+ """Get the extracted text of a document
1013
+
1014
+ Retrieve the extracted text content of the specified document, if it has been processed
1015
+
1016
+ :param catalog_id: Unique identifier of the catalog (required)
1017
+ :type catalog_id: UUID
1018
+ :param document_id: Unique identifier of the document (required)
1019
+ :type document_id: UUID
1020
+ :param _request_timeout: timeout setting for this request. If one
1021
+ number provided, it will be total request
1022
+ timeout. It can also be a pair (tuple) of
1023
+ (connection, read) timeouts.
1024
+ :type _request_timeout: int, tuple(int, int), optional
1025
+ :param _request_auth: set to override the auth_settings for an a single
1026
+ request; this effectively ignores the
1027
+ authentication in the spec for a single request.
1028
+ :type _request_auth: dict, optional
1029
+ :param _content_type: force content-type for the request.
1030
+ :type _content_type: str, Optional
1031
+ :param _headers: set to override the headers for a single
1032
+ request; this effectively ignores the headers
1033
+ in the spec for a single request.
1034
+ :type _headers: dict, optional
1035
+ :param _host_index: set to override the host_index for a single
1036
+ request; this effectively ignores the host_index
1037
+ in the spec for a single request.
1038
+ :type _host_index: int, optional
1039
+ :return: Returns the result object.
1040
+ """ # noqa: E501
1041
+
1042
+ _param = self._get_document_text_serialize(
1043
+ catalog_id=catalog_id,
1044
+ document_id=document_id,
1045
+ _request_auth=_request_auth,
1046
+ _content_type=_content_type,
1047
+ _headers=_headers,
1048
+ _host_index=_host_index
1049
+ )
1050
+
1051
+ _response_types_map: Dict[str, Optional[str]] = {
1052
+ '200': "DocumentText",
1053
+ '400': "str",
1054
+ '401': "str",
1055
+ }
1056
+ response_data = self.api_client.call_api(
1057
+ *_param,
1058
+ _request_timeout=_request_timeout
1059
+ )
1060
+ return response_data.response
1061
+
1062
+
1063
+ def _get_document_text_serialize(
1064
+ self,
1065
+ catalog_id,
1066
+ document_id,
1067
+ _request_auth,
1068
+ _content_type,
1069
+ _headers,
1070
+ _host_index,
1071
+ ) -> RequestSerialized:
1072
+
1073
+ _host = None
1074
+
1075
+ _collection_formats: Dict[str, str] = {
1076
+ }
1077
+
1078
+ _path_params: Dict[str, str] = {}
1079
+ _query_params: List[Tuple[str, str]] = []
1080
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
1081
+ _form_params: List[Tuple[str, str]] = []
1082
+ _files: Dict[
1083
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1084
+ ] = {}
1085
+ _body_params: Optional[bytes] = None
1086
+
1087
+ # process the path parameters
1088
+ if catalog_id is not None:
1089
+ _path_params['catalogId'] = catalog_id
1090
+ if document_id is not None:
1091
+ _path_params['documentId'] = document_id
1092
+ # process the query parameters
1093
+ # process the header parameters
1094
+ # process the form parameters
1095
+ # process the body parameter
1096
+
1097
+
1098
+ # set the HTTP header `Accept`
1099
+ if not any(key.lower() == 'accept' for key in _header_params):
1100
+ _header_params['Accept'] = self.api_client.select_header_accept(
1101
+ [
1102
+ 'application/json'
1103
+ ]
1104
+ )
1105
+
1106
+
1107
+ # authentication setting
1108
+ _auth_settings: List[str] = [
1109
+ 'bearerAuth'
1110
+ ]
1111
+
1112
+ return self.api_client.param_serialize(
1113
+ method='GET',
1114
+ resource_path='/catalog/{catalogId}/document/{documentId}/text',
1115
+ path_params=_path_params,
1116
+ query_params=_query_params,
1117
+ header_params=_header_params,
1118
+ body=_body_params,
1119
+ post_params=_form_params,
1120
+ files=_files,
1121
+ auth_settings=_auth_settings,
1122
+ collection_formats=_collection_formats,
1123
+ _host=_host,
1124
+ _request_auth=_request_auth
1125
+ )
1126
+
1127
+
1128
+
1129
+
1130
+ @validate_call
1131
+ def get_documents_for_job(
1132
+ self,
1133
+ job_id: Annotated[UUID, Field(description="Unique identifier of the job")],
1134
+ _request_timeout: Union[
1135
+ None,
1136
+ Annotated[StrictFloat, Field(gt=0)],
1137
+ Tuple[
1138
+ Annotated[StrictFloat, Field(gt=0)],
1139
+ Annotated[StrictFloat, Field(gt=0)]
1140
+ ]
1141
+ ] = None,
1142
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1143
+ _content_type: Optional[StrictStr] = None,
1144
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1145
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1146
+ ) -> List[Document]:
1147
+ """Get the documents for a job
1148
+
1149
+ Retrieve all documents the specified job was run against
1150
+
1151
+ :param job_id: Unique identifier of the job (required)
1152
+ :type job_id: UUID
1153
+ :param _request_timeout: timeout setting for this request. If one
1154
+ number provided, it will be total request
1155
+ timeout. It can also be a pair (tuple) of
1156
+ (connection, read) timeouts.
1157
+ :type _request_timeout: int, tuple(int, int), optional
1158
+ :param _request_auth: set to override the auth_settings for an a single
1159
+ request; this effectively ignores the
1160
+ authentication in the spec for a single request.
1161
+ :type _request_auth: dict, optional
1162
+ :param _content_type: force content-type for the request.
1163
+ :type _content_type: str, Optional
1164
+ :param _headers: set to override the headers for a single
1165
+ request; this effectively ignores the headers
1166
+ in the spec for a single request.
1167
+ :type _headers: dict, optional
1168
+ :param _host_index: set to override the host_index for a single
1169
+ request; this effectively ignores the host_index
1170
+ in the spec for a single request.
1171
+ :type _host_index: int, optional
1172
+ :return: Returns the result object.
1173
+ """ # noqa: E501
1174
+
1175
+ _param = self._get_documents_for_job_serialize(
1176
+ job_id=job_id,
1177
+ _request_auth=_request_auth,
1178
+ _content_type=_content_type,
1179
+ _headers=_headers,
1180
+ _host_index=_host_index
1181
+ )
1182
+
1183
+ _response_types_map: Dict[str, Optional[str]] = {
1184
+ '200': "List[Document]",
1185
+ '400': "str",
1186
+ '401': "str",
1187
+ }
1188
+ response_data = self.api_client.call_api(
1189
+ *_param,
1190
+ _request_timeout=_request_timeout
1191
+ )
1192
+ response_data.read()
1193
+ return self.api_client.response_deserialize(
1194
+ response_data=response_data,
1195
+ response_types_map=_response_types_map,
1196
+ ).data
1197
+
1198
+
1199
+ @validate_call
1200
+ def get_documents_for_job_with_http_info(
1201
+ self,
1202
+ job_id: Annotated[UUID, Field(description="Unique identifier of the job")],
1203
+ _request_timeout: Union[
1204
+ None,
1205
+ Annotated[StrictFloat, Field(gt=0)],
1206
+ Tuple[
1207
+ Annotated[StrictFloat, Field(gt=0)],
1208
+ Annotated[StrictFloat, Field(gt=0)]
1209
+ ]
1210
+ ] = None,
1211
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1212
+ _content_type: Optional[StrictStr] = None,
1213
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1214
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1215
+ ) -> ApiResponse[List[Document]]:
1216
+ """Get the documents for a job
1217
+
1218
+ Retrieve all documents the specified job was run against
1219
+
1220
+ :param job_id: Unique identifier of the job (required)
1221
+ :type job_id: UUID
1222
+ :param _request_timeout: timeout setting for this request. If one
1223
+ number provided, it will be total request
1224
+ timeout. It can also be a pair (tuple) of
1225
+ (connection, read) timeouts.
1226
+ :type _request_timeout: int, tuple(int, int), optional
1227
+ :param _request_auth: set to override the auth_settings for an a single
1228
+ request; this effectively ignores the
1229
+ authentication in the spec for a single request.
1230
+ :type _request_auth: dict, optional
1231
+ :param _content_type: force content-type for the request.
1232
+ :type _content_type: str, Optional
1233
+ :param _headers: set to override the headers for a single
1234
+ request; this effectively ignores the headers
1235
+ in the spec for a single request.
1236
+ :type _headers: dict, optional
1237
+ :param _host_index: set to override the host_index for a single
1238
+ request; this effectively ignores the host_index
1239
+ in the spec for a single request.
1240
+ :type _host_index: int, optional
1241
+ :return: Returns the result object.
1242
+ """ # noqa: E501
1243
+
1244
+ _param = self._get_documents_for_job_serialize(
1245
+ job_id=job_id,
1246
+ _request_auth=_request_auth,
1247
+ _content_type=_content_type,
1248
+ _headers=_headers,
1249
+ _host_index=_host_index
1250
+ )
1251
+
1252
+ _response_types_map: Dict[str, Optional[str]] = {
1253
+ '200': "List[Document]",
1254
+ '400': "str",
1255
+ '401': "str",
1256
+ }
1257
+ response_data = self.api_client.call_api(
1258
+ *_param,
1259
+ _request_timeout=_request_timeout
1260
+ )
1261
+ response_data.read()
1262
+ return self.api_client.response_deserialize(
1263
+ response_data=response_data,
1264
+ response_types_map=_response_types_map,
1265
+ )
1266
+
1267
+
1268
+ @validate_call
1269
+ def get_documents_for_job_without_preload_content(
1270
+ self,
1271
+ job_id: Annotated[UUID, Field(description="Unique identifier of the job")],
1272
+ _request_timeout: Union[
1273
+ None,
1274
+ Annotated[StrictFloat, Field(gt=0)],
1275
+ Tuple[
1276
+ Annotated[StrictFloat, Field(gt=0)],
1277
+ Annotated[StrictFloat, Field(gt=0)]
1278
+ ]
1279
+ ] = None,
1280
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1281
+ _content_type: Optional[StrictStr] = None,
1282
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1283
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1284
+ ) -> RESTResponseType:
1285
+ """Get the documents for a job
1286
+
1287
+ Retrieve all documents the specified job was run against
1288
+
1289
+ :param job_id: Unique identifier of the job (required)
1290
+ :type job_id: UUID
1291
+ :param _request_timeout: timeout setting for this request. If one
1292
+ number provided, it will be total request
1293
+ timeout. It can also be a pair (tuple) of
1294
+ (connection, read) timeouts.
1295
+ :type _request_timeout: int, tuple(int, int), optional
1296
+ :param _request_auth: set to override the auth_settings for an a single
1297
+ request; this effectively ignores the
1298
+ authentication in the spec for a single request.
1299
+ :type _request_auth: dict, optional
1300
+ :param _content_type: force content-type for the request.
1301
+ :type _content_type: str, Optional
1302
+ :param _headers: set to override the headers for a single
1303
+ request; this effectively ignores the headers
1304
+ in the spec for a single request.
1305
+ :type _headers: dict, optional
1306
+ :param _host_index: set to override the host_index for a single
1307
+ request; this effectively ignores the host_index
1308
+ in the spec for a single request.
1309
+ :type _host_index: int, optional
1310
+ :return: Returns the result object.
1311
+ """ # noqa: E501
1312
+
1313
+ _param = self._get_documents_for_job_serialize(
1314
+ job_id=job_id,
1315
+ _request_auth=_request_auth,
1316
+ _content_type=_content_type,
1317
+ _headers=_headers,
1318
+ _host_index=_host_index
1319
+ )
1320
+
1321
+ _response_types_map: Dict[str, Optional[str]] = {
1322
+ '200': "List[Document]",
1323
+ '400': "str",
1324
+ '401': "str",
1325
+ }
1326
+ response_data = self.api_client.call_api(
1327
+ *_param,
1328
+ _request_timeout=_request_timeout
1329
+ )
1330
+ return response_data.response
1331
+
1332
+
1333
+ def _get_documents_for_job_serialize(
1334
+ self,
1335
+ job_id,
1336
+ _request_auth,
1337
+ _content_type,
1338
+ _headers,
1339
+ _host_index,
1340
+ ) -> RequestSerialized:
1341
+
1342
+ _host = None
1343
+
1344
+ _collection_formats: Dict[str, str] = {
1345
+ }
1346
+
1347
+ _path_params: Dict[str, str] = {}
1348
+ _query_params: List[Tuple[str, str]] = []
1349
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
1350
+ _form_params: List[Tuple[str, str]] = []
1351
+ _files: Dict[
1352
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1353
+ ] = {}
1354
+ _body_params: Optional[bytes] = None
1355
+
1356
+ # process the path parameters
1357
+ if job_id is not None:
1358
+ _path_params['jobId'] = job_id
1359
+ # process the query parameters
1360
+ # process the header parameters
1361
+ # process the form parameters
1362
+ # process the body parameter
1363
+
1364
+
1365
+ # set the HTTP header `Accept`
1366
+ if not any(key.lower() == 'accept' for key in _header_params):
1367
+ _header_params['Accept'] = self.api_client.select_header_accept(
1368
+ [
1369
+ 'application/json'
1370
+ ]
1371
+ )
1372
+
1373
+
1374
+ # authentication setting
1375
+ _auth_settings: List[str] = [
1376
+ 'bearerAuth'
1377
+ ]
1378
+
1379
+ return self.api_client.param_serialize(
1380
+ method='GET',
1381
+ resource_path='/job/{jobId}/document',
1382
+ path_params=_path_params,
1383
+ query_params=_query_params,
1384
+ header_params=_header_params,
1385
+ body=_body_params,
1386
+ post_params=_form_params,
1387
+ files=_files,
1388
+ auth_settings=_auth_settings,
1389
+ collection_formats=_collection_formats,
1390
+ _host=_host,
1391
+ _request_auth=_request_auth
1392
+ )
1393
+
1394
+
1395
+
1396
+
1397
+ @validate_call
1398
+ def get_user_documents(
1399
+ self,
1400
+ _request_timeout: Union[
1401
+ None,
1402
+ Annotated[StrictFloat, Field(gt=0)],
1403
+ Tuple[
1404
+ Annotated[StrictFloat, Field(gt=0)],
1405
+ Annotated[StrictFloat, Field(gt=0)]
1406
+ ]
1407
+ ] = None,
1408
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1409
+ _content_type: Optional[StrictStr] = None,
1410
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1411
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1412
+ ) -> List[Document]:
1413
+ """Get all documents for the user
1414
+
1415
+ Retrieve all documents belonging to the user's account, across all catalogs
1416
+
1417
+ :param _request_timeout: timeout setting for this request. If one
1418
+ number provided, it will be total request
1419
+ timeout. It can also be a pair (tuple) of
1420
+ (connection, read) timeouts.
1421
+ :type _request_timeout: int, tuple(int, int), optional
1422
+ :param _request_auth: set to override the auth_settings for an a single
1423
+ request; this effectively ignores the
1424
+ authentication in the spec for a single request.
1425
+ :type _request_auth: dict, optional
1426
+ :param _content_type: force content-type for the request.
1427
+ :type _content_type: str, Optional
1428
+ :param _headers: set to override the headers for a single
1429
+ request; this effectively ignores the headers
1430
+ in the spec for a single request.
1431
+ :type _headers: dict, optional
1432
+ :param _host_index: set to override the host_index for a single
1433
+ request; this effectively ignores the host_index
1434
+ in the spec for a single request.
1435
+ :type _host_index: int, optional
1436
+ :return: Returns the result object.
1437
+ """ # noqa: E501
1438
+
1439
+ _param = self._get_user_documents_serialize(
1440
+ _request_auth=_request_auth,
1441
+ _content_type=_content_type,
1442
+ _headers=_headers,
1443
+ _host_index=_host_index
1444
+ )
1445
+
1446
+ _response_types_map: Dict[str, Optional[str]] = {
1447
+ '200': "List[Document]",
1448
+ '401': "str",
1449
+ }
1450
+ response_data = self.api_client.call_api(
1451
+ *_param,
1452
+ _request_timeout=_request_timeout
1453
+ )
1454
+ response_data.read()
1455
+ return self.api_client.response_deserialize(
1456
+ response_data=response_data,
1457
+ response_types_map=_response_types_map,
1458
+ ).data
1459
+
1460
+
1461
+ @validate_call
1462
+ def get_user_documents_with_http_info(
1463
+ self,
1464
+ _request_timeout: Union[
1465
+ None,
1466
+ Annotated[StrictFloat, Field(gt=0)],
1467
+ Tuple[
1468
+ Annotated[StrictFloat, Field(gt=0)],
1469
+ Annotated[StrictFloat, Field(gt=0)]
1470
+ ]
1471
+ ] = None,
1472
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1473
+ _content_type: Optional[StrictStr] = None,
1474
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1475
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1476
+ ) -> ApiResponse[List[Document]]:
1477
+ """Get all documents for the user
1478
+
1479
+ Retrieve all documents belonging to the user's account, across all catalogs
1480
+
1481
+ :param _request_timeout: timeout setting for this request. If one
1482
+ number provided, it will be total request
1483
+ timeout. It can also be a pair (tuple) of
1484
+ (connection, read) timeouts.
1485
+ :type _request_timeout: int, tuple(int, int), optional
1486
+ :param _request_auth: set to override the auth_settings for an a single
1487
+ request; this effectively ignores the
1488
+ authentication in the spec for a single request.
1489
+ :type _request_auth: dict, optional
1490
+ :param _content_type: force content-type for the request.
1491
+ :type _content_type: str, Optional
1492
+ :param _headers: set to override the headers for a single
1493
+ request; this effectively ignores the headers
1494
+ in the spec for a single request.
1495
+ :type _headers: dict, optional
1496
+ :param _host_index: set to override the host_index for a single
1497
+ request; this effectively ignores the host_index
1498
+ in the spec for a single request.
1499
+ :type _host_index: int, optional
1500
+ :return: Returns the result object.
1501
+ """ # noqa: E501
1502
+
1503
+ _param = self._get_user_documents_serialize(
1504
+ _request_auth=_request_auth,
1505
+ _content_type=_content_type,
1506
+ _headers=_headers,
1507
+ _host_index=_host_index
1508
+ )
1509
+
1510
+ _response_types_map: Dict[str, Optional[str]] = {
1511
+ '200': "List[Document]",
1512
+ '401': "str",
1513
+ }
1514
+ response_data = self.api_client.call_api(
1515
+ *_param,
1516
+ _request_timeout=_request_timeout
1517
+ )
1518
+ response_data.read()
1519
+ return self.api_client.response_deserialize(
1520
+ response_data=response_data,
1521
+ response_types_map=_response_types_map,
1522
+ )
1523
+
1524
+
1525
+ @validate_call
1526
+ def get_user_documents_without_preload_content(
1527
+ self,
1528
+ _request_timeout: Union[
1529
+ None,
1530
+ Annotated[StrictFloat, Field(gt=0)],
1531
+ Tuple[
1532
+ Annotated[StrictFloat, Field(gt=0)],
1533
+ Annotated[StrictFloat, Field(gt=0)]
1534
+ ]
1535
+ ] = None,
1536
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1537
+ _content_type: Optional[StrictStr] = None,
1538
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1539
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1540
+ ) -> RESTResponseType:
1541
+ """Get all documents for the user
1542
+
1543
+ Retrieve all documents belonging to the user's account, across all catalogs
1544
+
1545
+ :param _request_timeout: timeout setting for this request. If one
1546
+ number provided, it will be total request
1547
+ timeout. It can also be a pair (tuple) of
1548
+ (connection, read) timeouts.
1549
+ :type _request_timeout: int, tuple(int, int), optional
1550
+ :param _request_auth: set to override the auth_settings for an a single
1551
+ request; this effectively ignores the
1552
+ authentication in the spec for a single request.
1553
+ :type _request_auth: dict, optional
1554
+ :param _content_type: force content-type for the request.
1555
+ :type _content_type: str, Optional
1556
+ :param _headers: set to override the headers for a single
1557
+ request; this effectively ignores the headers
1558
+ in the spec for a single request.
1559
+ :type _headers: dict, optional
1560
+ :param _host_index: set to override the host_index for a single
1561
+ request; this effectively ignores the host_index
1562
+ in the spec for a single request.
1563
+ :type _host_index: int, optional
1564
+ :return: Returns the result object.
1565
+ """ # noqa: E501
1566
+
1567
+ _param = self._get_user_documents_serialize(
1568
+ _request_auth=_request_auth,
1569
+ _content_type=_content_type,
1570
+ _headers=_headers,
1571
+ _host_index=_host_index
1572
+ )
1573
+
1574
+ _response_types_map: Dict[str, Optional[str]] = {
1575
+ '200': "List[Document]",
1576
+ '401': "str",
1577
+ }
1578
+ response_data = self.api_client.call_api(
1579
+ *_param,
1580
+ _request_timeout=_request_timeout
1581
+ )
1582
+ return response_data.response
1583
+
1584
+
1585
+ def _get_user_documents_serialize(
1586
+ self,
1587
+ _request_auth,
1588
+ _content_type,
1589
+ _headers,
1590
+ _host_index,
1591
+ ) -> RequestSerialized:
1592
+
1593
+ _host = None
1594
+
1595
+ _collection_formats: Dict[str, str] = {
1596
+ }
1597
+
1598
+ _path_params: Dict[str, str] = {}
1599
+ _query_params: List[Tuple[str, str]] = []
1600
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
1601
+ _form_params: List[Tuple[str, str]] = []
1602
+ _files: Dict[
1603
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1604
+ ] = {}
1605
+ _body_params: Optional[bytes] = None
1606
+
1607
+ # process the path parameters
1608
+ # process the query parameters
1609
+ # process the header parameters
1610
+ # process the form parameters
1611
+ # process the body parameter
1612
+
1613
+
1614
+ # set the HTTP header `Accept`
1615
+ if not any(key.lower() == 'accept' for key in _header_params):
1616
+ _header_params['Accept'] = self.api_client.select_header_accept(
1617
+ [
1618
+ 'application/json'
1619
+ ]
1620
+ )
1621
+
1622
+
1623
+ # authentication setting
1624
+ _auth_settings: List[str] = [
1625
+ 'bearerAuth'
1626
+ ]
1627
+
1628
+ return self.api_client.param_serialize(
1629
+ method='GET',
1630
+ resource_path='/document',
1631
+ path_params=_path_params,
1632
+ query_params=_query_params,
1633
+ header_params=_header_params,
1634
+ body=_body_params,
1635
+ post_params=_form_params,
1636
+ files=_files,
1637
+ auth_settings=_auth_settings,
1638
+ collection_formats=_collection_formats,
1639
+ _host=_host,
1640
+ _request_auth=_request_auth
1641
+ )
1642
+
1643
+
1644
+
1645
+
1646
+ @validate_call
1647
+ def upload_document(
1648
+ self,
1649
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
1650
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request.")],
1651
+ _request_timeout: Union[
1652
+ None,
1653
+ Annotated[StrictFloat, Field(gt=0)],
1654
+ Tuple[
1655
+ Annotated[StrictFloat, Field(gt=0)],
1656
+ Annotated[StrictFloat, Field(gt=0)]
1657
+ ]
1658
+ ] = None,
1659
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1660
+ _content_type: Optional[StrictStr] = None,
1661
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1662
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1663
+ ) -> Document:
1664
+ """Upload a file to the specified catalog
1665
+
1666
+ Upload a file to the specified catalog. Files are capped at 100MB, and raw text files (such as .txt, .csv or .json) are capped at 10MB for analysis.
1667
+
1668
+ :param catalog_id: Unique identifier of the catalog (required)
1669
+ :type catalog_id: UUID
1670
+ :param file: The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request. (required)
1671
+ :type file: bytes
1672
+ :param _request_timeout: timeout setting for this request. If one
1673
+ number provided, it will be total request
1674
+ timeout. It can also be a pair (tuple) of
1675
+ (connection, read) timeouts.
1676
+ :type _request_timeout: int, tuple(int, int), optional
1677
+ :param _request_auth: set to override the auth_settings for an a single
1678
+ request; this effectively ignores the
1679
+ authentication in the spec for a single request.
1680
+ :type _request_auth: dict, optional
1681
+ :param _content_type: force content-type for the request.
1682
+ :type _content_type: str, Optional
1683
+ :param _headers: set to override the headers for a single
1684
+ request; this effectively ignores the headers
1685
+ in the spec for a single request.
1686
+ :type _headers: dict, optional
1687
+ :param _host_index: set to override the host_index for a single
1688
+ request; this effectively ignores the host_index
1689
+ in the spec for a single request.
1690
+ :type _host_index: int, optional
1691
+ :return: Returns the result object.
1692
+ """ # noqa: E501
1693
+
1694
+ _param = self._upload_document_serialize(
1695
+ catalog_id=catalog_id,
1696
+ file=file,
1697
+ _request_auth=_request_auth,
1698
+ _content_type=_content_type,
1699
+ _headers=_headers,
1700
+ _host_index=_host_index
1701
+ )
1702
+
1703
+ _response_types_map: Dict[str, Optional[str]] = {
1704
+ '200': "Document",
1705
+ '400': "str",
1706
+ '401': "str",
1707
+ '402': "str",
1708
+ }
1709
+ response_data = self.api_client.call_api(
1710
+ *_param,
1711
+ _request_timeout=_request_timeout
1712
+ )
1713
+ response_data.read()
1714
+ return self.api_client.response_deserialize(
1715
+ response_data=response_data,
1716
+ response_types_map=_response_types_map,
1717
+ ).data
1718
+
1719
+
1720
+ @validate_call
1721
+ def upload_document_with_http_info(
1722
+ self,
1723
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
1724
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request.")],
1725
+ _request_timeout: Union[
1726
+ None,
1727
+ Annotated[StrictFloat, Field(gt=0)],
1728
+ Tuple[
1729
+ Annotated[StrictFloat, Field(gt=0)],
1730
+ Annotated[StrictFloat, Field(gt=0)]
1731
+ ]
1732
+ ] = None,
1733
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1734
+ _content_type: Optional[StrictStr] = None,
1735
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1736
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1737
+ ) -> ApiResponse[Document]:
1738
+ """Upload a file to the specified catalog
1739
+
1740
+ Upload a file to the specified catalog. Files are capped at 100MB, and raw text files (such as .txt, .csv or .json) are capped at 10MB for analysis.
1741
+
1742
+ :param catalog_id: Unique identifier of the catalog (required)
1743
+ :type catalog_id: UUID
1744
+ :param file: The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request. (required)
1745
+ :type file: bytes
1746
+ :param _request_timeout: timeout setting for this request. If one
1747
+ number provided, it will be total request
1748
+ timeout. It can also be a pair (tuple) of
1749
+ (connection, read) timeouts.
1750
+ :type _request_timeout: int, tuple(int, int), optional
1751
+ :param _request_auth: set to override the auth_settings for an a single
1752
+ request; this effectively ignores the
1753
+ authentication in the spec for a single request.
1754
+ :type _request_auth: dict, optional
1755
+ :param _content_type: force content-type for the request.
1756
+ :type _content_type: str, Optional
1757
+ :param _headers: set to override the headers for a single
1758
+ request; this effectively ignores the headers
1759
+ in the spec for a single request.
1760
+ :type _headers: dict, optional
1761
+ :param _host_index: set to override the host_index for a single
1762
+ request; this effectively ignores the host_index
1763
+ in the spec for a single request.
1764
+ :type _host_index: int, optional
1765
+ :return: Returns the result object.
1766
+ """ # noqa: E501
1767
+
1768
+ _param = self._upload_document_serialize(
1769
+ catalog_id=catalog_id,
1770
+ file=file,
1771
+ _request_auth=_request_auth,
1772
+ _content_type=_content_type,
1773
+ _headers=_headers,
1774
+ _host_index=_host_index
1775
+ )
1776
+
1777
+ _response_types_map: Dict[str, Optional[str]] = {
1778
+ '200': "Document",
1779
+ '400': "str",
1780
+ '401': "str",
1781
+ '402': "str",
1782
+ }
1783
+ response_data = self.api_client.call_api(
1784
+ *_param,
1785
+ _request_timeout=_request_timeout
1786
+ )
1787
+ response_data.read()
1788
+ return self.api_client.response_deserialize(
1789
+ response_data=response_data,
1790
+ response_types_map=_response_types_map,
1791
+ )
1792
+
1793
+
1794
+ @validate_call
1795
+ def upload_document_without_preload_content(
1796
+ self,
1797
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
1798
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request.")],
1799
+ _request_timeout: Union[
1800
+ None,
1801
+ Annotated[StrictFloat, Field(gt=0)],
1802
+ Tuple[
1803
+ Annotated[StrictFloat, Field(gt=0)],
1804
+ Annotated[StrictFloat, Field(gt=0)]
1805
+ ]
1806
+ ] = None,
1807
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1808
+ _content_type: Optional[StrictStr] = None,
1809
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1810
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1811
+ ) -> RESTResponseType:
1812
+ """Upload a file to the specified catalog
1813
+
1814
+ Upload a file to the specified catalog. Files are capped at 100MB, and raw text files (such as .txt, .csv or .json) are capped at 10MB for analysis.
1815
+
1816
+ :param catalog_id: Unique identifier of the catalog (required)
1817
+ :type catalog_id: UUID
1818
+ :param file: The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request. (required)
1819
+ :type file: bytes
1820
+ :param _request_timeout: timeout setting for this request. If one
1821
+ number provided, it will be total request
1822
+ timeout. It can also be a pair (tuple) of
1823
+ (connection, read) timeouts.
1824
+ :type _request_timeout: int, tuple(int, int), optional
1825
+ :param _request_auth: set to override the auth_settings for an a single
1826
+ request; this effectively ignores the
1827
+ authentication in the spec for a single request.
1828
+ :type _request_auth: dict, optional
1829
+ :param _content_type: force content-type for the request.
1830
+ :type _content_type: str, Optional
1831
+ :param _headers: set to override the headers for a single
1832
+ request; this effectively ignores the headers
1833
+ in the spec for a single request.
1834
+ :type _headers: dict, optional
1835
+ :param _host_index: set to override the host_index for a single
1836
+ request; this effectively ignores the host_index
1837
+ in the spec for a single request.
1838
+ :type _host_index: int, optional
1839
+ :return: Returns the result object.
1840
+ """ # noqa: E501
1841
+
1842
+ _param = self._upload_document_serialize(
1843
+ catalog_id=catalog_id,
1844
+ file=file,
1845
+ _request_auth=_request_auth,
1846
+ _content_type=_content_type,
1847
+ _headers=_headers,
1848
+ _host_index=_host_index
1849
+ )
1850
+
1851
+ _response_types_map: Dict[str, Optional[str]] = {
1852
+ '200': "Document",
1853
+ '400': "str",
1854
+ '401': "str",
1855
+ '402': "str",
1856
+ }
1857
+ response_data = self.api_client.call_api(
1858
+ *_param,
1859
+ _request_timeout=_request_timeout
1860
+ )
1861
+ return response_data.response
1862
+
1863
+
1864
+ def _upload_document_serialize(
1865
+ self,
1866
+ catalog_id,
1867
+ file,
1868
+ _request_auth,
1869
+ _content_type,
1870
+ _headers,
1871
+ _host_index,
1872
+ ) -> RequestSerialized:
1873
+
1874
+ _host = None
1875
+
1876
+ _collection_formats: Dict[str, str] = {
1877
+ }
1878
+
1879
+ _path_params: Dict[str, str] = {}
1880
+ _query_params: List[Tuple[str, str]] = []
1881
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
1882
+ _form_params: List[Tuple[str, str]] = []
1883
+ _files: Dict[
1884
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1885
+ ] = {}
1886
+ _body_params: Optional[bytes] = None
1887
+
1888
+ # process the path parameters
1889
+ if catalog_id is not None:
1890
+ _path_params['catalogId'] = catalog_id
1891
+ # process the query parameters
1892
+ # process the header parameters
1893
+ # process the form parameters
1894
+ if file is not None:
1895
+ _files['file'] = file
1896
+ # process the body parameter
1897
+
1898
+
1899
+ # set the HTTP header `Accept`
1900
+ if not any(key.lower() == 'accept' for key in _header_params):
1901
+ _header_params['Accept'] = self.api_client.select_header_accept(
1902
+ [
1903
+ 'application/json'
1904
+ ]
1905
+ )
1906
+
1907
+ # set the HTTP header `Content-Type`
1908
+ if _content_type:
1909
+ self.api_client._set_header(_header_params, 'Content-Type', _content_type)
1910
+ else:
1911
+ _default_content_type = (
1912
+ self.api_client.select_header_content_type(
1913
+ [
1914
+ 'multipart/form-data'
1915
+ ]
1916
+ )
1917
+ )
1918
+ if _default_content_type is not None:
1919
+ self.api_client._set_header(_header_params, 'Content-Type', _default_content_type)
1920
+
1921
+ # authentication setting
1922
+ _auth_settings: List[str] = [
1923
+ 'bearerAuth'
1924
+ ]
1925
+
1926
+ return self.api_client.param_serialize(
1927
+ method='POST',
1928
+ resource_path='/catalog/{catalogId}/document',
1929
+ path_params=_path_params,
1930
+ query_params=_query_params,
1931
+ header_params=_header_params,
1932
+ body=_body_params,
1933
+ post_params=_form_params,
1934
+ files=_files,
1935
+ auth_settings=_auth_settings,
1936
+ collection_formats=_collection_formats,
1937
+ _host=_host,
1938
+ _request_auth=_request_auth
1939
+ )
1940
+
1941
+
1942
+
1943
+
1944
+ @validate_call
1945
+ def upload_document_no_catalog(
1946
+ self,
1947
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request.")],
1948
+ _request_timeout: Union[
1949
+ None,
1950
+ Annotated[StrictFloat, Field(gt=0)],
1951
+ Tuple[
1952
+ Annotated[StrictFloat, Field(gt=0)],
1953
+ Annotated[StrictFloat, Field(gt=0)]
1954
+ ]
1955
+ ] = None,
1956
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1957
+ _content_type: Optional[StrictStr] = None,
1958
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1959
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1960
+ ) -> Document:
1961
+ """Upload a document
1962
+
1963
+ Uploads a document. Files are capped at 100MB, and raw text files (such as .txt, .csv or .json) are capped at 10MB for analysis.
1964
+
1965
+ :param file: The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request. (required)
1966
+ :type file: bytes
1967
+ :param _request_timeout: timeout setting for this request. If one
1968
+ number provided, it will be total request
1969
+ timeout. It can also be a pair (tuple) of
1970
+ (connection, read) timeouts.
1971
+ :type _request_timeout: int, tuple(int, int), optional
1972
+ :param _request_auth: set to override the auth_settings for an a single
1973
+ request; this effectively ignores the
1974
+ authentication in the spec for a single request.
1975
+ :type _request_auth: dict, optional
1976
+ :param _content_type: force content-type for the request.
1977
+ :type _content_type: str, Optional
1978
+ :param _headers: set to override the headers for a single
1979
+ request; this effectively ignores the headers
1980
+ in the spec for a single request.
1981
+ :type _headers: dict, optional
1982
+ :param _host_index: set to override the host_index for a single
1983
+ request; this effectively ignores the host_index
1984
+ in the spec for a single request.
1985
+ :type _host_index: int, optional
1986
+ :return: Returns the result object.
1987
+ """ # noqa: E501
1988
+
1989
+ _param = self._upload_document_no_catalog_serialize(
1990
+ file=file,
1991
+ _request_auth=_request_auth,
1992
+ _content_type=_content_type,
1993
+ _headers=_headers,
1994
+ _host_index=_host_index
1995
+ )
1996
+
1997
+ _response_types_map: Dict[str, Optional[str]] = {
1998
+ '200': "Document",
1999
+ '400': "str",
2000
+ '401': "str",
2001
+ '402': "str",
2002
+ }
2003
+ response_data = self.api_client.call_api(
2004
+ *_param,
2005
+ _request_timeout=_request_timeout
2006
+ )
2007
+ response_data.read()
2008
+ return self.api_client.response_deserialize(
2009
+ response_data=response_data,
2010
+ response_types_map=_response_types_map,
2011
+ ).data
2012
+
2013
+
2014
+ @validate_call
2015
+ def upload_document_no_catalog_with_http_info(
2016
+ self,
2017
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request.")],
2018
+ _request_timeout: Union[
2019
+ None,
2020
+ Annotated[StrictFloat, Field(gt=0)],
2021
+ Tuple[
2022
+ Annotated[StrictFloat, Field(gt=0)],
2023
+ Annotated[StrictFloat, Field(gt=0)]
2024
+ ]
2025
+ ] = None,
2026
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2027
+ _content_type: Optional[StrictStr] = None,
2028
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2029
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2030
+ ) -> ApiResponse[Document]:
2031
+ """Upload a document
2032
+
2033
+ Uploads a document. Files are capped at 100MB, and raw text files (such as .txt, .csv or .json) are capped at 10MB for analysis.
2034
+
2035
+ :param file: The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request. (required)
2036
+ :type file: bytes
2037
+ :param _request_timeout: timeout setting for this request. If one
2038
+ number provided, it will be total request
2039
+ timeout. It can also be a pair (tuple) of
2040
+ (connection, read) timeouts.
2041
+ :type _request_timeout: int, tuple(int, int), optional
2042
+ :param _request_auth: set to override the auth_settings for an a single
2043
+ request; this effectively ignores the
2044
+ authentication in the spec for a single request.
2045
+ :type _request_auth: dict, optional
2046
+ :param _content_type: force content-type for the request.
2047
+ :type _content_type: str, Optional
2048
+ :param _headers: set to override the headers for a single
2049
+ request; this effectively ignores the headers
2050
+ in the spec for a single request.
2051
+ :type _headers: dict, optional
2052
+ :param _host_index: set to override the host_index for a single
2053
+ request; this effectively ignores the host_index
2054
+ in the spec for a single request.
2055
+ :type _host_index: int, optional
2056
+ :return: Returns the result object.
2057
+ """ # noqa: E501
2058
+
2059
+ _param = self._upload_document_no_catalog_serialize(
2060
+ file=file,
2061
+ _request_auth=_request_auth,
2062
+ _content_type=_content_type,
2063
+ _headers=_headers,
2064
+ _host_index=_host_index
2065
+ )
2066
+
2067
+ _response_types_map: Dict[str, Optional[str]] = {
2068
+ '200': "Document",
2069
+ '400': "str",
2070
+ '401': "str",
2071
+ '402': "str",
2072
+ }
2073
+ response_data = self.api_client.call_api(
2074
+ *_param,
2075
+ _request_timeout=_request_timeout
2076
+ )
2077
+ response_data.read()
2078
+ return self.api_client.response_deserialize(
2079
+ response_data=response_data,
2080
+ response_types_map=_response_types_map,
2081
+ )
2082
+
2083
+
2084
+ @validate_call
2085
+ def upload_document_no_catalog_without_preload_content(
2086
+ self,
2087
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request.")],
2088
+ _request_timeout: Union[
2089
+ None,
2090
+ Annotated[StrictFloat, Field(gt=0)],
2091
+ Tuple[
2092
+ Annotated[StrictFloat, Field(gt=0)],
2093
+ Annotated[StrictFloat, Field(gt=0)]
2094
+ ]
2095
+ ] = None,
2096
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2097
+ _content_type: Optional[StrictStr] = None,
2098
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2099
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2100
+ ) -> RESTResponseType:
2101
+ """Upload a document
2102
+
2103
+ Uploads a document. Files are capped at 100MB, and raw text files (such as .txt, .csv or .json) are capped at 10MB for analysis.
2104
+
2105
+ :param file: The file to upload. Supported extensions: .png, .jpg, .jpeg, .webp, .heic, .heif, .tif, .tiff, .avif, .bmp, .pdf, .txt, .csv, .json, .xml, .html, .log, .md, .yaml, .yml, .ini, .conf, .cfg, .sql, .svg, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .eml, .msg, .rtf, .mp3, .wav, .m4a, .m4b, .ogg, .flac, .amr. If you require any other file types supported please contact us at matt@stract-api.com with the request. (required)
2106
+ :type file: bytes
2107
+ :param _request_timeout: timeout setting for this request. If one
2108
+ number provided, it will be total request
2109
+ timeout. It can also be a pair (tuple) of
2110
+ (connection, read) timeouts.
2111
+ :type _request_timeout: int, tuple(int, int), optional
2112
+ :param _request_auth: set to override the auth_settings for an a single
2113
+ request; this effectively ignores the
2114
+ authentication in the spec for a single request.
2115
+ :type _request_auth: dict, optional
2116
+ :param _content_type: force content-type for the request.
2117
+ :type _content_type: str, Optional
2118
+ :param _headers: set to override the headers for a single
2119
+ request; this effectively ignores the headers
2120
+ in the spec for a single request.
2121
+ :type _headers: dict, optional
2122
+ :param _host_index: set to override the host_index for a single
2123
+ request; this effectively ignores the host_index
2124
+ in the spec for a single request.
2125
+ :type _host_index: int, optional
2126
+ :return: Returns the result object.
2127
+ """ # noqa: E501
2128
+
2129
+ _param = self._upload_document_no_catalog_serialize(
2130
+ file=file,
2131
+ _request_auth=_request_auth,
2132
+ _content_type=_content_type,
2133
+ _headers=_headers,
2134
+ _host_index=_host_index
2135
+ )
2136
+
2137
+ _response_types_map: Dict[str, Optional[str]] = {
2138
+ '200': "Document",
2139
+ '400': "str",
2140
+ '401': "str",
2141
+ '402': "str",
2142
+ }
2143
+ response_data = self.api_client.call_api(
2144
+ *_param,
2145
+ _request_timeout=_request_timeout
2146
+ )
2147
+ return response_data.response
2148
+
2149
+
2150
+ def _upload_document_no_catalog_serialize(
2151
+ self,
2152
+ file,
2153
+ _request_auth,
2154
+ _content_type,
2155
+ _headers,
2156
+ _host_index,
2157
+ ) -> RequestSerialized:
2158
+
2159
+ _host = None
2160
+
2161
+ _collection_formats: Dict[str, str] = {
2162
+ }
2163
+
2164
+ _path_params: Dict[str, str] = {}
2165
+ _query_params: List[Tuple[str, str]] = []
2166
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
2167
+ _form_params: List[Tuple[str, str]] = []
2168
+ _files: Dict[
2169
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2170
+ ] = {}
2171
+ _body_params: Optional[bytes] = None
2172
+
2173
+ # process the path parameters
2174
+ # process the query parameters
2175
+ # process the header parameters
2176
+ # process the form parameters
2177
+ if file is not None:
2178
+ _files['file'] = file
2179
+ # process the body parameter
2180
+
2181
+
2182
+ # set the HTTP header `Accept`
2183
+ if not any(key.lower() == 'accept' for key in _header_params):
2184
+ _header_params['Accept'] = self.api_client.select_header_accept(
2185
+ [
2186
+ 'application/json'
2187
+ ]
2188
+ )
2189
+
2190
+ # set the HTTP header `Content-Type`
2191
+ if _content_type:
2192
+ self.api_client._set_header(_header_params, 'Content-Type', _content_type)
2193
+ else:
2194
+ _default_content_type = (
2195
+ self.api_client.select_header_content_type(
2196
+ [
2197
+ 'multipart/form-data'
2198
+ ]
2199
+ )
2200
+ )
2201
+ if _default_content_type is not None:
2202
+ self.api_client._set_header(_header_params, 'Content-Type', _default_content_type)
2203
+
2204
+ # authentication setting
2205
+ _auth_settings: List[str] = [
2206
+ 'bearerAuth'
2207
+ ]
2208
+
2209
+ return self.api_client.param_serialize(
2210
+ method='POST',
2211
+ resource_path='/document',
2212
+ path_params=_path_params,
2213
+ query_params=_query_params,
2214
+ header_params=_header_params,
2215
+ body=_body_params,
2216
+ post_params=_form_params,
2217
+ files=_files,
2218
+ auth_settings=_auth_settings,
2219
+ collection_formats=_collection_formats,
2220
+ _host=_host,
2221
+ _request_auth=_request_auth
2222
+ )
2223
+
2224
+
2225
+
2226
+
2227
+ @validate_call
2228
+ def upload_text_document(
2229
+ self,
2230
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
2231
+ upload_text_document_request: UploadTextDocumentRequest,
2232
+ _request_timeout: Union[
2233
+ None,
2234
+ Annotated[StrictFloat, Field(gt=0)],
2235
+ Tuple[
2236
+ Annotated[StrictFloat, Field(gt=0)],
2237
+ Annotated[StrictFloat, Field(gt=0)]
2238
+ ]
2239
+ ] = None,
2240
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2241
+ _content_type: Optional[StrictStr] = None,
2242
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2243
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2244
+ ) -> Document:
2245
+ """Upload text as a document to the specified catalog
2246
+
2247
+ Create a document in the specified catalog directly from text in the request body. No file upload is needed and the document is immediately ready for analysis. The request body is capped at 10MB.
2248
+
2249
+ :param catalog_id: Unique identifier of the catalog (required)
2250
+ :type catalog_id: UUID
2251
+ :param upload_text_document_request: (required)
2252
+ :type upload_text_document_request: UploadTextDocumentRequest
2253
+ :param _request_timeout: timeout setting for this request. If one
2254
+ number provided, it will be total request
2255
+ timeout. It can also be a pair (tuple) of
2256
+ (connection, read) timeouts.
2257
+ :type _request_timeout: int, tuple(int, int), optional
2258
+ :param _request_auth: set to override the auth_settings for an a single
2259
+ request; this effectively ignores the
2260
+ authentication in the spec for a single request.
2261
+ :type _request_auth: dict, optional
2262
+ :param _content_type: force content-type for the request.
2263
+ :type _content_type: str, Optional
2264
+ :param _headers: set to override the headers for a single
2265
+ request; this effectively ignores the headers
2266
+ in the spec for a single request.
2267
+ :type _headers: dict, optional
2268
+ :param _host_index: set to override the host_index for a single
2269
+ request; this effectively ignores the host_index
2270
+ in the spec for a single request.
2271
+ :type _host_index: int, optional
2272
+ :return: Returns the result object.
2273
+ """ # noqa: E501
2274
+
2275
+ _param = self._upload_text_document_serialize(
2276
+ catalog_id=catalog_id,
2277
+ upload_text_document_request=upload_text_document_request,
2278
+ _request_auth=_request_auth,
2279
+ _content_type=_content_type,
2280
+ _headers=_headers,
2281
+ _host_index=_host_index
2282
+ )
2283
+
2284
+ _response_types_map: Dict[str, Optional[str]] = {
2285
+ '200': "Document",
2286
+ '400': "str",
2287
+ '401': "str",
2288
+ }
2289
+ response_data = self.api_client.call_api(
2290
+ *_param,
2291
+ _request_timeout=_request_timeout
2292
+ )
2293
+ response_data.read()
2294
+ return self.api_client.response_deserialize(
2295
+ response_data=response_data,
2296
+ response_types_map=_response_types_map,
2297
+ ).data
2298
+
2299
+
2300
+ @validate_call
2301
+ def upload_text_document_with_http_info(
2302
+ self,
2303
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
2304
+ upload_text_document_request: UploadTextDocumentRequest,
2305
+ _request_timeout: Union[
2306
+ None,
2307
+ Annotated[StrictFloat, Field(gt=0)],
2308
+ Tuple[
2309
+ Annotated[StrictFloat, Field(gt=0)],
2310
+ Annotated[StrictFloat, Field(gt=0)]
2311
+ ]
2312
+ ] = None,
2313
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2314
+ _content_type: Optional[StrictStr] = None,
2315
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2316
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2317
+ ) -> ApiResponse[Document]:
2318
+ """Upload text as a document to the specified catalog
2319
+
2320
+ Create a document in the specified catalog directly from text in the request body. No file upload is needed and the document is immediately ready for analysis. The request body is capped at 10MB.
2321
+
2322
+ :param catalog_id: Unique identifier of the catalog (required)
2323
+ :type catalog_id: UUID
2324
+ :param upload_text_document_request: (required)
2325
+ :type upload_text_document_request: UploadTextDocumentRequest
2326
+ :param _request_timeout: timeout setting for this request. If one
2327
+ number provided, it will be total request
2328
+ timeout. It can also be a pair (tuple) of
2329
+ (connection, read) timeouts.
2330
+ :type _request_timeout: int, tuple(int, int), optional
2331
+ :param _request_auth: set to override the auth_settings for an a single
2332
+ request; this effectively ignores the
2333
+ authentication in the spec for a single request.
2334
+ :type _request_auth: dict, optional
2335
+ :param _content_type: force content-type for the request.
2336
+ :type _content_type: str, Optional
2337
+ :param _headers: set to override the headers for a single
2338
+ request; this effectively ignores the headers
2339
+ in the spec for a single request.
2340
+ :type _headers: dict, optional
2341
+ :param _host_index: set to override the host_index for a single
2342
+ request; this effectively ignores the host_index
2343
+ in the spec for a single request.
2344
+ :type _host_index: int, optional
2345
+ :return: Returns the result object.
2346
+ """ # noqa: E501
2347
+
2348
+ _param = self._upload_text_document_serialize(
2349
+ catalog_id=catalog_id,
2350
+ upload_text_document_request=upload_text_document_request,
2351
+ _request_auth=_request_auth,
2352
+ _content_type=_content_type,
2353
+ _headers=_headers,
2354
+ _host_index=_host_index
2355
+ )
2356
+
2357
+ _response_types_map: Dict[str, Optional[str]] = {
2358
+ '200': "Document",
2359
+ '400': "str",
2360
+ '401': "str",
2361
+ }
2362
+ response_data = self.api_client.call_api(
2363
+ *_param,
2364
+ _request_timeout=_request_timeout
2365
+ )
2366
+ response_data.read()
2367
+ return self.api_client.response_deserialize(
2368
+ response_data=response_data,
2369
+ response_types_map=_response_types_map,
2370
+ )
2371
+
2372
+
2373
+ @validate_call
2374
+ def upload_text_document_without_preload_content(
2375
+ self,
2376
+ catalog_id: Annotated[UUID, Field(description="Unique identifier of the catalog")],
2377
+ upload_text_document_request: UploadTextDocumentRequest,
2378
+ _request_timeout: Union[
2379
+ None,
2380
+ Annotated[StrictFloat, Field(gt=0)],
2381
+ Tuple[
2382
+ Annotated[StrictFloat, Field(gt=0)],
2383
+ Annotated[StrictFloat, Field(gt=0)]
2384
+ ]
2385
+ ] = None,
2386
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2387
+ _content_type: Optional[StrictStr] = None,
2388
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2389
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2390
+ ) -> RESTResponseType:
2391
+ """Upload text as a document to the specified catalog
2392
+
2393
+ Create a document in the specified catalog directly from text in the request body. No file upload is needed and the document is immediately ready for analysis. The request body is capped at 10MB.
2394
+
2395
+ :param catalog_id: Unique identifier of the catalog (required)
2396
+ :type catalog_id: UUID
2397
+ :param upload_text_document_request: (required)
2398
+ :type upload_text_document_request: UploadTextDocumentRequest
2399
+ :param _request_timeout: timeout setting for this request. If one
2400
+ number provided, it will be total request
2401
+ timeout. It can also be a pair (tuple) of
2402
+ (connection, read) timeouts.
2403
+ :type _request_timeout: int, tuple(int, int), optional
2404
+ :param _request_auth: set to override the auth_settings for an a single
2405
+ request; this effectively ignores the
2406
+ authentication in the spec for a single request.
2407
+ :type _request_auth: dict, optional
2408
+ :param _content_type: force content-type for the request.
2409
+ :type _content_type: str, Optional
2410
+ :param _headers: set to override the headers for a single
2411
+ request; this effectively ignores the headers
2412
+ in the spec for a single request.
2413
+ :type _headers: dict, optional
2414
+ :param _host_index: set to override the host_index for a single
2415
+ request; this effectively ignores the host_index
2416
+ in the spec for a single request.
2417
+ :type _host_index: int, optional
2418
+ :return: Returns the result object.
2419
+ """ # noqa: E501
2420
+
2421
+ _param = self._upload_text_document_serialize(
2422
+ catalog_id=catalog_id,
2423
+ upload_text_document_request=upload_text_document_request,
2424
+ _request_auth=_request_auth,
2425
+ _content_type=_content_type,
2426
+ _headers=_headers,
2427
+ _host_index=_host_index
2428
+ )
2429
+
2430
+ _response_types_map: Dict[str, Optional[str]] = {
2431
+ '200': "Document",
2432
+ '400': "str",
2433
+ '401': "str",
2434
+ }
2435
+ response_data = self.api_client.call_api(
2436
+ *_param,
2437
+ _request_timeout=_request_timeout
2438
+ )
2439
+ return response_data.response
2440
+
2441
+
2442
+ def _upload_text_document_serialize(
2443
+ self,
2444
+ catalog_id,
2445
+ upload_text_document_request,
2446
+ _request_auth,
2447
+ _content_type,
2448
+ _headers,
2449
+ _host_index,
2450
+ ) -> RequestSerialized:
2451
+
2452
+ _host = None
2453
+
2454
+ _collection_formats: Dict[str, str] = {
2455
+ }
2456
+
2457
+ _path_params: Dict[str, str] = {}
2458
+ _query_params: List[Tuple[str, str]] = []
2459
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
2460
+ _form_params: List[Tuple[str, str]] = []
2461
+ _files: Dict[
2462
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2463
+ ] = {}
2464
+ _body_params: Optional[bytes] = None
2465
+
2466
+ # process the path parameters
2467
+ if catalog_id is not None:
2468
+ _path_params['catalogId'] = catalog_id
2469
+ # process the query parameters
2470
+ # process the header parameters
2471
+ # process the form parameters
2472
+ # process the body parameter
2473
+ if upload_text_document_request is not None:
2474
+ _body_params = upload_text_document_request
2475
+
2476
+
2477
+ # set the HTTP header `Accept`
2478
+ if not any(key.lower() == 'accept' for key in _header_params):
2479
+ _header_params['Accept'] = self.api_client.select_header_accept(
2480
+ [
2481
+ 'application/json'
2482
+ ]
2483
+ )
2484
+
2485
+ # set the HTTP header `Content-Type`
2486
+ if _content_type:
2487
+ self.api_client._set_header(_header_params, 'Content-Type', _content_type)
2488
+ else:
2489
+ _default_content_type = (
2490
+ self.api_client.select_header_content_type(
2491
+ [
2492
+ 'application/json'
2493
+ ]
2494
+ )
2495
+ )
2496
+ if _default_content_type is not None:
2497
+ self.api_client._set_header(_header_params, 'Content-Type', _default_content_type)
2498
+
2499
+ # authentication setting
2500
+ _auth_settings: List[str] = [
2501
+ 'bearerAuth'
2502
+ ]
2503
+
2504
+ return self.api_client.param_serialize(
2505
+ method='POST',
2506
+ resource_path='/catalog/{catalogId}/document/text',
2507
+ path_params=_path_params,
2508
+ query_params=_query_params,
2509
+ header_params=_header_params,
2510
+ body=_body_params,
2511
+ post_params=_form_params,
2512
+ files=_files,
2513
+ auth_settings=_auth_settings,
2514
+ collection_formats=_collection_formats,
2515
+ _host=_host,
2516
+ _request_auth=_request_auth
2517
+ )
2518
+
2519
+
2520
+
2521
+
2522
+ @validate_call
2523
+ def upload_text_document_no_catalog(
2524
+ self,
2525
+ upload_text_document_request: UploadTextDocumentRequest,
2526
+ _request_timeout: Union[
2527
+ None,
2528
+ Annotated[StrictFloat, Field(gt=0)],
2529
+ Tuple[
2530
+ Annotated[StrictFloat, Field(gt=0)],
2531
+ Annotated[StrictFloat, Field(gt=0)]
2532
+ ]
2533
+ ] = None,
2534
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2535
+ _content_type: Optional[StrictStr] = None,
2536
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2537
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2538
+ ) -> Document:
2539
+ """Upload text as a document
2540
+
2541
+ Create a document directly from text in the request body. No file upload is needed and the document is immediately ready for analysis. The request body is capped at 10MB.
2542
+
2543
+ :param upload_text_document_request: (required)
2544
+ :type upload_text_document_request: UploadTextDocumentRequest
2545
+ :param _request_timeout: timeout setting for this request. If one
2546
+ number provided, it will be total request
2547
+ timeout. It can also be a pair (tuple) of
2548
+ (connection, read) timeouts.
2549
+ :type _request_timeout: int, tuple(int, int), optional
2550
+ :param _request_auth: set to override the auth_settings for an a single
2551
+ request; this effectively ignores the
2552
+ authentication in the spec for a single request.
2553
+ :type _request_auth: dict, optional
2554
+ :param _content_type: force content-type for the request.
2555
+ :type _content_type: str, Optional
2556
+ :param _headers: set to override the headers for a single
2557
+ request; this effectively ignores the headers
2558
+ in the spec for a single request.
2559
+ :type _headers: dict, optional
2560
+ :param _host_index: set to override the host_index for a single
2561
+ request; this effectively ignores the host_index
2562
+ in the spec for a single request.
2563
+ :type _host_index: int, optional
2564
+ :return: Returns the result object.
2565
+ """ # noqa: E501
2566
+
2567
+ _param = self._upload_text_document_no_catalog_serialize(
2568
+ upload_text_document_request=upload_text_document_request,
2569
+ _request_auth=_request_auth,
2570
+ _content_type=_content_type,
2571
+ _headers=_headers,
2572
+ _host_index=_host_index
2573
+ )
2574
+
2575
+ _response_types_map: Dict[str, Optional[str]] = {
2576
+ '200': "Document",
2577
+ '400': "str",
2578
+ '401': "str",
2579
+ }
2580
+ response_data = self.api_client.call_api(
2581
+ *_param,
2582
+ _request_timeout=_request_timeout
2583
+ )
2584
+ response_data.read()
2585
+ return self.api_client.response_deserialize(
2586
+ response_data=response_data,
2587
+ response_types_map=_response_types_map,
2588
+ ).data
2589
+
2590
+
2591
+ @validate_call
2592
+ def upload_text_document_no_catalog_with_http_info(
2593
+ self,
2594
+ upload_text_document_request: UploadTextDocumentRequest,
2595
+ _request_timeout: Union[
2596
+ None,
2597
+ Annotated[StrictFloat, Field(gt=0)],
2598
+ Tuple[
2599
+ Annotated[StrictFloat, Field(gt=0)],
2600
+ Annotated[StrictFloat, Field(gt=0)]
2601
+ ]
2602
+ ] = None,
2603
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2604
+ _content_type: Optional[StrictStr] = None,
2605
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2606
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2607
+ ) -> ApiResponse[Document]:
2608
+ """Upload text as a document
2609
+
2610
+ Create a document directly from text in the request body. No file upload is needed and the document is immediately ready for analysis. The request body is capped at 10MB.
2611
+
2612
+ :param upload_text_document_request: (required)
2613
+ :type upload_text_document_request: UploadTextDocumentRequest
2614
+ :param _request_timeout: timeout setting for this request. If one
2615
+ number provided, it will be total request
2616
+ timeout. It can also be a pair (tuple) of
2617
+ (connection, read) timeouts.
2618
+ :type _request_timeout: int, tuple(int, int), optional
2619
+ :param _request_auth: set to override the auth_settings for an a single
2620
+ request; this effectively ignores the
2621
+ authentication in the spec for a single request.
2622
+ :type _request_auth: dict, optional
2623
+ :param _content_type: force content-type for the request.
2624
+ :type _content_type: str, Optional
2625
+ :param _headers: set to override the headers for a single
2626
+ request; this effectively ignores the headers
2627
+ in the spec for a single request.
2628
+ :type _headers: dict, optional
2629
+ :param _host_index: set to override the host_index for a single
2630
+ request; this effectively ignores the host_index
2631
+ in the spec for a single request.
2632
+ :type _host_index: int, optional
2633
+ :return: Returns the result object.
2634
+ """ # noqa: E501
2635
+
2636
+ _param = self._upload_text_document_no_catalog_serialize(
2637
+ upload_text_document_request=upload_text_document_request,
2638
+ _request_auth=_request_auth,
2639
+ _content_type=_content_type,
2640
+ _headers=_headers,
2641
+ _host_index=_host_index
2642
+ )
2643
+
2644
+ _response_types_map: Dict[str, Optional[str]] = {
2645
+ '200': "Document",
2646
+ '400': "str",
2647
+ '401': "str",
2648
+ }
2649
+ response_data = self.api_client.call_api(
2650
+ *_param,
2651
+ _request_timeout=_request_timeout
2652
+ )
2653
+ response_data.read()
2654
+ return self.api_client.response_deserialize(
2655
+ response_data=response_data,
2656
+ response_types_map=_response_types_map,
2657
+ )
2658
+
2659
+
2660
+ @validate_call
2661
+ def upload_text_document_no_catalog_without_preload_content(
2662
+ self,
2663
+ upload_text_document_request: UploadTextDocumentRequest,
2664
+ _request_timeout: Union[
2665
+ None,
2666
+ Annotated[StrictFloat, Field(gt=0)],
2667
+ Tuple[
2668
+ Annotated[StrictFloat, Field(gt=0)],
2669
+ Annotated[StrictFloat, Field(gt=0)]
2670
+ ]
2671
+ ] = None,
2672
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2673
+ _content_type: Optional[StrictStr] = None,
2674
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2675
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2676
+ ) -> RESTResponseType:
2677
+ """Upload text as a document
2678
+
2679
+ Create a document directly from text in the request body. No file upload is needed and the document is immediately ready for analysis. The request body is capped at 10MB.
2680
+
2681
+ :param upload_text_document_request: (required)
2682
+ :type upload_text_document_request: UploadTextDocumentRequest
2683
+ :param _request_timeout: timeout setting for this request. If one
2684
+ number provided, it will be total request
2685
+ timeout. It can also be a pair (tuple) of
2686
+ (connection, read) timeouts.
2687
+ :type _request_timeout: int, tuple(int, int), optional
2688
+ :param _request_auth: set to override the auth_settings for an a single
2689
+ request; this effectively ignores the
2690
+ authentication in the spec for a single request.
2691
+ :type _request_auth: dict, optional
2692
+ :param _content_type: force content-type for the request.
2693
+ :type _content_type: str, Optional
2694
+ :param _headers: set to override the headers for a single
2695
+ request; this effectively ignores the headers
2696
+ in the spec for a single request.
2697
+ :type _headers: dict, optional
2698
+ :param _host_index: set to override the host_index for a single
2699
+ request; this effectively ignores the host_index
2700
+ in the spec for a single request.
2701
+ :type _host_index: int, optional
2702
+ :return: Returns the result object.
2703
+ """ # noqa: E501
2704
+
2705
+ _param = self._upload_text_document_no_catalog_serialize(
2706
+ upload_text_document_request=upload_text_document_request,
2707
+ _request_auth=_request_auth,
2708
+ _content_type=_content_type,
2709
+ _headers=_headers,
2710
+ _host_index=_host_index
2711
+ )
2712
+
2713
+ _response_types_map: Dict[str, Optional[str]] = {
2714
+ '200': "Document",
2715
+ '400': "str",
2716
+ '401': "str",
2717
+ }
2718
+ response_data = self.api_client.call_api(
2719
+ *_param,
2720
+ _request_timeout=_request_timeout
2721
+ )
2722
+ return response_data.response
2723
+
2724
+
2725
+ def _upload_text_document_no_catalog_serialize(
2726
+ self,
2727
+ upload_text_document_request,
2728
+ _request_auth,
2729
+ _content_type,
2730
+ _headers,
2731
+ _host_index,
2732
+ ) -> RequestSerialized:
2733
+
2734
+ _host = None
2735
+
2736
+ _collection_formats: Dict[str, str] = {
2737
+ }
2738
+
2739
+ _path_params: Dict[str, str] = {}
2740
+ _query_params: List[Tuple[str, str]] = []
2741
+ _header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
2742
+ _form_params: List[Tuple[str, str]] = []
2743
+ _files: Dict[
2744
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2745
+ ] = {}
2746
+ _body_params: Optional[bytes] = None
2747
+
2748
+ # process the path parameters
2749
+ # process the query parameters
2750
+ # process the header parameters
2751
+ # process the form parameters
2752
+ # process the body parameter
2753
+ if upload_text_document_request is not None:
2754
+ _body_params = upload_text_document_request
2755
+
2756
+
2757
+ # set the HTTP header `Accept`
2758
+ if not any(key.lower() == 'accept' for key in _header_params):
2759
+ _header_params['Accept'] = self.api_client.select_header_accept(
2760
+ [
2761
+ 'application/json'
2762
+ ]
2763
+ )
2764
+
2765
+ # set the HTTP header `Content-Type`
2766
+ if _content_type:
2767
+ self.api_client._set_header(_header_params, 'Content-Type', _content_type)
2768
+ else:
2769
+ _default_content_type = (
2770
+ self.api_client.select_header_content_type(
2771
+ [
2772
+ 'application/json'
2773
+ ]
2774
+ )
2775
+ )
2776
+ if _default_content_type is not None:
2777
+ self.api_client._set_header(_header_params, 'Content-Type', _default_content_type)
2778
+
2779
+ # authentication setting
2780
+ _auth_settings: List[str] = [
2781
+ 'bearerAuth'
2782
+ ]
2783
+
2784
+ return self.api_client.param_serialize(
2785
+ method='POST',
2786
+ resource_path='/document/text',
2787
+ path_params=_path_params,
2788
+ query_params=_query_params,
2789
+ header_params=_header_params,
2790
+ body=_body_params,
2791
+ post_params=_form_params,
2792
+ files=_files,
2793
+ auth_settings=_auth_settings,
2794
+ collection_formats=_collection_formats,
2795
+ _host=_host,
2796
+ _request_auth=_request_auth
2797
+ )
2798
+
2799
+