groundx 2.0.15__py3-none-any.whl → 2.7.7__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 (147) hide show
  1. groundx/__init__.py +73 -21
  2. groundx/buckets/__init__.py +2 -0
  3. groundx/buckets/client.py +55 -388
  4. groundx/buckets/raw_client.py +628 -0
  5. groundx/client.py +22 -21
  6. groundx/core/__init__.py +5 -0
  7. groundx/core/api_error.py +13 -5
  8. groundx/core/client_wrapper.py +4 -3
  9. groundx/core/force_multipart.py +16 -0
  10. groundx/core/http_client.py +76 -32
  11. groundx/core/http_response.py +55 -0
  12. groundx/core/jsonable_encoder.py +0 -1
  13. groundx/core/pydantic_utilities.py +71 -112
  14. groundx/core/serialization.py +7 -3
  15. groundx/csv_splitter.py +64 -0
  16. groundx/customer/__init__.py +2 -0
  17. groundx/customer/client.py +31 -43
  18. groundx/customer/raw_client.py +91 -0
  19. groundx/documents/__init__.py +1 -2
  20. groundx/documents/client.py +455 -953
  21. groundx/documents/raw_client.py +1450 -0
  22. groundx/errors/__init__.py +2 -0
  23. groundx/errors/bad_request_error.py +4 -3
  24. groundx/errors/unauthorized_error.py +4 -3
  25. groundx/extract/__init__.py +48 -0
  26. groundx/extract/agents/__init__.py +7 -0
  27. groundx/extract/agents/agent.py +202 -0
  28. groundx/extract/classes/__init__.py +24 -0
  29. groundx/extract/classes/agent.py +23 -0
  30. groundx/extract/classes/api.py +15 -0
  31. groundx/extract/classes/document.py +338 -0
  32. groundx/extract/classes/field.py +88 -0
  33. groundx/extract/classes/groundx.py +147 -0
  34. groundx/extract/classes/prompt.py +36 -0
  35. groundx/extract/classes/test_document.py +109 -0
  36. groundx/extract/classes/test_field.py +43 -0
  37. groundx/extract/classes/test_groundx.py +223 -0
  38. groundx/extract/classes/test_prompt.py +68 -0
  39. groundx/extract/post_process/__init__.py +7 -0
  40. groundx/extract/post_process/post_process.py +33 -0
  41. groundx/extract/services/.DS_Store +0 -0
  42. groundx/extract/services/__init__.py +14 -0
  43. groundx/extract/services/csv.py +76 -0
  44. groundx/extract/services/logger.py +126 -0
  45. groundx/extract/services/logging_cfg.py +53 -0
  46. groundx/extract/services/ratelimit.py +104 -0
  47. groundx/extract/services/sheets_client.py +160 -0
  48. groundx/extract/services/status.py +197 -0
  49. groundx/extract/services/upload.py +68 -0
  50. groundx/extract/services/upload_minio.py +122 -0
  51. groundx/extract/services/upload_s3.py +91 -0
  52. groundx/extract/services/utility.py +52 -0
  53. groundx/extract/settings/__init__.py +15 -0
  54. groundx/extract/settings/settings.py +212 -0
  55. groundx/extract/settings/test_settings.py +512 -0
  56. groundx/extract/tasks/__init__.py +6 -0
  57. groundx/extract/tasks/utility.py +27 -0
  58. groundx/extract/utility/__init__.py +15 -0
  59. groundx/extract/utility/classes.py +193 -0
  60. groundx/extract/utility/test_utility.py +81 -0
  61. groundx/groups/__init__.py +2 -0
  62. groundx/groups/client.py +63 -550
  63. groundx/groups/raw_client.py +901 -0
  64. groundx/health/__init__.py +2 -0
  65. groundx/health/client.py +35 -101
  66. groundx/health/raw_client.py +193 -0
  67. groundx/ingest.py +771 -0
  68. groundx/search/__init__.py +2 -0
  69. groundx/search/client.py +94 -227
  70. groundx/search/raw_client.py +442 -0
  71. groundx/search/types/__init__.py +2 -0
  72. groundx/types/__init__.py +68 -16
  73. groundx/types/bounding_box_detail.py +4 -4
  74. groundx/types/bucket_detail.py +5 -5
  75. groundx/types/bucket_list_response.py +17 -3
  76. groundx/types/bucket_response.py +3 -3
  77. groundx/types/bucket_update_detail.py +4 -4
  78. groundx/types/bucket_update_response.py +3 -3
  79. groundx/types/customer_detail.py +2 -2
  80. groundx/types/customer_response.py +3 -3
  81. groundx/types/document.py +54 -0
  82. groundx/types/document_detail.py +16 -4
  83. groundx/types/document_list_response.py +4 -4
  84. groundx/types/document_local_ingest_request.py +7 -0
  85. groundx/types/document_lookup_response.py +8 -3
  86. groundx/types/document_response.py +3 -3
  87. groundx/types/document_type.py +21 -1
  88. groundx/types/group_detail.py +4 -4
  89. groundx/types/group_list_response.py +17 -3
  90. groundx/types/group_response.py +3 -3
  91. groundx/types/health_response.py +3 -3
  92. groundx/types/health_response_health.py +3 -3
  93. groundx/types/health_service.py +5 -5
  94. groundx/types/ingest_local_document.py +25 -0
  95. groundx/types/ingest_local_document_metadata.py +51 -0
  96. groundx/types/ingest_remote_document.py +15 -6
  97. groundx/types/ingest_response.py +4 -4
  98. groundx/types/{process_status_response_ingest.py → ingest_status.py} +8 -7
  99. groundx/types/{ingest_response_ingest.py → ingest_status_light.py} +7 -5
  100. groundx/types/ingest_status_progress.py +26 -0
  101. groundx/types/{process_status_response_ingest_progress_errors.py → ingest_status_progress_cancelled.py} +4 -4
  102. groundx/types/{process_status_response_ingest_progress_complete.py → ingest_status_progress_complete.py} +4 -4
  103. groundx/types/{process_status_response_ingest_progress_cancelled.py → ingest_status_progress_errors.py} +4 -4
  104. groundx/types/{process_status_response_ingest_progress_processing.py → ingest_status_progress_processing.py} +4 -4
  105. groundx/types/message_response.py +2 -2
  106. groundx/types/meter_detail.py +2 -2
  107. groundx/types/process_level.py +5 -0
  108. groundx/types/{process_status_response.py → processes_status_response.py} +8 -5
  109. groundx/types/processing_status.py +3 -1
  110. groundx/types/search_response.py +3 -3
  111. groundx/types/search_response_search.py +3 -3
  112. groundx/types/search_result_item.py +7 -5
  113. groundx/types/search_result_item_pages_item.py +41 -0
  114. groundx/types/subscription_detail.py +3 -3
  115. groundx/types/subscription_detail_meters.py +5 -5
  116. groundx/{documents/types/website_crawl_request_websites_item.py → types/website_source.py} +7 -7
  117. groundx/types/workflow_apply_request.py +24 -0
  118. groundx/types/workflow_detail.py +59 -0
  119. groundx/types/workflow_detail_chunk_strategy.py +5 -0
  120. groundx/types/workflow_detail_relationships.py +36 -0
  121. groundx/types/workflow_engine.py +58 -0
  122. groundx/types/workflow_engine_reasoning_effort.py +5 -0
  123. groundx/types/workflow_engine_service.py +7 -0
  124. groundx/types/workflow_prompt.py +37 -0
  125. groundx/types/workflow_prompt_group.py +25 -0
  126. groundx/types/workflow_prompt_role.py +5 -0
  127. groundx/types/workflow_request.py +31 -0
  128. groundx/types/workflow_request_chunk_strategy.py +5 -0
  129. groundx/types/workflow_response.py +20 -0
  130. groundx/types/workflow_step.py +33 -0
  131. groundx/types/workflow_step_config.py +33 -0
  132. groundx/types/workflow_step_config_field.py +8 -0
  133. groundx/types/workflow_steps.py +38 -0
  134. groundx/types/workflows_response.py +20 -0
  135. groundx/workflows/__init__.py +7 -0
  136. groundx/workflows/client.py +736 -0
  137. groundx/workflows/raw_client.py +841 -0
  138. groundx/workflows/types/__init__.py +7 -0
  139. groundx/workflows/types/workflows_get_request_id.py +5 -0
  140. {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/LICENSE +1 -1
  141. {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/METADATA +39 -22
  142. groundx-2.7.7.dist-info/RECORD +155 -0
  143. groundx/documents/types/__init__.py +0 -6
  144. groundx/documents/types/documents_ingest_local_request_files_item.py +0 -43
  145. groundx/types/process_status_response_ingest_progress.py +0 -26
  146. groundx-2.0.15.dist-info/RECORD +0 -82
  147. {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/WHEEL +0 -0
@@ -0,0 +1,841 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from ..core.request_options import RequestOptions
12
+ from ..core.serialization import convert_and_respect_annotation_metadata
13
+ from ..types.message_response import MessageResponse
14
+ from ..types.workflow_request_chunk_strategy import WorkflowRequestChunkStrategy
15
+ from ..types.workflow_response import WorkflowResponse
16
+ from ..types.workflow_steps import WorkflowSteps
17
+ from ..types.workflows_response import WorkflowsResponse
18
+ from .types.workflows_get_request_id import WorkflowsGetRequestId
19
+
20
+ # this is used as the default value for optional parameters
21
+ OMIT = typing.cast(typing.Any, ...)
22
+
23
+
24
+ class RawWorkflowsClient:
25
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
26
+ self._client_wrapper = client_wrapper
27
+
28
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[WorkflowsResponse]:
29
+ """
30
+ Get all workflows associated with the API key.
31
+
32
+ Parameters
33
+ ----------
34
+ request_options : typing.Optional[RequestOptions]
35
+ Request-specific configuration.
36
+
37
+ Returns
38
+ -------
39
+ HttpResponse[WorkflowsResponse]
40
+ Look up success
41
+ """
42
+ _response = self._client_wrapper.httpx_client.request(
43
+ "v1/workflow",
44
+ method="GET",
45
+ request_options=request_options,
46
+ )
47
+ try:
48
+ if 200 <= _response.status_code < 300:
49
+ _data = typing.cast(
50
+ WorkflowsResponse,
51
+ parse_obj_as(
52
+ type_=WorkflowsResponse, # type: ignore
53
+ object_=_response.json(),
54
+ ),
55
+ )
56
+ return HttpResponse(response=_response, data=_data)
57
+ _response_json = _response.json()
58
+ except JSONDecodeError:
59
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
60
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
61
+
62
+ def create(
63
+ self,
64
+ *,
65
+ chunk_strategy: typing.Optional[WorkflowRequestChunkStrategy] = OMIT,
66
+ name: typing.Optional[str] = OMIT,
67
+ steps: typing.Optional[WorkflowSteps] = OMIT,
68
+ request_options: typing.Optional[RequestOptions] = None,
69
+ ) -> HttpResponse[WorkflowResponse]:
70
+ """
71
+ Create a workflow.
72
+
73
+ Parameters
74
+ ----------
75
+ chunk_strategy : typing.Optional[WorkflowRequestChunkStrategy]
76
+
77
+ name : typing.Optional[str]
78
+ The name of the workflow being created.
79
+
80
+ steps : typing.Optional[WorkflowSteps]
81
+
82
+ request_options : typing.Optional[RequestOptions]
83
+ Request-specific configuration.
84
+
85
+ Returns
86
+ -------
87
+ HttpResponse[WorkflowResponse]
88
+ Workflow successfully created
89
+ """
90
+ _response = self._client_wrapper.httpx_client.request(
91
+ "v1/workflow",
92
+ method="POST",
93
+ json={
94
+ "chunkStrategy": chunk_strategy,
95
+ "name": name,
96
+ "steps": convert_and_respect_annotation_metadata(
97
+ object_=steps, annotation=WorkflowSteps, direction="write"
98
+ ),
99
+ },
100
+ headers={
101
+ "content-type": "application/json",
102
+ },
103
+ request_options=request_options,
104
+ omit=OMIT,
105
+ )
106
+ try:
107
+ if 200 <= _response.status_code < 300:
108
+ _data = typing.cast(
109
+ WorkflowResponse,
110
+ parse_obj_as(
111
+ type_=WorkflowResponse, # type: ignore
112
+ object_=_response.json(),
113
+ ),
114
+ )
115
+ return HttpResponse(response=_response, data=_data)
116
+ _response_json = _response.json()
117
+ except JSONDecodeError:
118
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
119
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
120
+
121
+ def add_to_account(
122
+ self, *, workflow_id: str, request_options: typing.Optional[RequestOptions] = None
123
+ ) -> HttpResponse[MessageResponse]:
124
+ """
125
+ Assigns the given workflow to the customer account and is applied by default to all files unless overridden by document or bucket workflows.
126
+
127
+ Parameters
128
+ ----------
129
+ workflow_id : str
130
+ The id of the workflow that is being applied.
131
+
132
+ request_options : typing.Optional[RequestOptions]
133
+ Request-specific configuration.
134
+
135
+ Returns
136
+ -------
137
+ HttpResponse[MessageResponse]
138
+ Apply success
139
+ """
140
+ _response = self._client_wrapper.httpx_client.request(
141
+ "v1/workflow/relationship",
142
+ method="POST",
143
+ json={
144
+ "workflowId": workflow_id,
145
+ },
146
+ headers={
147
+ "content-type": "application/json",
148
+ },
149
+ request_options=request_options,
150
+ omit=OMIT,
151
+ )
152
+ try:
153
+ if 200 <= _response.status_code < 300:
154
+ _data = typing.cast(
155
+ MessageResponse,
156
+ parse_obj_as(
157
+ type_=MessageResponse, # type: ignore
158
+ object_=_response.json(),
159
+ ),
160
+ )
161
+ return HttpResponse(response=_response, data=_data)
162
+ _response_json = _response.json()
163
+ except JSONDecodeError:
164
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
165
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
166
+
167
+ def remove_from_account(
168
+ self, *, request_options: typing.Optional[RequestOptions] = None
169
+ ) -> HttpResponse[MessageResponse]:
170
+ """
171
+ Removes the assigned workflow from the customer account.
172
+
173
+ Parameters
174
+ ----------
175
+ request_options : typing.Optional[RequestOptions]
176
+ Request-specific configuration.
177
+
178
+ Returns
179
+ -------
180
+ HttpResponse[MessageResponse]
181
+ Apply success
182
+ """
183
+ _response = self._client_wrapper.httpx_client.request(
184
+ "v1/workflow/relationship",
185
+ method="DELETE",
186
+ request_options=request_options,
187
+ )
188
+ try:
189
+ if 200 <= _response.status_code < 300:
190
+ _data = typing.cast(
191
+ MessageResponse,
192
+ parse_obj_as(
193
+ type_=MessageResponse, # type: ignore
194
+ object_=_response.json(),
195
+ ),
196
+ )
197
+ return HttpResponse(response=_response, data=_data)
198
+ _response_json = _response.json()
199
+ except JSONDecodeError:
200
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
201
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
202
+
203
+ def add_to_id(
204
+ self, id: int, *, workflow_id: str, request_options: typing.Optional[RequestOptions] = None
205
+ ) -> HttpResponse[MessageResponse]:
206
+ """
207
+ Assigns the given workflow to the group or bucket and is applied by default to all files unless overridden by document workflows.
208
+
209
+ Parameters
210
+ ----------
211
+ id : int
212
+ The id of the group or bucket that the workflow will be assigned to.
213
+
214
+ workflow_id : str
215
+ The id of the workflow that is being applied.
216
+
217
+ request_options : typing.Optional[RequestOptions]
218
+ Request-specific configuration.
219
+
220
+ Returns
221
+ -------
222
+ HttpResponse[MessageResponse]
223
+ Apply success
224
+ """
225
+ _response = self._client_wrapper.httpx_client.request(
226
+ f"v1/workflow/relationship/{jsonable_encoder(id)}",
227
+ method="POST",
228
+ json={
229
+ "workflowId": workflow_id,
230
+ },
231
+ headers={
232
+ "content-type": "application/json",
233
+ },
234
+ request_options=request_options,
235
+ omit=OMIT,
236
+ )
237
+ try:
238
+ if 200 <= _response.status_code < 300:
239
+ _data = typing.cast(
240
+ MessageResponse,
241
+ parse_obj_as(
242
+ type_=MessageResponse, # type: ignore
243
+ object_=_response.json(),
244
+ ),
245
+ )
246
+ return HttpResponse(response=_response, data=_data)
247
+ _response_json = _response.json()
248
+ except JSONDecodeError:
249
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
250
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
251
+
252
+ def remove_from_id(
253
+ self, id: int, *, request_options: typing.Optional[RequestOptions] = None
254
+ ) -> HttpResponse[MessageResponse]:
255
+ """
256
+ Removes the assigned workflow from the customer account.
257
+
258
+ Parameters
259
+ ----------
260
+ id : int
261
+ The id of the group or bucket that the workflow will removed from.
262
+
263
+ request_options : typing.Optional[RequestOptions]
264
+ Request-specific configuration.
265
+
266
+ Returns
267
+ -------
268
+ HttpResponse[MessageResponse]
269
+ Apply success
270
+ """
271
+ _response = self._client_wrapper.httpx_client.request(
272
+ f"v1/workflow/relationship/{jsonable_encoder(id)}",
273
+ method="DELETE",
274
+ request_options=request_options,
275
+ )
276
+ try:
277
+ if 200 <= _response.status_code < 300:
278
+ _data = typing.cast(
279
+ MessageResponse,
280
+ parse_obj_as(
281
+ type_=MessageResponse, # type: ignore
282
+ object_=_response.json(),
283
+ ),
284
+ )
285
+ return HttpResponse(response=_response, data=_data)
286
+ _response_json = _response.json()
287
+ except JSONDecodeError:
288
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
289
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
290
+
291
+ def get(
292
+ self, id: WorkflowsGetRequestId, *, request_options: typing.Optional[RequestOptions] = None
293
+ ) -> HttpResponse[WorkflowResponse]:
294
+ """
295
+ look up a specific workflow by groupId, bucketId, or workflowId.
296
+
297
+ Parameters
298
+ ----------
299
+ id : WorkflowsGetRequestId
300
+ The id of the group, bucket, or workflow to look up.
301
+
302
+ request_options : typing.Optional[RequestOptions]
303
+ Request-specific configuration.
304
+
305
+ Returns
306
+ -------
307
+ HttpResponse[WorkflowResponse]
308
+ Look up success
309
+ """
310
+ _response = self._client_wrapper.httpx_client.request(
311
+ f"v1/workflow/{jsonable_encoder(id)}",
312
+ method="GET",
313
+ request_options=request_options,
314
+ )
315
+ try:
316
+ if 200 <= _response.status_code < 300:
317
+ _data = typing.cast(
318
+ WorkflowResponse,
319
+ parse_obj_as(
320
+ type_=WorkflowResponse, # type: ignore
321
+ object_=_response.json(),
322
+ ),
323
+ )
324
+ return HttpResponse(response=_response, data=_data)
325
+ _response_json = _response.json()
326
+ except JSONDecodeError:
327
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
328
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
329
+
330
+ def update(
331
+ self,
332
+ id: str,
333
+ *,
334
+ chunk_strategy: typing.Optional[WorkflowRequestChunkStrategy] = OMIT,
335
+ name: typing.Optional[str] = OMIT,
336
+ steps: typing.Optional[WorkflowSteps] = OMIT,
337
+ request_options: typing.Optional[RequestOptions] = None,
338
+ ) -> HttpResponse[WorkflowResponse]:
339
+ """
340
+ Update an existing workflow.
341
+
342
+ Parameters
343
+ ----------
344
+ id : str
345
+ The workflowId of the workflow being updated.
346
+
347
+ chunk_strategy : typing.Optional[WorkflowRequestChunkStrategy]
348
+
349
+ name : typing.Optional[str]
350
+ The name of the workflow being created.
351
+
352
+ steps : typing.Optional[WorkflowSteps]
353
+
354
+ request_options : typing.Optional[RequestOptions]
355
+ Request-specific configuration.
356
+
357
+ Returns
358
+ -------
359
+ HttpResponse[WorkflowResponse]
360
+ Update success
361
+ """
362
+ _response = self._client_wrapper.httpx_client.request(
363
+ f"v1/workflow/{jsonable_encoder(id)}",
364
+ method="PUT",
365
+ json={
366
+ "chunkStrategy": chunk_strategy,
367
+ "name": name,
368
+ "steps": convert_and_respect_annotation_metadata(
369
+ object_=steps, annotation=WorkflowSteps, direction="write"
370
+ ),
371
+ },
372
+ headers={
373
+ "content-type": "application/json",
374
+ },
375
+ request_options=request_options,
376
+ omit=OMIT,
377
+ )
378
+ try:
379
+ if 200 <= _response.status_code < 300:
380
+ _data = typing.cast(
381
+ WorkflowResponse,
382
+ parse_obj_as(
383
+ type_=WorkflowResponse, # type: ignore
384
+ object_=_response.json(),
385
+ ),
386
+ )
387
+ return HttpResponse(response=_response, data=_data)
388
+ _response_json = _response.json()
389
+ except JSONDecodeError:
390
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
391
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
392
+
393
+ def delete(
394
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
395
+ ) -> HttpResponse[MessageResponse]:
396
+ """
397
+ Delete a workflow.
398
+
399
+ Parameters
400
+ ----------
401
+ id : str
402
+ The workflowId of the workflow being deleted.
403
+
404
+ request_options : typing.Optional[RequestOptions]
405
+ Request-specific configuration.
406
+
407
+ Returns
408
+ -------
409
+ HttpResponse[MessageResponse]
410
+ Delete success
411
+ """
412
+ _response = self._client_wrapper.httpx_client.request(
413
+ f"v1/workflow/{jsonable_encoder(id)}",
414
+ method="DELETE",
415
+ request_options=request_options,
416
+ )
417
+ try:
418
+ if 200 <= _response.status_code < 300:
419
+ _data = typing.cast(
420
+ MessageResponse,
421
+ parse_obj_as(
422
+ type_=MessageResponse, # type: ignore
423
+ object_=_response.json(),
424
+ ),
425
+ )
426
+ return HttpResponse(response=_response, data=_data)
427
+ _response_json = _response.json()
428
+ except JSONDecodeError:
429
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
430
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
431
+
432
+
433
+ class AsyncRawWorkflowsClient:
434
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
435
+ self._client_wrapper = client_wrapper
436
+
437
+ async def list(
438
+ self, *, request_options: typing.Optional[RequestOptions] = None
439
+ ) -> AsyncHttpResponse[WorkflowsResponse]:
440
+ """
441
+ Get all workflows associated with the API key.
442
+
443
+ Parameters
444
+ ----------
445
+ request_options : typing.Optional[RequestOptions]
446
+ Request-specific configuration.
447
+
448
+ Returns
449
+ -------
450
+ AsyncHttpResponse[WorkflowsResponse]
451
+ Look up success
452
+ """
453
+ _response = await self._client_wrapper.httpx_client.request(
454
+ "v1/workflow",
455
+ method="GET",
456
+ request_options=request_options,
457
+ )
458
+ try:
459
+ if 200 <= _response.status_code < 300:
460
+ _data = typing.cast(
461
+ WorkflowsResponse,
462
+ parse_obj_as(
463
+ type_=WorkflowsResponse, # type: ignore
464
+ object_=_response.json(),
465
+ ),
466
+ )
467
+ return AsyncHttpResponse(response=_response, data=_data)
468
+ _response_json = _response.json()
469
+ except JSONDecodeError:
470
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
471
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
472
+
473
+ async def create(
474
+ self,
475
+ *,
476
+ chunk_strategy: typing.Optional[WorkflowRequestChunkStrategy] = OMIT,
477
+ name: typing.Optional[str] = OMIT,
478
+ steps: typing.Optional[WorkflowSteps] = OMIT,
479
+ request_options: typing.Optional[RequestOptions] = None,
480
+ ) -> AsyncHttpResponse[WorkflowResponse]:
481
+ """
482
+ Create a workflow.
483
+
484
+ Parameters
485
+ ----------
486
+ chunk_strategy : typing.Optional[WorkflowRequestChunkStrategy]
487
+
488
+ name : typing.Optional[str]
489
+ The name of the workflow being created.
490
+
491
+ steps : typing.Optional[WorkflowSteps]
492
+
493
+ request_options : typing.Optional[RequestOptions]
494
+ Request-specific configuration.
495
+
496
+ Returns
497
+ -------
498
+ AsyncHttpResponse[WorkflowResponse]
499
+ Workflow successfully created
500
+ """
501
+ _response = await self._client_wrapper.httpx_client.request(
502
+ "v1/workflow",
503
+ method="POST",
504
+ json={
505
+ "chunkStrategy": chunk_strategy,
506
+ "name": name,
507
+ "steps": convert_and_respect_annotation_metadata(
508
+ object_=steps, annotation=WorkflowSteps, direction="write"
509
+ ),
510
+ },
511
+ headers={
512
+ "content-type": "application/json",
513
+ },
514
+ request_options=request_options,
515
+ omit=OMIT,
516
+ )
517
+ try:
518
+ if 200 <= _response.status_code < 300:
519
+ _data = typing.cast(
520
+ WorkflowResponse,
521
+ parse_obj_as(
522
+ type_=WorkflowResponse, # type: ignore
523
+ object_=_response.json(),
524
+ ),
525
+ )
526
+ return AsyncHttpResponse(response=_response, data=_data)
527
+ _response_json = _response.json()
528
+ except JSONDecodeError:
529
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
530
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
531
+
532
+ async def add_to_account(
533
+ self, *, workflow_id: str, request_options: typing.Optional[RequestOptions] = None
534
+ ) -> AsyncHttpResponse[MessageResponse]:
535
+ """
536
+ Assigns the given workflow to the customer account and is applied by default to all files unless overridden by document or bucket workflows.
537
+
538
+ Parameters
539
+ ----------
540
+ workflow_id : str
541
+ The id of the workflow that is being applied.
542
+
543
+ request_options : typing.Optional[RequestOptions]
544
+ Request-specific configuration.
545
+
546
+ Returns
547
+ -------
548
+ AsyncHttpResponse[MessageResponse]
549
+ Apply success
550
+ """
551
+ _response = await self._client_wrapper.httpx_client.request(
552
+ "v1/workflow/relationship",
553
+ method="POST",
554
+ json={
555
+ "workflowId": workflow_id,
556
+ },
557
+ headers={
558
+ "content-type": "application/json",
559
+ },
560
+ request_options=request_options,
561
+ omit=OMIT,
562
+ )
563
+ try:
564
+ if 200 <= _response.status_code < 300:
565
+ _data = typing.cast(
566
+ MessageResponse,
567
+ parse_obj_as(
568
+ type_=MessageResponse, # type: ignore
569
+ object_=_response.json(),
570
+ ),
571
+ )
572
+ return AsyncHttpResponse(response=_response, data=_data)
573
+ _response_json = _response.json()
574
+ except JSONDecodeError:
575
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
576
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
577
+
578
+ async def remove_from_account(
579
+ self, *, request_options: typing.Optional[RequestOptions] = None
580
+ ) -> AsyncHttpResponse[MessageResponse]:
581
+ """
582
+ Removes the assigned workflow from the customer account.
583
+
584
+ Parameters
585
+ ----------
586
+ request_options : typing.Optional[RequestOptions]
587
+ Request-specific configuration.
588
+
589
+ Returns
590
+ -------
591
+ AsyncHttpResponse[MessageResponse]
592
+ Apply success
593
+ """
594
+ _response = await self._client_wrapper.httpx_client.request(
595
+ "v1/workflow/relationship",
596
+ method="DELETE",
597
+ request_options=request_options,
598
+ )
599
+ try:
600
+ if 200 <= _response.status_code < 300:
601
+ _data = typing.cast(
602
+ MessageResponse,
603
+ parse_obj_as(
604
+ type_=MessageResponse, # type: ignore
605
+ object_=_response.json(),
606
+ ),
607
+ )
608
+ return AsyncHttpResponse(response=_response, data=_data)
609
+ _response_json = _response.json()
610
+ except JSONDecodeError:
611
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
612
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
613
+
614
+ async def add_to_id(
615
+ self, id: int, *, workflow_id: str, request_options: typing.Optional[RequestOptions] = None
616
+ ) -> AsyncHttpResponse[MessageResponse]:
617
+ """
618
+ Assigns the given workflow to the group or bucket and is applied by default to all files unless overridden by document workflows.
619
+
620
+ Parameters
621
+ ----------
622
+ id : int
623
+ The id of the group or bucket that the workflow will be assigned to.
624
+
625
+ workflow_id : str
626
+ The id of the workflow that is being applied.
627
+
628
+ request_options : typing.Optional[RequestOptions]
629
+ Request-specific configuration.
630
+
631
+ Returns
632
+ -------
633
+ AsyncHttpResponse[MessageResponse]
634
+ Apply success
635
+ """
636
+ _response = await self._client_wrapper.httpx_client.request(
637
+ f"v1/workflow/relationship/{jsonable_encoder(id)}",
638
+ method="POST",
639
+ json={
640
+ "workflowId": workflow_id,
641
+ },
642
+ headers={
643
+ "content-type": "application/json",
644
+ },
645
+ request_options=request_options,
646
+ omit=OMIT,
647
+ )
648
+ try:
649
+ if 200 <= _response.status_code < 300:
650
+ _data = typing.cast(
651
+ MessageResponse,
652
+ parse_obj_as(
653
+ type_=MessageResponse, # type: ignore
654
+ object_=_response.json(),
655
+ ),
656
+ )
657
+ return AsyncHttpResponse(response=_response, data=_data)
658
+ _response_json = _response.json()
659
+ except JSONDecodeError:
660
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
661
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
662
+
663
+ async def remove_from_id(
664
+ self, id: int, *, request_options: typing.Optional[RequestOptions] = None
665
+ ) -> AsyncHttpResponse[MessageResponse]:
666
+ """
667
+ Removes the assigned workflow from the customer account.
668
+
669
+ Parameters
670
+ ----------
671
+ id : int
672
+ The id of the group or bucket that the workflow will removed from.
673
+
674
+ request_options : typing.Optional[RequestOptions]
675
+ Request-specific configuration.
676
+
677
+ Returns
678
+ -------
679
+ AsyncHttpResponse[MessageResponse]
680
+ Apply success
681
+ """
682
+ _response = await self._client_wrapper.httpx_client.request(
683
+ f"v1/workflow/relationship/{jsonable_encoder(id)}",
684
+ method="DELETE",
685
+ request_options=request_options,
686
+ )
687
+ try:
688
+ if 200 <= _response.status_code < 300:
689
+ _data = typing.cast(
690
+ MessageResponse,
691
+ parse_obj_as(
692
+ type_=MessageResponse, # type: ignore
693
+ object_=_response.json(),
694
+ ),
695
+ )
696
+ return AsyncHttpResponse(response=_response, data=_data)
697
+ _response_json = _response.json()
698
+ except JSONDecodeError:
699
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
700
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
701
+
702
+ async def get(
703
+ self, id: WorkflowsGetRequestId, *, request_options: typing.Optional[RequestOptions] = None
704
+ ) -> AsyncHttpResponse[WorkflowResponse]:
705
+ """
706
+ look up a specific workflow by groupId, bucketId, or workflowId.
707
+
708
+ Parameters
709
+ ----------
710
+ id : WorkflowsGetRequestId
711
+ The id of the group, bucket, or workflow to look up.
712
+
713
+ request_options : typing.Optional[RequestOptions]
714
+ Request-specific configuration.
715
+
716
+ Returns
717
+ -------
718
+ AsyncHttpResponse[WorkflowResponse]
719
+ Look up success
720
+ """
721
+ _response = await self._client_wrapper.httpx_client.request(
722
+ f"v1/workflow/{jsonable_encoder(id)}",
723
+ method="GET",
724
+ request_options=request_options,
725
+ )
726
+ try:
727
+ if 200 <= _response.status_code < 300:
728
+ _data = typing.cast(
729
+ WorkflowResponse,
730
+ parse_obj_as(
731
+ type_=WorkflowResponse, # type: ignore
732
+ object_=_response.json(),
733
+ ),
734
+ )
735
+ return AsyncHttpResponse(response=_response, data=_data)
736
+ _response_json = _response.json()
737
+ except JSONDecodeError:
738
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
739
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
740
+
741
+ async def update(
742
+ self,
743
+ id: str,
744
+ *,
745
+ chunk_strategy: typing.Optional[WorkflowRequestChunkStrategy] = OMIT,
746
+ name: typing.Optional[str] = OMIT,
747
+ steps: typing.Optional[WorkflowSteps] = OMIT,
748
+ request_options: typing.Optional[RequestOptions] = None,
749
+ ) -> AsyncHttpResponse[WorkflowResponse]:
750
+ """
751
+ Update an existing workflow.
752
+
753
+ Parameters
754
+ ----------
755
+ id : str
756
+ The workflowId of the workflow being updated.
757
+
758
+ chunk_strategy : typing.Optional[WorkflowRequestChunkStrategy]
759
+
760
+ name : typing.Optional[str]
761
+ The name of the workflow being created.
762
+
763
+ steps : typing.Optional[WorkflowSteps]
764
+
765
+ request_options : typing.Optional[RequestOptions]
766
+ Request-specific configuration.
767
+
768
+ Returns
769
+ -------
770
+ AsyncHttpResponse[WorkflowResponse]
771
+ Update success
772
+ """
773
+ _response = await self._client_wrapper.httpx_client.request(
774
+ f"v1/workflow/{jsonable_encoder(id)}",
775
+ method="PUT",
776
+ json={
777
+ "chunkStrategy": chunk_strategy,
778
+ "name": name,
779
+ "steps": convert_and_respect_annotation_metadata(
780
+ object_=steps, annotation=WorkflowSteps, direction="write"
781
+ ),
782
+ },
783
+ headers={
784
+ "content-type": "application/json",
785
+ },
786
+ request_options=request_options,
787
+ omit=OMIT,
788
+ )
789
+ try:
790
+ if 200 <= _response.status_code < 300:
791
+ _data = typing.cast(
792
+ WorkflowResponse,
793
+ parse_obj_as(
794
+ type_=WorkflowResponse, # type: ignore
795
+ object_=_response.json(),
796
+ ),
797
+ )
798
+ return AsyncHttpResponse(response=_response, data=_data)
799
+ _response_json = _response.json()
800
+ except JSONDecodeError:
801
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
802
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
803
+
804
+ async def delete(
805
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
806
+ ) -> AsyncHttpResponse[MessageResponse]:
807
+ """
808
+ Delete a workflow.
809
+
810
+ Parameters
811
+ ----------
812
+ id : str
813
+ The workflowId of the workflow being deleted.
814
+
815
+ request_options : typing.Optional[RequestOptions]
816
+ Request-specific configuration.
817
+
818
+ Returns
819
+ -------
820
+ AsyncHttpResponse[MessageResponse]
821
+ Delete success
822
+ """
823
+ _response = await self._client_wrapper.httpx_client.request(
824
+ f"v1/workflow/{jsonable_encoder(id)}",
825
+ method="DELETE",
826
+ request_options=request_options,
827
+ )
828
+ try:
829
+ if 200 <= _response.status_code < 300:
830
+ _data = typing.cast(
831
+ MessageResponse,
832
+ parse_obj_as(
833
+ type_=MessageResponse, # type: ignore
834
+ object_=_response.json(),
835
+ ),
836
+ )
837
+ return AsyncHttpResponse(response=_response, data=_data)
838
+ _response_json = _response.json()
839
+ except JSONDecodeError:
840
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
841
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)