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