groundx 2.5.10__py3-none-any.whl → 2.6.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.

Potentially problematic release.


This version of groundx might be problematic. Click here for more details.

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