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.
- stract_api/__init__.py +141 -0
- stract_api/api/__init__.py +16 -0
- stract_api/api/account_api.py +1098 -0
- stract_api/api/account_credit_ledger_api.py +286 -0
- stract_api/api/api_key_api.py +286 -0
- stract_api/api/catalog_api.py +837 -0
- stract_api/api/credits_api.py +534 -0
- stract_api/api/document_api.py +2799 -0
- stract_api/api/field_api.py +1168 -0
- stract_api/api/job_api.py +2857 -0
- stract_api/api/job_document_api.py +575 -0
- stract_api/api/llm_model_api.py +286 -0
- stract_api/api/struct_api.py +837 -0
- stract_api/api/user_api.py +572 -0
- stract_api/api_client.py +866 -0
- stract_api/api_response.py +21 -0
- stract_api/configuration.py +655 -0
- stract_api/exceptions.py +219 -0
- stract_api/models/__init__.py +52 -0
- stract_api/models/account.py +130 -0
- stract_api/models/account_credit_cache.py +112 -0
- stract_api/models/account_credit_ledger.py +125 -0
- stract_api/models/account_user.py +104 -0
- stract_api/models/account_user_role.py +38 -0
- stract_api/models/api_key.py +102 -0
- stract_api/models/catalog.py +100 -0
- stract_api/models/create_account_user_request.py +97 -0
- stract_api/models/create_catalog_request.py +90 -0
- stract_api/models/create_field_request.py +102 -0
- stract_api/models/create_job_request.py +109 -0
- stract_api/models/create_struct_request.py +90 -0
- stract_api/models/deleted_document.py +91 -0
- stract_api/models/deleted_field.py +91 -0
- stract_api/models/document.py +107 -0
- stract_api/models/document_link.py +90 -0
- stract_api/models/document_processing_status.py +39 -0
- stract_api/models/document_text.py +95 -0
- stract_api/models/edit_account_request.py +90 -0
- stract_api/models/edit_field_request.py +102 -0
- stract_api/models/edit_my_user_request.py +92 -0
- stract_api/models/field_type.py +42 -0
- stract_api/models/job.py +129 -0
- stract_api/models/job_document.py +123 -0
- stract_api/models/job_output.py +98 -0
- stract_api/models/job_output_record.py +103 -0
- stract_api/models/job_status.py +41 -0
- stract_api/models/llm_model.py +126 -0
- stract_api/models/login_request.py +92 -0
- stract_api/models/login_response.py +90 -0
- stract_api/models/model_field.py +110 -0
- stract_api/models/struct.py +100 -0
- stract_api/models/sync_text_job_request.py +118 -0
- stract_api/models/upload_text_document_request.py +93 -0
- stract_api/models/user.py +102 -0
- stract_api/py.typed +0 -0
- stract_api/rest.py +335 -0
- stract_api-0.1.0.dist-info/METADATA +266 -0
- stract_api-0.1.0.dist-info/RECORD +61 -0
- stract_api-0.1.0.dist-info/WHEEL +5 -0
- stract_api-0.1.0.dist-info/licenses/LICENSE +21 -0
- stract_api-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,837 @@
|
|
|
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
|
|
20
|
+
from typing import List
|
|
21
|
+
from typing_extensions import Annotated
|
|
22
|
+
from uuid import UUID
|
|
23
|
+
from stract_api.models.create_struct_request import CreateStructRequest
|
|
24
|
+
from stract_api.models.struct import Struct
|
|
25
|
+
|
|
26
|
+
from stract_api.api_client import ApiClient, RequestSerialized
|
|
27
|
+
from stract_api.api_response import ApiResponse
|
|
28
|
+
from stract_api.rest import RESTResponseType
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class StructApi:
|
|
32
|
+
"""NOTE: This class is auto generated by OpenAPI Generator
|
|
33
|
+
Ref: https://openapi-generator.tech
|
|
34
|
+
|
|
35
|
+
Do not edit the class manually.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def __init__(self, api_client=None) -> None:
|
|
39
|
+
if api_client is None:
|
|
40
|
+
api_client = ApiClient.get_default()
|
|
41
|
+
self.api_client = api_client
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@validate_call
|
|
45
|
+
def archive_struct(
|
|
46
|
+
self,
|
|
47
|
+
struct_id: Annotated[UUID, Field(description="Unique identifier of the struct")],
|
|
48
|
+
_request_timeout: Union[
|
|
49
|
+
None,
|
|
50
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
51
|
+
Tuple[
|
|
52
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
53
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
54
|
+
]
|
|
55
|
+
] = None,
|
|
56
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
57
|
+
_content_type: Optional[StrictStr] = None,
|
|
58
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
59
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
60
|
+
) -> UUID:
|
|
61
|
+
"""Archive a struct
|
|
62
|
+
|
|
63
|
+
Marks the specified struct as archived
|
|
64
|
+
|
|
65
|
+
:param struct_id: Unique identifier of the struct (required)
|
|
66
|
+
:type struct_id: UUID
|
|
67
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
68
|
+
number provided, it will be total request
|
|
69
|
+
timeout. It can also be a pair (tuple) of
|
|
70
|
+
(connection, read) timeouts.
|
|
71
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
72
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
73
|
+
request; this effectively ignores the
|
|
74
|
+
authentication in the spec for a single request.
|
|
75
|
+
:type _request_auth: dict, optional
|
|
76
|
+
:param _content_type: force content-type for the request.
|
|
77
|
+
:type _content_type: str, Optional
|
|
78
|
+
:param _headers: set to override the headers for a single
|
|
79
|
+
request; this effectively ignores the headers
|
|
80
|
+
in the spec for a single request.
|
|
81
|
+
:type _headers: dict, optional
|
|
82
|
+
:param _host_index: set to override the host_index for a single
|
|
83
|
+
request; this effectively ignores the host_index
|
|
84
|
+
in the spec for a single request.
|
|
85
|
+
:type _host_index: int, optional
|
|
86
|
+
:return: Returns the result object.
|
|
87
|
+
""" # noqa: E501
|
|
88
|
+
|
|
89
|
+
_param = self._archive_struct_serialize(
|
|
90
|
+
struct_id=struct_id,
|
|
91
|
+
_request_auth=_request_auth,
|
|
92
|
+
_content_type=_content_type,
|
|
93
|
+
_headers=_headers,
|
|
94
|
+
_host_index=_host_index
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
98
|
+
'200': "UUID",
|
|
99
|
+
'400': "str",
|
|
100
|
+
'401': "str",
|
|
101
|
+
}
|
|
102
|
+
response_data = self.api_client.call_api(
|
|
103
|
+
*_param,
|
|
104
|
+
_request_timeout=_request_timeout
|
|
105
|
+
)
|
|
106
|
+
response_data.read()
|
|
107
|
+
return self.api_client.response_deserialize(
|
|
108
|
+
response_data=response_data,
|
|
109
|
+
response_types_map=_response_types_map,
|
|
110
|
+
).data
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@validate_call
|
|
114
|
+
def archive_struct_with_http_info(
|
|
115
|
+
self,
|
|
116
|
+
struct_id: Annotated[UUID, Field(description="Unique identifier of the struct")],
|
|
117
|
+
_request_timeout: Union[
|
|
118
|
+
None,
|
|
119
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
120
|
+
Tuple[
|
|
121
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
122
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
123
|
+
]
|
|
124
|
+
] = None,
|
|
125
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
126
|
+
_content_type: Optional[StrictStr] = None,
|
|
127
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
128
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
129
|
+
) -> ApiResponse[UUID]:
|
|
130
|
+
"""Archive a struct
|
|
131
|
+
|
|
132
|
+
Marks the specified struct as archived
|
|
133
|
+
|
|
134
|
+
:param struct_id: Unique identifier of the struct (required)
|
|
135
|
+
:type struct_id: UUID
|
|
136
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
137
|
+
number provided, it will be total request
|
|
138
|
+
timeout. It can also be a pair (tuple) of
|
|
139
|
+
(connection, read) timeouts.
|
|
140
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
141
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
142
|
+
request; this effectively ignores the
|
|
143
|
+
authentication in the spec for a single request.
|
|
144
|
+
:type _request_auth: dict, optional
|
|
145
|
+
:param _content_type: force content-type for the request.
|
|
146
|
+
:type _content_type: str, Optional
|
|
147
|
+
:param _headers: set to override the headers for a single
|
|
148
|
+
request; this effectively ignores the headers
|
|
149
|
+
in the spec for a single request.
|
|
150
|
+
:type _headers: dict, optional
|
|
151
|
+
:param _host_index: set to override the host_index for a single
|
|
152
|
+
request; this effectively ignores the host_index
|
|
153
|
+
in the spec for a single request.
|
|
154
|
+
:type _host_index: int, optional
|
|
155
|
+
:return: Returns the result object.
|
|
156
|
+
""" # noqa: E501
|
|
157
|
+
|
|
158
|
+
_param = self._archive_struct_serialize(
|
|
159
|
+
struct_id=struct_id,
|
|
160
|
+
_request_auth=_request_auth,
|
|
161
|
+
_content_type=_content_type,
|
|
162
|
+
_headers=_headers,
|
|
163
|
+
_host_index=_host_index
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
167
|
+
'200': "UUID",
|
|
168
|
+
'400': "str",
|
|
169
|
+
'401': "str",
|
|
170
|
+
}
|
|
171
|
+
response_data = self.api_client.call_api(
|
|
172
|
+
*_param,
|
|
173
|
+
_request_timeout=_request_timeout
|
|
174
|
+
)
|
|
175
|
+
response_data.read()
|
|
176
|
+
return self.api_client.response_deserialize(
|
|
177
|
+
response_data=response_data,
|
|
178
|
+
response_types_map=_response_types_map,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
@validate_call
|
|
183
|
+
def archive_struct_without_preload_content(
|
|
184
|
+
self,
|
|
185
|
+
struct_id: Annotated[UUID, Field(description="Unique identifier of the struct")],
|
|
186
|
+
_request_timeout: Union[
|
|
187
|
+
None,
|
|
188
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
189
|
+
Tuple[
|
|
190
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
191
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
192
|
+
]
|
|
193
|
+
] = None,
|
|
194
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
195
|
+
_content_type: Optional[StrictStr] = None,
|
|
196
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
197
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
198
|
+
) -> RESTResponseType:
|
|
199
|
+
"""Archive a struct
|
|
200
|
+
|
|
201
|
+
Marks the specified struct as archived
|
|
202
|
+
|
|
203
|
+
:param struct_id: Unique identifier of the struct (required)
|
|
204
|
+
:type struct_id: UUID
|
|
205
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
206
|
+
number provided, it will be total request
|
|
207
|
+
timeout. It can also be a pair (tuple) of
|
|
208
|
+
(connection, read) timeouts.
|
|
209
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
210
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
211
|
+
request; this effectively ignores the
|
|
212
|
+
authentication in the spec for a single request.
|
|
213
|
+
:type _request_auth: dict, optional
|
|
214
|
+
:param _content_type: force content-type for the request.
|
|
215
|
+
:type _content_type: str, Optional
|
|
216
|
+
:param _headers: set to override the headers for a single
|
|
217
|
+
request; this effectively ignores the headers
|
|
218
|
+
in the spec for a single request.
|
|
219
|
+
:type _headers: dict, optional
|
|
220
|
+
:param _host_index: set to override the host_index for a single
|
|
221
|
+
request; this effectively ignores the host_index
|
|
222
|
+
in the spec for a single request.
|
|
223
|
+
:type _host_index: int, optional
|
|
224
|
+
:return: Returns the result object.
|
|
225
|
+
""" # noqa: E501
|
|
226
|
+
|
|
227
|
+
_param = self._archive_struct_serialize(
|
|
228
|
+
struct_id=struct_id,
|
|
229
|
+
_request_auth=_request_auth,
|
|
230
|
+
_content_type=_content_type,
|
|
231
|
+
_headers=_headers,
|
|
232
|
+
_host_index=_host_index
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
236
|
+
'200': "UUID",
|
|
237
|
+
'400': "str",
|
|
238
|
+
'401': "str",
|
|
239
|
+
}
|
|
240
|
+
response_data = self.api_client.call_api(
|
|
241
|
+
*_param,
|
|
242
|
+
_request_timeout=_request_timeout
|
|
243
|
+
)
|
|
244
|
+
return response_data.response
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def _archive_struct_serialize(
|
|
248
|
+
self,
|
|
249
|
+
struct_id,
|
|
250
|
+
_request_auth,
|
|
251
|
+
_content_type,
|
|
252
|
+
_headers,
|
|
253
|
+
_host_index,
|
|
254
|
+
) -> RequestSerialized:
|
|
255
|
+
|
|
256
|
+
_host = None
|
|
257
|
+
|
|
258
|
+
_collection_formats: Dict[str, str] = {
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
_path_params: Dict[str, str] = {}
|
|
262
|
+
_query_params: List[Tuple[str, str]] = []
|
|
263
|
+
_header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
|
|
264
|
+
_form_params: List[Tuple[str, str]] = []
|
|
265
|
+
_files: Dict[
|
|
266
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
267
|
+
] = {}
|
|
268
|
+
_body_params: Optional[bytes] = None
|
|
269
|
+
|
|
270
|
+
# process the path parameters
|
|
271
|
+
if struct_id is not None:
|
|
272
|
+
_path_params['structId'] = struct_id
|
|
273
|
+
# process the query parameters
|
|
274
|
+
# process the header parameters
|
|
275
|
+
# process the form parameters
|
|
276
|
+
# process the body parameter
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
# set the HTTP header `Accept`
|
|
280
|
+
if not any(key.lower() == 'accept' for key in _header_params):
|
|
281
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
282
|
+
[
|
|
283
|
+
'application/json'
|
|
284
|
+
]
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
# authentication setting
|
|
289
|
+
_auth_settings: List[str] = [
|
|
290
|
+
'bearerAuth'
|
|
291
|
+
]
|
|
292
|
+
|
|
293
|
+
return self.api_client.param_serialize(
|
|
294
|
+
method='POST',
|
|
295
|
+
resource_path='/struct/{structId}/archive',
|
|
296
|
+
path_params=_path_params,
|
|
297
|
+
query_params=_query_params,
|
|
298
|
+
header_params=_header_params,
|
|
299
|
+
body=_body_params,
|
|
300
|
+
post_params=_form_params,
|
|
301
|
+
files=_files,
|
|
302
|
+
auth_settings=_auth_settings,
|
|
303
|
+
collection_formats=_collection_formats,
|
|
304
|
+
_host=_host,
|
|
305
|
+
_request_auth=_request_auth
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
@validate_call
|
|
312
|
+
def create_struct(
|
|
313
|
+
self,
|
|
314
|
+
create_struct_request: CreateStructRequest,
|
|
315
|
+
_request_timeout: Union[
|
|
316
|
+
None,
|
|
317
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
318
|
+
Tuple[
|
|
319
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
320
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
321
|
+
]
|
|
322
|
+
] = None,
|
|
323
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
324
|
+
_content_type: Optional[StrictStr] = None,
|
|
325
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
326
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
327
|
+
) -> Struct:
|
|
328
|
+
"""Create a new data structure
|
|
329
|
+
|
|
330
|
+
Create a new data structure to be used in document analysis
|
|
331
|
+
|
|
332
|
+
:param create_struct_request: (required)
|
|
333
|
+
:type create_struct_request: CreateStructRequest
|
|
334
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
335
|
+
number provided, it will be total request
|
|
336
|
+
timeout. It can also be a pair (tuple) of
|
|
337
|
+
(connection, read) timeouts.
|
|
338
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
339
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
340
|
+
request; this effectively ignores the
|
|
341
|
+
authentication in the spec for a single request.
|
|
342
|
+
:type _request_auth: dict, optional
|
|
343
|
+
:param _content_type: force content-type for the request.
|
|
344
|
+
:type _content_type: str, Optional
|
|
345
|
+
:param _headers: set to override the headers for a single
|
|
346
|
+
request; this effectively ignores the headers
|
|
347
|
+
in the spec for a single request.
|
|
348
|
+
:type _headers: dict, optional
|
|
349
|
+
:param _host_index: set to override the host_index for a single
|
|
350
|
+
request; this effectively ignores the host_index
|
|
351
|
+
in the spec for a single request.
|
|
352
|
+
:type _host_index: int, optional
|
|
353
|
+
:return: Returns the result object.
|
|
354
|
+
""" # noqa: E501
|
|
355
|
+
|
|
356
|
+
_param = self._create_struct_serialize(
|
|
357
|
+
create_struct_request=create_struct_request,
|
|
358
|
+
_request_auth=_request_auth,
|
|
359
|
+
_content_type=_content_type,
|
|
360
|
+
_headers=_headers,
|
|
361
|
+
_host_index=_host_index
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
365
|
+
'200': "Struct",
|
|
366
|
+
'400': "str",
|
|
367
|
+
'401': "str",
|
|
368
|
+
}
|
|
369
|
+
response_data = self.api_client.call_api(
|
|
370
|
+
*_param,
|
|
371
|
+
_request_timeout=_request_timeout
|
|
372
|
+
)
|
|
373
|
+
response_data.read()
|
|
374
|
+
return self.api_client.response_deserialize(
|
|
375
|
+
response_data=response_data,
|
|
376
|
+
response_types_map=_response_types_map,
|
|
377
|
+
).data
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
@validate_call
|
|
381
|
+
def create_struct_with_http_info(
|
|
382
|
+
self,
|
|
383
|
+
create_struct_request: CreateStructRequest,
|
|
384
|
+
_request_timeout: Union[
|
|
385
|
+
None,
|
|
386
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
387
|
+
Tuple[
|
|
388
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
389
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
390
|
+
]
|
|
391
|
+
] = None,
|
|
392
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
393
|
+
_content_type: Optional[StrictStr] = None,
|
|
394
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
395
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
396
|
+
) -> ApiResponse[Struct]:
|
|
397
|
+
"""Create a new data structure
|
|
398
|
+
|
|
399
|
+
Create a new data structure to be used in document analysis
|
|
400
|
+
|
|
401
|
+
:param create_struct_request: (required)
|
|
402
|
+
:type create_struct_request: CreateStructRequest
|
|
403
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
404
|
+
number provided, it will be total request
|
|
405
|
+
timeout. It can also be a pair (tuple) of
|
|
406
|
+
(connection, read) timeouts.
|
|
407
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
408
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
409
|
+
request; this effectively ignores the
|
|
410
|
+
authentication in the spec for a single request.
|
|
411
|
+
:type _request_auth: dict, optional
|
|
412
|
+
:param _content_type: force content-type for the request.
|
|
413
|
+
:type _content_type: str, Optional
|
|
414
|
+
:param _headers: set to override the headers for a single
|
|
415
|
+
request; this effectively ignores the headers
|
|
416
|
+
in the spec for a single request.
|
|
417
|
+
:type _headers: dict, optional
|
|
418
|
+
:param _host_index: set to override the host_index for a single
|
|
419
|
+
request; this effectively ignores the host_index
|
|
420
|
+
in the spec for a single request.
|
|
421
|
+
:type _host_index: int, optional
|
|
422
|
+
:return: Returns the result object.
|
|
423
|
+
""" # noqa: E501
|
|
424
|
+
|
|
425
|
+
_param = self._create_struct_serialize(
|
|
426
|
+
create_struct_request=create_struct_request,
|
|
427
|
+
_request_auth=_request_auth,
|
|
428
|
+
_content_type=_content_type,
|
|
429
|
+
_headers=_headers,
|
|
430
|
+
_host_index=_host_index
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
434
|
+
'200': "Struct",
|
|
435
|
+
'400': "str",
|
|
436
|
+
'401': "str",
|
|
437
|
+
}
|
|
438
|
+
response_data = self.api_client.call_api(
|
|
439
|
+
*_param,
|
|
440
|
+
_request_timeout=_request_timeout
|
|
441
|
+
)
|
|
442
|
+
response_data.read()
|
|
443
|
+
return self.api_client.response_deserialize(
|
|
444
|
+
response_data=response_data,
|
|
445
|
+
response_types_map=_response_types_map,
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
@validate_call
|
|
450
|
+
def create_struct_without_preload_content(
|
|
451
|
+
self,
|
|
452
|
+
create_struct_request: CreateStructRequest,
|
|
453
|
+
_request_timeout: Union[
|
|
454
|
+
None,
|
|
455
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
456
|
+
Tuple[
|
|
457
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
458
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
459
|
+
]
|
|
460
|
+
] = None,
|
|
461
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
462
|
+
_content_type: Optional[StrictStr] = None,
|
|
463
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
464
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
465
|
+
) -> RESTResponseType:
|
|
466
|
+
"""Create a new data structure
|
|
467
|
+
|
|
468
|
+
Create a new data structure to be used in document analysis
|
|
469
|
+
|
|
470
|
+
:param create_struct_request: (required)
|
|
471
|
+
:type create_struct_request: CreateStructRequest
|
|
472
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
473
|
+
number provided, it will be total request
|
|
474
|
+
timeout. It can also be a pair (tuple) of
|
|
475
|
+
(connection, read) timeouts.
|
|
476
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
477
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
478
|
+
request; this effectively ignores the
|
|
479
|
+
authentication in the spec for a single request.
|
|
480
|
+
:type _request_auth: dict, optional
|
|
481
|
+
:param _content_type: force content-type for the request.
|
|
482
|
+
:type _content_type: str, Optional
|
|
483
|
+
:param _headers: set to override the headers for a single
|
|
484
|
+
request; this effectively ignores the headers
|
|
485
|
+
in the spec for a single request.
|
|
486
|
+
:type _headers: dict, optional
|
|
487
|
+
:param _host_index: set to override the host_index for a single
|
|
488
|
+
request; this effectively ignores the host_index
|
|
489
|
+
in the spec for a single request.
|
|
490
|
+
:type _host_index: int, optional
|
|
491
|
+
:return: Returns the result object.
|
|
492
|
+
""" # noqa: E501
|
|
493
|
+
|
|
494
|
+
_param = self._create_struct_serialize(
|
|
495
|
+
create_struct_request=create_struct_request,
|
|
496
|
+
_request_auth=_request_auth,
|
|
497
|
+
_content_type=_content_type,
|
|
498
|
+
_headers=_headers,
|
|
499
|
+
_host_index=_host_index
|
|
500
|
+
)
|
|
501
|
+
|
|
502
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
503
|
+
'200': "Struct",
|
|
504
|
+
'400': "str",
|
|
505
|
+
'401': "str",
|
|
506
|
+
}
|
|
507
|
+
response_data = self.api_client.call_api(
|
|
508
|
+
*_param,
|
|
509
|
+
_request_timeout=_request_timeout
|
|
510
|
+
)
|
|
511
|
+
return response_data.response
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
def _create_struct_serialize(
|
|
515
|
+
self,
|
|
516
|
+
create_struct_request,
|
|
517
|
+
_request_auth,
|
|
518
|
+
_content_type,
|
|
519
|
+
_headers,
|
|
520
|
+
_host_index,
|
|
521
|
+
) -> RequestSerialized:
|
|
522
|
+
|
|
523
|
+
_host = None
|
|
524
|
+
|
|
525
|
+
_collection_formats: Dict[str, str] = {
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
_path_params: Dict[str, str] = {}
|
|
529
|
+
_query_params: List[Tuple[str, str]] = []
|
|
530
|
+
_header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
|
|
531
|
+
_form_params: List[Tuple[str, str]] = []
|
|
532
|
+
_files: Dict[
|
|
533
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
534
|
+
] = {}
|
|
535
|
+
_body_params: Optional[bytes] = None
|
|
536
|
+
|
|
537
|
+
# process the path parameters
|
|
538
|
+
# process the query parameters
|
|
539
|
+
# process the header parameters
|
|
540
|
+
# process the form parameters
|
|
541
|
+
# process the body parameter
|
|
542
|
+
if create_struct_request is not None:
|
|
543
|
+
_body_params = create_struct_request
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
# set the HTTP header `Accept`
|
|
547
|
+
if not any(key.lower() == 'accept' for key in _header_params):
|
|
548
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
549
|
+
[
|
|
550
|
+
'application/json'
|
|
551
|
+
]
|
|
552
|
+
)
|
|
553
|
+
|
|
554
|
+
# set the HTTP header `Content-Type`
|
|
555
|
+
if _content_type:
|
|
556
|
+
self.api_client._set_header(_header_params, 'Content-Type', _content_type)
|
|
557
|
+
else:
|
|
558
|
+
_default_content_type = (
|
|
559
|
+
self.api_client.select_header_content_type(
|
|
560
|
+
[
|
|
561
|
+
'application/json'
|
|
562
|
+
]
|
|
563
|
+
)
|
|
564
|
+
)
|
|
565
|
+
if _default_content_type is not None:
|
|
566
|
+
self.api_client._set_header(_header_params, 'Content-Type', _default_content_type)
|
|
567
|
+
|
|
568
|
+
# authentication setting
|
|
569
|
+
_auth_settings: List[str] = [
|
|
570
|
+
'bearerAuth'
|
|
571
|
+
]
|
|
572
|
+
|
|
573
|
+
return self.api_client.param_serialize(
|
|
574
|
+
method='POST',
|
|
575
|
+
resource_path='/struct',
|
|
576
|
+
path_params=_path_params,
|
|
577
|
+
query_params=_query_params,
|
|
578
|
+
header_params=_header_params,
|
|
579
|
+
body=_body_params,
|
|
580
|
+
post_params=_form_params,
|
|
581
|
+
files=_files,
|
|
582
|
+
auth_settings=_auth_settings,
|
|
583
|
+
collection_formats=_collection_formats,
|
|
584
|
+
_host=_host,
|
|
585
|
+
_request_auth=_request_auth
|
|
586
|
+
)
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
@validate_call
|
|
592
|
+
def get_structs(
|
|
593
|
+
self,
|
|
594
|
+
_request_timeout: Union[
|
|
595
|
+
None,
|
|
596
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
597
|
+
Tuple[
|
|
598
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
599
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
600
|
+
]
|
|
601
|
+
] = None,
|
|
602
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
603
|
+
_content_type: Optional[StrictStr] = None,
|
|
604
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
605
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
606
|
+
) -> List[Struct]:
|
|
607
|
+
"""Get all data structures
|
|
608
|
+
|
|
609
|
+
Retrieve all data structures for user
|
|
610
|
+
|
|
611
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
612
|
+
number provided, it will be total request
|
|
613
|
+
timeout. It can also be a pair (tuple) of
|
|
614
|
+
(connection, read) timeouts.
|
|
615
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
616
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
617
|
+
request; this effectively ignores the
|
|
618
|
+
authentication in the spec for a single request.
|
|
619
|
+
:type _request_auth: dict, optional
|
|
620
|
+
:param _content_type: force content-type for the request.
|
|
621
|
+
:type _content_type: str, Optional
|
|
622
|
+
:param _headers: set to override the headers for a single
|
|
623
|
+
request; this effectively ignores the headers
|
|
624
|
+
in the spec for a single request.
|
|
625
|
+
:type _headers: dict, optional
|
|
626
|
+
:param _host_index: set to override the host_index for a single
|
|
627
|
+
request; this effectively ignores the host_index
|
|
628
|
+
in the spec for a single request.
|
|
629
|
+
:type _host_index: int, optional
|
|
630
|
+
:return: Returns the result object.
|
|
631
|
+
""" # noqa: E501
|
|
632
|
+
|
|
633
|
+
_param = self._get_structs_serialize(
|
|
634
|
+
_request_auth=_request_auth,
|
|
635
|
+
_content_type=_content_type,
|
|
636
|
+
_headers=_headers,
|
|
637
|
+
_host_index=_host_index
|
|
638
|
+
)
|
|
639
|
+
|
|
640
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
641
|
+
'200': "List[Struct]",
|
|
642
|
+
'401': "str",
|
|
643
|
+
}
|
|
644
|
+
response_data = self.api_client.call_api(
|
|
645
|
+
*_param,
|
|
646
|
+
_request_timeout=_request_timeout
|
|
647
|
+
)
|
|
648
|
+
response_data.read()
|
|
649
|
+
return self.api_client.response_deserialize(
|
|
650
|
+
response_data=response_data,
|
|
651
|
+
response_types_map=_response_types_map,
|
|
652
|
+
).data
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
@validate_call
|
|
656
|
+
def get_structs_with_http_info(
|
|
657
|
+
self,
|
|
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[List[Struct]]:
|
|
671
|
+
"""Get all data structures
|
|
672
|
+
|
|
673
|
+
Retrieve all data structures for user
|
|
674
|
+
|
|
675
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
676
|
+
number provided, it will be total request
|
|
677
|
+
timeout. It can also be a pair (tuple) of
|
|
678
|
+
(connection, read) timeouts.
|
|
679
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
680
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
681
|
+
request; this effectively ignores the
|
|
682
|
+
authentication in the spec for a single request.
|
|
683
|
+
:type _request_auth: dict, optional
|
|
684
|
+
:param _content_type: force content-type for the request.
|
|
685
|
+
:type _content_type: str, Optional
|
|
686
|
+
:param _headers: set to override the headers for a single
|
|
687
|
+
request; this effectively ignores the headers
|
|
688
|
+
in the spec for a single request.
|
|
689
|
+
:type _headers: dict, optional
|
|
690
|
+
:param _host_index: set to override the host_index for a single
|
|
691
|
+
request; this effectively ignores the host_index
|
|
692
|
+
in the spec for a single request.
|
|
693
|
+
:type _host_index: int, optional
|
|
694
|
+
:return: Returns the result object.
|
|
695
|
+
""" # noqa: E501
|
|
696
|
+
|
|
697
|
+
_param = self._get_structs_serialize(
|
|
698
|
+
_request_auth=_request_auth,
|
|
699
|
+
_content_type=_content_type,
|
|
700
|
+
_headers=_headers,
|
|
701
|
+
_host_index=_host_index
|
|
702
|
+
)
|
|
703
|
+
|
|
704
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
705
|
+
'200': "List[Struct]",
|
|
706
|
+
'401': "str",
|
|
707
|
+
}
|
|
708
|
+
response_data = self.api_client.call_api(
|
|
709
|
+
*_param,
|
|
710
|
+
_request_timeout=_request_timeout
|
|
711
|
+
)
|
|
712
|
+
response_data.read()
|
|
713
|
+
return self.api_client.response_deserialize(
|
|
714
|
+
response_data=response_data,
|
|
715
|
+
response_types_map=_response_types_map,
|
|
716
|
+
)
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
@validate_call
|
|
720
|
+
def get_structs_without_preload_content(
|
|
721
|
+
self,
|
|
722
|
+
_request_timeout: Union[
|
|
723
|
+
None,
|
|
724
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
725
|
+
Tuple[
|
|
726
|
+
Annotated[StrictFloat, Field(gt=0)],
|
|
727
|
+
Annotated[StrictFloat, Field(gt=0)]
|
|
728
|
+
]
|
|
729
|
+
] = None,
|
|
730
|
+
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
731
|
+
_content_type: Optional[StrictStr] = None,
|
|
732
|
+
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
733
|
+
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
734
|
+
) -> RESTResponseType:
|
|
735
|
+
"""Get all data structures
|
|
736
|
+
|
|
737
|
+
Retrieve all data structures for user
|
|
738
|
+
|
|
739
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
740
|
+
number provided, it will be total request
|
|
741
|
+
timeout. It can also be a pair (tuple) of
|
|
742
|
+
(connection, read) timeouts.
|
|
743
|
+
:type _request_timeout: int, tuple(int, int), optional
|
|
744
|
+
:param _request_auth: set to override the auth_settings for an a single
|
|
745
|
+
request; this effectively ignores the
|
|
746
|
+
authentication in the spec for a single request.
|
|
747
|
+
:type _request_auth: dict, optional
|
|
748
|
+
:param _content_type: force content-type for the request.
|
|
749
|
+
:type _content_type: str, Optional
|
|
750
|
+
:param _headers: set to override the headers for a single
|
|
751
|
+
request; this effectively ignores the headers
|
|
752
|
+
in the spec for a single request.
|
|
753
|
+
:type _headers: dict, optional
|
|
754
|
+
:param _host_index: set to override the host_index for a single
|
|
755
|
+
request; this effectively ignores the host_index
|
|
756
|
+
in the spec for a single request.
|
|
757
|
+
:type _host_index: int, optional
|
|
758
|
+
:return: Returns the result object.
|
|
759
|
+
""" # noqa: E501
|
|
760
|
+
|
|
761
|
+
_param = self._get_structs_serialize(
|
|
762
|
+
_request_auth=_request_auth,
|
|
763
|
+
_content_type=_content_type,
|
|
764
|
+
_headers=_headers,
|
|
765
|
+
_host_index=_host_index
|
|
766
|
+
)
|
|
767
|
+
|
|
768
|
+
_response_types_map: Dict[str, Optional[str]] = {
|
|
769
|
+
'200': "List[Struct]",
|
|
770
|
+
'401': "str",
|
|
771
|
+
}
|
|
772
|
+
response_data = self.api_client.call_api(
|
|
773
|
+
*_param,
|
|
774
|
+
_request_timeout=_request_timeout
|
|
775
|
+
)
|
|
776
|
+
return response_data.response
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
def _get_structs_serialize(
|
|
780
|
+
self,
|
|
781
|
+
_request_auth,
|
|
782
|
+
_content_type,
|
|
783
|
+
_headers,
|
|
784
|
+
_host_index,
|
|
785
|
+
) -> RequestSerialized:
|
|
786
|
+
|
|
787
|
+
_host = None
|
|
788
|
+
|
|
789
|
+
_collection_formats: Dict[str, str] = {
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
_path_params: Dict[str, str] = {}
|
|
793
|
+
_query_params: List[Tuple[str, str]] = []
|
|
794
|
+
_header_params: Dict[str, Any] = self.api_client._merge_headers(_headers)
|
|
795
|
+
_form_params: List[Tuple[str, str]] = []
|
|
796
|
+
_files: Dict[
|
|
797
|
+
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
|
|
798
|
+
] = {}
|
|
799
|
+
_body_params: Optional[bytes] = None
|
|
800
|
+
|
|
801
|
+
# process the path parameters
|
|
802
|
+
# process the query parameters
|
|
803
|
+
# process the header parameters
|
|
804
|
+
# process the form parameters
|
|
805
|
+
# process the body parameter
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
# set the HTTP header `Accept`
|
|
809
|
+
if not any(key.lower() == 'accept' for key in _header_params):
|
|
810
|
+
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
811
|
+
[
|
|
812
|
+
'application/json'
|
|
813
|
+
]
|
|
814
|
+
)
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
# authentication setting
|
|
818
|
+
_auth_settings: List[str] = [
|
|
819
|
+
'bearerAuth'
|
|
820
|
+
]
|
|
821
|
+
|
|
822
|
+
return self.api_client.param_serialize(
|
|
823
|
+
method='GET',
|
|
824
|
+
resource_path='/struct',
|
|
825
|
+
path_params=_path_params,
|
|
826
|
+
query_params=_query_params,
|
|
827
|
+
header_params=_header_params,
|
|
828
|
+
body=_body_params,
|
|
829
|
+
post_params=_form_params,
|
|
830
|
+
files=_files,
|
|
831
|
+
auth_settings=_auth_settings,
|
|
832
|
+
collection_formats=_collection_formats,
|
|
833
|
+
_host=_host,
|
|
834
|
+
_request_auth=_request_auth
|
|
835
|
+
)
|
|
836
|
+
|
|
837
|
+
|