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