phenoml 0.0.6__py3-none-any.whl → 0.0.8__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 (54) hide show
  1. phenoml/client.py +3 -0
  2. phenoml/core/client_wrapper.py +2 -2
  3. phenoml/summary/__init__.py +39 -0
  4. phenoml/summary/client.py +656 -0
  5. phenoml/summary/errors/__init__.py +11 -0
  6. phenoml/summary/errors/bad_request_error.py +10 -0
  7. phenoml/summary/errors/forbidden_error.py +10 -0
  8. phenoml/summary/errors/internal_server_error.py +10 -0
  9. phenoml/summary/errors/not_found_error.py +10 -0
  10. phenoml/summary/errors/unauthorized_error.py +10 -0
  11. phenoml/{workflows/workflows → summary}/raw_client.py +236 -312
  12. phenoml/summary/types/__init__.py +31 -0
  13. phenoml/summary/types/create_summary_request_fhir_resources.py +8 -0
  14. phenoml/summary/types/create_summary_request_mode.py +5 -0
  15. phenoml/summary/types/create_summary_response.py +29 -0
  16. phenoml/summary/types/create_summary_template_response.py +23 -0
  17. phenoml/summary/types/fhir_bundle.py +23 -0
  18. phenoml/summary/types/fhir_bundle_entry_item.py +20 -0
  19. phenoml/summary/types/fhir_resource.py +24 -0
  20. phenoml/summary/types/summary_delete_template_response.py +20 -0
  21. phenoml/summary/types/summary_get_template_response.py +21 -0
  22. phenoml/summary/types/summary_list_templates_response.py +21 -0
  23. phenoml/summary/types/summary_template.py +41 -0
  24. phenoml/summary/types/summary_update_template_response.py +22 -0
  25. phenoml/workflows/__init__.py +3 -8
  26. phenoml/workflows/client.py +517 -33
  27. phenoml/workflows/raw_client.py +1129 -32
  28. phenoml/workflows/types/__init__.py +10 -0
  29. phenoml/workflows/{workflows/types → types}/workflows_delete_response.py +1 -1
  30. phenoml/workflows/{workflows/types → types}/workflows_get_response.py +3 -3
  31. phenoml/workflows/{workflows/types → types}/workflows_update_response.py +3 -3
  32. {phenoml-0.0.6.dist-info → phenoml-0.0.8.dist-info}/METADATA +1 -1
  33. {phenoml-0.0.6.dist-info → phenoml-0.0.8.dist-info}/RECORD +37 -33
  34. phenoml/types/__init__.py +0 -21
  35. phenoml/types/cohort_response.py +0 -5
  36. phenoml/types/lang2fhir_and_create_response.py +0 -5
  37. phenoml/types/lang2fhir_and_search_response.py +0 -5
  38. phenoml/types/mcp_server_response.py +0 -5
  39. phenoml/types/mcp_server_tool_call_response.py +0 -5
  40. phenoml/types/mcp_server_tool_response.py +0 -5
  41. phenoml/types/search_concept.py +0 -5
  42. phenoml/workflows/mcp_server/__init__.py +0 -7
  43. phenoml/workflows/mcp_server/client.py +0 -274
  44. phenoml/workflows/mcp_server/raw_client.py +0 -226
  45. phenoml/workflows/mcp_server/tools/__init__.py +0 -4
  46. phenoml/workflows/mcp_server/tools/client.py +0 -287
  47. phenoml/workflows/mcp_server/tools/raw_client.py +0 -244
  48. phenoml/workflows/workflows/__init__.py +0 -19
  49. phenoml/workflows/workflows/client.py +0 -694
  50. phenoml/workflows/workflows/types/__init__.py +0 -17
  51. /phenoml/workflows/{workflows/types → types}/create_workflow_request_fhir_provider_id.py +0 -0
  52. /phenoml/workflows/{workflows/types → types}/update_workflow_request_fhir_provider_id.py +0 -0
  53. {phenoml-0.0.6.dist-info → phenoml-0.0.8.dist-info}/LICENSE +0 -0
  54. {phenoml-0.0.6.dist-info → phenoml-0.0.8.dist-info}/WHEEL +0 -0
@@ -6,80 +6,641 @@ from json.decoder import JSONDecodeError
6
6
  from ..core.api_error import ApiError
7
7
  from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
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
9
11
  from ..core.request_options import RequestOptions
12
+ from ..core.serialization import convert_and_respect_annotation_metadata
13
+ from .errors.bad_request_error import BadRequestError
14
+ from .errors.forbidden_error import ForbiddenError
15
+ from .errors.internal_server_error import InternalServerError
16
+ from .errors.not_found_error import NotFoundError
17
+ from .errors.unauthorized_error import UnauthorizedError
18
+ from .types.create_workflow_request_fhir_provider_id import CreateWorkflowRequestFhirProviderId
19
+ from .types.create_workflow_response import CreateWorkflowResponse
20
+ from .types.execute_workflow_response import ExecuteWorkflowResponse
21
+ from .types.list_workflows_response import ListWorkflowsResponse
22
+ from .types.update_workflow_request_fhir_provider_id import UpdateWorkflowRequestFhirProviderId
23
+ from .types.workflows_delete_response import WorkflowsDeleteResponse
24
+ from .types.workflows_get_response import WorkflowsGetResponse
25
+ from .types.workflows_update_response import WorkflowsUpdateResponse
26
+
27
+ # this is used as the default value for optional parameters
28
+ OMIT = typing.cast(typing.Any, ...)
10
29
 
11
30
 
12
31
  class RawWorkflowsClient:
13
32
  def __init__(self, *, client_wrapper: SyncClientWrapper):
14
33
  self._client_wrapper = client_wrapper
15
34
 
16
- def create_fhir_resource(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
35
+ def list(
36
+ self, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
37
+ ) -> HttpResponse[ListWorkflowsResponse]:
17
38
  """
39
+ Retrieves all workflow definitions for the authenticated user
40
+
18
41
  Parameters
19
42
  ----------
43
+ verbose : typing.Optional[bool]
44
+ If true, includes full workflow implementation details in workflow_details field
45
+
20
46
  request_options : typing.Optional[RequestOptions]
21
47
  Request-specific configuration.
22
48
 
23
49
  Returns
24
50
  -------
25
- HttpResponse[None]
51
+ HttpResponse[ListWorkflowsResponse]
52
+ Successfully retrieved workflows
26
53
  """
27
54
  _response = self._client_wrapper.httpx_client.request(
28
- "tools/lang2fhir-and-create",
29
- method="POST",
55
+ "workflows",
56
+ method="GET",
57
+ params={
58
+ "verbose": verbose,
59
+ },
30
60
  request_options=request_options,
31
61
  )
32
62
  try:
33
63
  if 200 <= _response.status_code < 300:
34
- return HttpResponse(response=_response, data=None)
64
+ _data = typing.cast(
65
+ ListWorkflowsResponse,
66
+ parse_obj_as(
67
+ type_=ListWorkflowsResponse, # type: ignore
68
+ object_=_response.json(),
69
+ ),
70
+ )
71
+ return HttpResponse(response=_response, data=_data)
72
+ if _response.status_code == 401:
73
+ raise UnauthorizedError(
74
+ headers=dict(_response.headers),
75
+ body=typing.cast(
76
+ typing.Optional[typing.Any],
77
+ parse_obj_as(
78
+ type_=typing.Optional[typing.Any], # type: ignore
79
+ object_=_response.json(),
80
+ ),
81
+ ),
82
+ )
83
+ if _response.status_code == 403:
84
+ raise ForbiddenError(
85
+ headers=dict(_response.headers),
86
+ body=typing.cast(
87
+ typing.Optional[typing.Any],
88
+ parse_obj_as(
89
+ type_=typing.Optional[typing.Any], # type: ignore
90
+ object_=_response.json(),
91
+ ),
92
+ ),
93
+ )
94
+ if _response.status_code == 500:
95
+ raise InternalServerError(
96
+ headers=dict(_response.headers),
97
+ body=typing.cast(
98
+ typing.Optional[typing.Any],
99
+ parse_obj_as(
100
+ type_=typing.Optional[typing.Any], # type: ignore
101
+ object_=_response.json(),
102
+ ),
103
+ ),
104
+ )
35
105
  _response_json = _response.json()
36
106
  except JSONDecodeError:
37
107
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
38
108
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
39
109
 
40
- def search_fhir_resources(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
110
+ def create(
111
+ self,
112
+ *,
113
+ name: str,
114
+ workflow_instructions: str,
115
+ sample_data: typing.Dict[str, typing.Optional[typing.Any]],
116
+ fhir_provider_id: CreateWorkflowRequestFhirProviderId,
117
+ verbose: typing.Optional[bool] = None,
118
+ dynamic_generation: typing.Optional[bool] = OMIT,
119
+ request_options: typing.Optional[RequestOptions] = None,
120
+ ) -> HttpResponse[CreateWorkflowResponse]:
41
121
  """
122
+ Creates a new workflow definition with graph generation from workflow instructions
123
+
42
124
  Parameters
43
125
  ----------
126
+ name : str
127
+ Human-readable name for the workflow
128
+
129
+ workflow_instructions : str
130
+ Natural language instructions that define the workflow logic
131
+
132
+ sample_data : typing.Dict[str, typing.Optional[typing.Any]]
133
+ Sample data to use for workflow graph generation
134
+
135
+ fhir_provider_id : CreateWorkflowRequestFhirProviderId
136
+ FHIR provider ID(s) - must be valid UUID(s) from existing FHIR providers
137
+
138
+ verbose : typing.Optional[bool]
139
+ If true, includes full workflow implementation details in workflow_details field
140
+
141
+ dynamic_generation : typing.Optional[bool]
142
+ Enable dynamic lang2fhir calls instead of pre-populated templates
143
+
44
144
  request_options : typing.Optional[RequestOptions]
45
145
  Request-specific configuration.
46
146
 
47
147
  Returns
48
148
  -------
49
- HttpResponse[None]
149
+ HttpResponse[CreateWorkflowResponse]
150
+ Successfully created workflow
50
151
  """
51
152
  _response = self._client_wrapper.httpx_client.request(
52
- "tools/lang2fhir-and-search",
153
+ "workflows",
53
154
  method="POST",
155
+ params={
156
+ "verbose": verbose,
157
+ },
158
+ json={
159
+ "name": name,
160
+ "workflow_instructions": workflow_instructions,
161
+ "sample_data": sample_data,
162
+ "fhir_provider_id": convert_and_respect_annotation_metadata(
163
+ object_=fhir_provider_id, annotation=CreateWorkflowRequestFhirProviderId, direction="write"
164
+ ),
165
+ "dynamic_generation": dynamic_generation,
166
+ },
167
+ headers={
168
+ "content-type": "application/json",
169
+ },
170
+ request_options=request_options,
171
+ omit=OMIT,
172
+ )
173
+ try:
174
+ if 200 <= _response.status_code < 300:
175
+ _data = typing.cast(
176
+ CreateWorkflowResponse,
177
+ parse_obj_as(
178
+ type_=CreateWorkflowResponse, # type: ignore
179
+ object_=_response.json(),
180
+ ),
181
+ )
182
+ return HttpResponse(response=_response, data=_data)
183
+ if _response.status_code == 400:
184
+ raise BadRequestError(
185
+ headers=dict(_response.headers),
186
+ body=typing.cast(
187
+ typing.Optional[typing.Any],
188
+ parse_obj_as(
189
+ type_=typing.Optional[typing.Any], # type: ignore
190
+ object_=_response.json(),
191
+ ),
192
+ ),
193
+ )
194
+ if _response.status_code == 401:
195
+ raise UnauthorizedError(
196
+ headers=dict(_response.headers),
197
+ body=typing.cast(
198
+ typing.Optional[typing.Any],
199
+ parse_obj_as(
200
+ type_=typing.Optional[typing.Any], # type: ignore
201
+ object_=_response.json(),
202
+ ),
203
+ ),
204
+ )
205
+ if _response.status_code == 403:
206
+ raise ForbiddenError(
207
+ headers=dict(_response.headers),
208
+ body=typing.cast(
209
+ typing.Optional[typing.Any],
210
+ parse_obj_as(
211
+ type_=typing.Optional[typing.Any], # type: ignore
212
+ object_=_response.json(),
213
+ ),
214
+ ),
215
+ )
216
+ if _response.status_code == 500:
217
+ raise InternalServerError(
218
+ headers=dict(_response.headers),
219
+ body=typing.cast(
220
+ typing.Optional[typing.Any],
221
+ parse_obj_as(
222
+ type_=typing.Optional[typing.Any], # type: ignore
223
+ object_=_response.json(),
224
+ ),
225
+ ),
226
+ )
227
+ _response_json = _response.json()
228
+ except JSONDecodeError:
229
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
230
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
231
+
232
+ def get(
233
+ self, id: str, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
234
+ ) -> HttpResponse[WorkflowsGetResponse]:
235
+ """
236
+ Retrieves a workflow definition by its ID
237
+
238
+ Parameters
239
+ ----------
240
+ id : str
241
+ ID of the workflow to retrieve
242
+
243
+ verbose : typing.Optional[bool]
244
+ If true, includes full workflow implementation details in workflow_details field
245
+
246
+ request_options : typing.Optional[RequestOptions]
247
+ Request-specific configuration.
248
+
249
+ Returns
250
+ -------
251
+ HttpResponse[WorkflowsGetResponse]
252
+ Successfully retrieved workflow
253
+ """
254
+ _response = self._client_wrapper.httpx_client.request(
255
+ f"workflows/{jsonable_encoder(id)}",
256
+ method="GET",
257
+ params={
258
+ "verbose": verbose,
259
+ },
260
+ request_options=request_options,
261
+ )
262
+ try:
263
+ if 200 <= _response.status_code < 300:
264
+ _data = typing.cast(
265
+ WorkflowsGetResponse,
266
+ parse_obj_as(
267
+ type_=WorkflowsGetResponse, # type: ignore
268
+ object_=_response.json(),
269
+ ),
270
+ )
271
+ return HttpResponse(response=_response, data=_data)
272
+ if _response.status_code == 401:
273
+ raise UnauthorizedError(
274
+ headers=dict(_response.headers),
275
+ body=typing.cast(
276
+ typing.Optional[typing.Any],
277
+ parse_obj_as(
278
+ type_=typing.Optional[typing.Any], # type: ignore
279
+ object_=_response.json(),
280
+ ),
281
+ ),
282
+ )
283
+ if _response.status_code == 403:
284
+ raise ForbiddenError(
285
+ headers=dict(_response.headers),
286
+ body=typing.cast(
287
+ typing.Optional[typing.Any],
288
+ parse_obj_as(
289
+ type_=typing.Optional[typing.Any], # type: ignore
290
+ object_=_response.json(),
291
+ ),
292
+ ),
293
+ )
294
+ if _response.status_code == 404:
295
+ raise NotFoundError(
296
+ headers=dict(_response.headers),
297
+ body=typing.cast(
298
+ typing.Optional[typing.Any],
299
+ parse_obj_as(
300
+ type_=typing.Optional[typing.Any], # type: ignore
301
+ object_=_response.json(),
302
+ ),
303
+ ),
304
+ )
305
+ if _response.status_code == 500:
306
+ raise InternalServerError(
307
+ headers=dict(_response.headers),
308
+ body=typing.cast(
309
+ typing.Optional[typing.Any],
310
+ parse_obj_as(
311
+ type_=typing.Optional[typing.Any], # type: ignore
312
+ object_=_response.json(),
313
+ ),
314
+ ),
315
+ )
316
+ _response_json = _response.json()
317
+ except JSONDecodeError:
318
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
319
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
320
+
321
+ def update(
322
+ self,
323
+ id: str,
324
+ *,
325
+ name: str,
326
+ workflow_instructions: str,
327
+ sample_data: typing.Dict[str, typing.Optional[typing.Any]],
328
+ fhir_provider_id: UpdateWorkflowRequestFhirProviderId,
329
+ verbose: typing.Optional[bool] = None,
330
+ dynamic_generation: typing.Optional[bool] = OMIT,
331
+ request_options: typing.Optional[RequestOptions] = None,
332
+ ) -> HttpResponse[WorkflowsUpdateResponse]:
333
+ """
334
+ Updates an existing workflow definition
335
+
336
+ Parameters
337
+ ----------
338
+ id : str
339
+ ID of the workflow to update
340
+
341
+ name : str
342
+ Human-readable name for the workflow
343
+
344
+ workflow_instructions : str
345
+ Natural language instructions that define the workflow logic
346
+
347
+ sample_data : typing.Dict[str, typing.Optional[typing.Any]]
348
+ Sample data to use for workflow graph generation
349
+
350
+ fhir_provider_id : UpdateWorkflowRequestFhirProviderId
351
+ FHIR provider ID(s) - must be valid UUID(s) from existing FHIR providers
352
+
353
+ verbose : typing.Optional[bool]
354
+ If true, includes full workflow implementation details in workflow_details field
355
+
356
+ dynamic_generation : typing.Optional[bool]
357
+ Enable dynamic lang2fhir calls instead of pre-populated templates
358
+
359
+ request_options : typing.Optional[RequestOptions]
360
+ Request-specific configuration.
361
+
362
+ Returns
363
+ -------
364
+ HttpResponse[WorkflowsUpdateResponse]
365
+ Successfully updated workflow
366
+ """
367
+ _response = self._client_wrapper.httpx_client.request(
368
+ f"workflows/{jsonable_encoder(id)}",
369
+ method="PUT",
370
+ params={
371
+ "verbose": verbose,
372
+ },
373
+ json={
374
+ "name": name,
375
+ "workflow_instructions": workflow_instructions,
376
+ "sample_data": sample_data,
377
+ "fhir_provider_id": convert_and_respect_annotation_metadata(
378
+ object_=fhir_provider_id, annotation=UpdateWorkflowRequestFhirProviderId, direction="write"
379
+ ),
380
+ "dynamic_generation": dynamic_generation,
381
+ },
382
+ headers={
383
+ "content-type": "application/json",
384
+ },
385
+ request_options=request_options,
386
+ omit=OMIT,
387
+ )
388
+ try:
389
+ if 200 <= _response.status_code < 300:
390
+ _data = typing.cast(
391
+ WorkflowsUpdateResponse,
392
+ parse_obj_as(
393
+ type_=WorkflowsUpdateResponse, # type: ignore
394
+ object_=_response.json(),
395
+ ),
396
+ )
397
+ return HttpResponse(response=_response, data=_data)
398
+ if _response.status_code == 400:
399
+ raise BadRequestError(
400
+ headers=dict(_response.headers),
401
+ body=typing.cast(
402
+ typing.Optional[typing.Any],
403
+ parse_obj_as(
404
+ type_=typing.Optional[typing.Any], # type: ignore
405
+ object_=_response.json(),
406
+ ),
407
+ ),
408
+ )
409
+ if _response.status_code == 401:
410
+ raise UnauthorizedError(
411
+ headers=dict(_response.headers),
412
+ body=typing.cast(
413
+ typing.Optional[typing.Any],
414
+ parse_obj_as(
415
+ type_=typing.Optional[typing.Any], # type: ignore
416
+ object_=_response.json(),
417
+ ),
418
+ ),
419
+ )
420
+ if _response.status_code == 403:
421
+ raise ForbiddenError(
422
+ headers=dict(_response.headers),
423
+ body=typing.cast(
424
+ typing.Optional[typing.Any],
425
+ parse_obj_as(
426
+ type_=typing.Optional[typing.Any], # type: ignore
427
+ object_=_response.json(),
428
+ ),
429
+ ),
430
+ )
431
+ if _response.status_code == 404:
432
+ raise NotFoundError(
433
+ headers=dict(_response.headers),
434
+ body=typing.cast(
435
+ typing.Optional[typing.Any],
436
+ parse_obj_as(
437
+ type_=typing.Optional[typing.Any], # type: ignore
438
+ object_=_response.json(),
439
+ ),
440
+ ),
441
+ )
442
+ if _response.status_code == 500:
443
+ raise InternalServerError(
444
+ headers=dict(_response.headers),
445
+ body=typing.cast(
446
+ typing.Optional[typing.Any],
447
+ parse_obj_as(
448
+ type_=typing.Optional[typing.Any], # type: ignore
449
+ object_=_response.json(),
450
+ ),
451
+ ),
452
+ )
453
+ _response_json = _response.json()
454
+ except JSONDecodeError:
455
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
456
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
457
+
458
+ def delete(
459
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
460
+ ) -> HttpResponse[WorkflowsDeleteResponse]:
461
+ """
462
+ Deletes a workflow definition by its ID
463
+
464
+ Parameters
465
+ ----------
466
+ id : str
467
+ ID of the workflow to delete
468
+
469
+ request_options : typing.Optional[RequestOptions]
470
+ Request-specific configuration.
471
+
472
+ Returns
473
+ -------
474
+ HttpResponse[WorkflowsDeleteResponse]
475
+ Successfully deleted workflow
476
+ """
477
+ _response = self._client_wrapper.httpx_client.request(
478
+ f"workflows/{jsonable_encoder(id)}",
479
+ method="DELETE",
54
480
  request_options=request_options,
55
481
  )
56
482
  try:
57
483
  if 200 <= _response.status_code < 300:
58
- return HttpResponse(response=_response, data=None)
484
+ _data = typing.cast(
485
+ WorkflowsDeleteResponse,
486
+ parse_obj_as(
487
+ type_=WorkflowsDeleteResponse, # type: ignore
488
+ object_=_response.json(),
489
+ ),
490
+ )
491
+ return HttpResponse(response=_response, data=_data)
492
+ if _response.status_code == 401:
493
+ raise UnauthorizedError(
494
+ headers=dict(_response.headers),
495
+ body=typing.cast(
496
+ typing.Optional[typing.Any],
497
+ parse_obj_as(
498
+ type_=typing.Optional[typing.Any], # type: ignore
499
+ object_=_response.json(),
500
+ ),
501
+ ),
502
+ )
503
+ if _response.status_code == 403:
504
+ raise ForbiddenError(
505
+ headers=dict(_response.headers),
506
+ body=typing.cast(
507
+ typing.Optional[typing.Any],
508
+ parse_obj_as(
509
+ type_=typing.Optional[typing.Any], # type: ignore
510
+ object_=_response.json(),
511
+ ),
512
+ ),
513
+ )
514
+ if _response.status_code == 404:
515
+ raise NotFoundError(
516
+ headers=dict(_response.headers),
517
+ body=typing.cast(
518
+ typing.Optional[typing.Any],
519
+ parse_obj_as(
520
+ type_=typing.Optional[typing.Any], # type: ignore
521
+ object_=_response.json(),
522
+ ),
523
+ ),
524
+ )
525
+ if _response.status_code == 500:
526
+ raise InternalServerError(
527
+ headers=dict(_response.headers),
528
+ body=typing.cast(
529
+ typing.Optional[typing.Any],
530
+ parse_obj_as(
531
+ type_=typing.Optional[typing.Any], # type: ignore
532
+ object_=_response.json(),
533
+ ),
534
+ ),
535
+ )
59
536
  _response_json = _response.json()
60
537
  except JSONDecodeError:
61
538
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
62
539
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
63
540
 
64
- def analyze_cohort(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
541
+ def execute(
542
+ self,
543
+ id: str,
544
+ *,
545
+ input_data: typing.Dict[str, typing.Optional[typing.Any]],
546
+ request_options: typing.Optional[RequestOptions] = None,
547
+ ) -> HttpResponse[ExecuteWorkflowResponse]:
65
548
  """
549
+ Executes a workflow with provided input data and returns results
550
+
66
551
  Parameters
67
552
  ----------
553
+ id : str
554
+ ID of the workflow to execute
555
+
556
+ input_data : typing.Dict[str, typing.Optional[typing.Any]]
557
+ Input data for workflow execution
558
+
68
559
  request_options : typing.Optional[RequestOptions]
69
560
  Request-specific configuration.
70
561
 
71
562
  Returns
72
563
  -------
73
- HttpResponse[None]
564
+ HttpResponse[ExecuteWorkflowResponse]
565
+ Successfully executed workflow
74
566
  """
75
567
  _response = self._client_wrapper.httpx_client.request(
76
- "tools/cohort",
568
+ f"workflows/{jsonable_encoder(id)}/execute",
77
569
  method="POST",
570
+ json={
571
+ "input_data": input_data,
572
+ },
573
+ headers={
574
+ "content-type": "application/json",
575
+ },
78
576
  request_options=request_options,
577
+ omit=OMIT,
79
578
  )
80
579
  try:
81
580
  if 200 <= _response.status_code < 300:
82
- return HttpResponse(response=_response, data=None)
581
+ _data = typing.cast(
582
+ ExecuteWorkflowResponse,
583
+ parse_obj_as(
584
+ type_=ExecuteWorkflowResponse, # type: ignore
585
+ object_=_response.json(),
586
+ ),
587
+ )
588
+ return HttpResponse(response=_response, data=_data)
589
+ if _response.status_code == 400:
590
+ raise BadRequestError(
591
+ headers=dict(_response.headers),
592
+ body=typing.cast(
593
+ typing.Optional[typing.Any],
594
+ parse_obj_as(
595
+ type_=typing.Optional[typing.Any], # type: ignore
596
+ object_=_response.json(),
597
+ ),
598
+ ),
599
+ )
600
+ if _response.status_code == 401:
601
+ raise UnauthorizedError(
602
+ headers=dict(_response.headers),
603
+ body=typing.cast(
604
+ typing.Optional[typing.Any],
605
+ parse_obj_as(
606
+ type_=typing.Optional[typing.Any], # type: ignore
607
+ object_=_response.json(),
608
+ ),
609
+ ),
610
+ )
611
+ if _response.status_code == 403:
612
+ raise ForbiddenError(
613
+ headers=dict(_response.headers),
614
+ body=typing.cast(
615
+ typing.Optional[typing.Any],
616
+ parse_obj_as(
617
+ type_=typing.Optional[typing.Any], # type: ignore
618
+ object_=_response.json(),
619
+ ),
620
+ ),
621
+ )
622
+ if _response.status_code == 404:
623
+ raise NotFoundError(
624
+ headers=dict(_response.headers),
625
+ body=typing.cast(
626
+ typing.Optional[typing.Any],
627
+ parse_obj_as(
628
+ type_=typing.Optional[typing.Any], # type: ignore
629
+ object_=_response.json(),
630
+ ),
631
+ ),
632
+ )
633
+ if _response.status_code == 500:
634
+ raise InternalServerError(
635
+ headers=dict(_response.headers),
636
+ body=typing.cast(
637
+ typing.Optional[typing.Any],
638
+ parse_obj_as(
639
+ type_=typing.Optional[typing.Any], # type: ignore
640
+ object_=_response.json(),
641
+ ),
642
+ ),
643
+ )
83
644
  _response_json = _response.json()
84
645
  except JSONDecodeError:
85
646
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -90,79 +651,615 @@ class AsyncRawWorkflowsClient:
90
651
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
91
652
  self._client_wrapper = client_wrapper
92
653
 
93
- async def create_fhir_resource(
94
- self, *, request_options: typing.Optional[RequestOptions] = None
95
- ) -> AsyncHttpResponse[None]:
654
+ async def list(
655
+ self, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
656
+ ) -> AsyncHttpResponse[ListWorkflowsResponse]:
96
657
  """
658
+ Retrieves all workflow definitions for the authenticated user
659
+
97
660
  Parameters
98
661
  ----------
662
+ verbose : typing.Optional[bool]
663
+ If true, includes full workflow implementation details in workflow_details field
664
+
99
665
  request_options : typing.Optional[RequestOptions]
100
666
  Request-specific configuration.
101
667
 
102
668
  Returns
103
669
  -------
104
- AsyncHttpResponse[None]
670
+ AsyncHttpResponse[ListWorkflowsResponse]
671
+ Successfully retrieved workflows
105
672
  """
106
673
  _response = await self._client_wrapper.httpx_client.request(
107
- "tools/lang2fhir-and-create",
108
- method="POST",
674
+ "workflows",
675
+ method="GET",
676
+ params={
677
+ "verbose": verbose,
678
+ },
109
679
  request_options=request_options,
110
680
  )
111
681
  try:
112
682
  if 200 <= _response.status_code < 300:
113
- return AsyncHttpResponse(response=_response, data=None)
683
+ _data = typing.cast(
684
+ ListWorkflowsResponse,
685
+ parse_obj_as(
686
+ type_=ListWorkflowsResponse, # type: ignore
687
+ object_=_response.json(),
688
+ ),
689
+ )
690
+ return AsyncHttpResponse(response=_response, data=_data)
691
+ if _response.status_code == 401:
692
+ raise UnauthorizedError(
693
+ headers=dict(_response.headers),
694
+ body=typing.cast(
695
+ typing.Optional[typing.Any],
696
+ parse_obj_as(
697
+ type_=typing.Optional[typing.Any], # type: ignore
698
+ object_=_response.json(),
699
+ ),
700
+ ),
701
+ )
702
+ if _response.status_code == 403:
703
+ raise ForbiddenError(
704
+ headers=dict(_response.headers),
705
+ body=typing.cast(
706
+ typing.Optional[typing.Any],
707
+ parse_obj_as(
708
+ type_=typing.Optional[typing.Any], # type: ignore
709
+ object_=_response.json(),
710
+ ),
711
+ ),
712
+ )
713
+ if _response.status_code == 500:
714
+ raise InternalServerError(
715
+ headers=dict(_response.headers),
716
+ body=typing.cast(
717
+ typing.Optional[typing.Any],
718
+ parse_obj_as(
719
+ type_=typing.Optional[typing.Any], # type: ignore
720
+ object_=_response.json(),
721
+ ),
722
+ ),
723
+ )
114
724
  _response_json = _response.json()
115
725
  except JSONDecodeError:
116
726
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
117
727
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
118
728
 
119
- async def search_fhir_resources(
120
- self, *, request_options: typing.Optional[RequestOptions] = None
121
- ) -> AsyncHttpResponse[None]:
729
+ async def create(
730
+ self,
731
+ *,
732
+ name: str,
733
+ workflow_instructions: str,
734
+ sample_data: typing.Dict[str, typing.Optional[typing.Any]],
735
+ fhir_provider_id: CreateWorkflowRequestFhirProviderId,
736
+ verbose: typing.Optional[bool] = None,
737
+ dynamic_generation: typing.Optional[bool] = OMIT,
738
+ request_options: typing.Optional[RequestOptions] = None,
739
+ ) -> AsyncHttpResponse[CreateWorkflowResponse]:
122
740
  """
741
+ Creates a new workflow definition with graph generation from workflow instructions
742
+
123
743
  Parameters
124
744
  ----------
745
+ name : str
746
+ Human-readable name for the workflow
747
+
748
+ workflow_instructions : str
749
+ Natural language instructions that define the workflow logic
750
+
751
+ sample_data : typing.Dict[str, typing.Optional[typing.Any]]
752
+ Sample data to use for workflow graph generation
753
+
754
+ fhir_provider_id : CreateWorkflowRequestFhirProviderId
755
+ FHIR provider ID(s) - must be valid UUID(s) from existing FHIR providers
756
+
757
+ verbose : typing.Optional[bool]
758
+ If true, includes full workflow implementation details in workflow_details field
759
+
760
+ dynamic_generation : typing.Optional[bool]
761
+ Enable dynamic lang2fhir calls instead of pre-populated templates
762
+
125
763
  request_options : typing.Optional[RequestOptions]
126
764
  Request-specific configuration.
127
765
 
128
766
  Returns
129
767
  -------
130
- AsyncHttpResponse[None]
768
+ AsyncHttpResponse[CreateWorkflowResponse]
769
+ Successfully created workflow
131
770
  """
132
771
  _response = await self._client_wrapper.httpx_client.request(
133
- "tools/lang2fhir-and-search",
772
+ "workflows",
134
773
  method="POST",
774
+ params={
775
+ "verbose": verbose,
776
+ },
777
+ json={
778
+ "name": name,
779
+ "workflow_instructions": workflow_instructions,
780
+ "sample_data": sample_data,
781
+ "fhir_provider_id": convert_and_respect_annotation_metadata(
782
+ object_=fhir_provider_id, annotation=CreateWorkflowRequestFhirProviderId, direction="write"
783
+ ),
784
+ "dynamic_generation": dynamic_generation,
785
+ },
786
+ headers={
787
+ "content-type": "application/json",
788
+ },
789
+ request_options=request_options,
790
+ omit=OMIT,
791
+ )
792
+ try:
793
+ if 200 <= _response.status_code < 300:
794
+ _data = typing.cast(
795
+ CreateWorkflowResponse,
796
+ parse_obj_as(
797
+ type_=CreateWorkflowResponse, # type: ignore
798
+ object_=_response.json(),
799
+ ),
800
+ )
801
+ return AsyncHttpResponse(response=_response, data=_data)
802
+ if _response.status_code == 400:
803
+ raise BadRequestError(
804
+ headers=dict(_response.headers),
805
+ body=typing.cast(
806
+ typing.Optional[typing.Any],
807
+ parse_obj_as(
808
+ type_=typing.Optional[typing.Any], # type: ignore
809
+ object_=_response.json(),
810
+ ),
811
+ ),
812
+ )
813
+ if _response.status_code == 401:
814
+ raise UnauthorizedError(
815
+ headers=dict(_response.headers),
816
+ body=typing.cast(
817
+ typing.Optional[typing.Any],
818
+ parse_obj_as(
819
+ type_=typing.Optional[typing.Any], # type: ignore
820
+ object_=_response.json(),
821
+ ),
822
+ ),
823
+ )
824
+ if _response.status_code == 403:
825
+ raise ForbiddenError(
826
+ headers=dict(_response.headers),
827
+ body=typing.cast(
828
+ typing.Optional[typing.Any],
829
+ parse_obj_as(
830
+ type_=typing.Optional[typing.Any], # type: ignore
831
+ object_=_response.json(),
832
+ ),
833
+ ),
834
+ )
835
+ if _response.status_code == 500:
836
+ raise InternalServerError(
837
+ headers=dict(_response.headers),
838
+ body=typing.cast(
839
+ typing.Optional[typing.Any],
840
+ parse_obj_as(
841
+ type_=typing.Optional[typing.Any], # type: ignore
842
+ object_=_response.json(),
843
+ ),
844
+ ),
845
+ )
846
+ _response_json = _response.json()
847
+ except JSONDecodeError:
848
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
849
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
850
+
851
+ async def get(
852
+ self, id: str, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
853
+ ) -> AsyncHttpResponse[WorkflowsGetResponse]:
854
+ """
855
+ Retrieves a workflow definition by its ID
856
+
857
+ Parameters
858
+ ----------
859
+ id : str
860
+ ID of the workflow to retrieve
861
+
862
+ verbose : typing.Optional[bool]
863
+ If true, includes full workflow implementation details in workflow_details field
864
+
865
+ request_options : typing.Optional[RequestOptions]
866
+ Request-specific configuration.
867
+
868
+ Returns
869
+ -------
870
+ AsyncHttpResponse[WorkflowsGetResponse]
871
+ Successfully retrieved workflow
872
+ """
873
+ _response = await self._client_wrapper.httpx_client.request(
874
+ f"workflows/{jsonable_encoder(id)}",
875
+ method="GET",
876
+ params={
877
+ "verbose": verbose,
878
+ },
135
879
  request_options=request_options,
136
880
  )
137
881
  try:
138
882
  if 200 <= _response.status_code < 300:
139
- return AsyncHttpResponse(response=_response, data=None)
883
+ _data = typing.cast(
884
+ WorkflowsGetResponse,
885
+ parse_obj_as(
886
+ type_=WorkflowsGetResponse, # type: ignore
887
+ object_=_response.json(),
888
+ ),
889
+ )
890
+ return AsyncHttpResponse(response=_response, data=_data)
891
+ if _response.status_code == 401:
892
+ raise UnauthorizedError(
893
+ headers=dict(_response.headers),
894
+ body=typing.cast(
895
+ typing.Optional[typing.Any],
896
+ parse_obj_as(
897
+ type_=typing.Optional[typing.Any], # type: ignore
898
+ object_=_response.json(),
899
+ ),
900
+ ),
901
+ )
902
+ if _response.status_code == 403:
903
+ raise ForbiddenError(
904
+ headers=dict(_response.headers),
905
+ body=typing.cast(
906
+ typing.Optional[typing.Any],
907
+ parse_obj_as(
908
+ type_=typing.Optional[typing.Any], # type: ignore
909
+ object_=_response.json(),
910
+ ),
911
+ ),
912
+ )
913
+ if _response.status_code == 404:
914
+ raise NotFoundError(
915
+ headers=dict(_response.headers),
916
+ body=typing.cast(
917
+ typing.Optional[typing.Any],
918
+ parse_obj_as(
919
+ type_=typing.Optional[typing.Any], # type: ignore
920
+ object_=_response.json(),
921
+ ),
922
+ ),
923
+ )
924
+ if _response.status_code == 500:
925
+ raise InternalServerError(
926
+ headers=dict(_response.headers),
927
+ body=typing.cast(
928
+ typing.Optional[typing.Any],
929
+ parse_obj_as(
930
+ type_=typing.Optional[typing.Any], # type: ignore
931
+ object_=_response.json(),
932
+ ),
933
+ ),
934
+ )
140
935
  _response_json = _response.json()
141
936
  except JSONDecodeError:
142
937
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
143
938
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
144
939
 
145
- async def analyze_cohort(
146
- self, *, request_options: typing.Optional[RequestOptions] = None
147
- ) -> AsyncHttpResponse[None]:
940
+ async def update(
941
+ self,
942
+ id: str,
943
+ *,
944
+ name: str,
945
+ workflow_instructions: str,
946
+ sample_data: typing.Dict[str, typing.Optional[typing.Any]],
947
+ fhir_provider_id: UpdateWorkflowRequestFhirProviderId,
948
+ verbose: typing.Optional[bool] = None,
949
+ dynamic_generation: typing.Optional[bool] = OMIT,
950
+ request_options: typing.Optional[RequestOptions] = None,
951
+ ) -> AsyncHttpResponse[WorkflowsUpdateResponse]:
148
952
  """
953
+ Updates an existing workflow definition
954
+
149
955
  Parameters
150
956
  ----------
957
+ id : str
958
+ ID of the workflow to update
959
+
960
+ name : str
961
+ Human-readable name for the workflow
962
+
963
+ workflow_instructions : str
964
+ Natural language instructions that define the workflow logic
965
+
966
+ sample_data : typing.Dict[str, typing.Optional[typing.Any]]
967
+ Sample data to use for workflow graph generation
968
+
969
+ fhir_provider_id : UpdateWorkflowRequestFhirProviderId
970
+ FHIR provider ID(s) - must be valid UUID(s) from existing FHIR providers
971
+
972
+ verbose : typing.Optional[bool]
973
+ If true, includes full workflow implementation details in workflow_details field
974
+
975
+ dynamic_generation : typing.Optional[bool]
976
+ Enable dynamic lang2fhir calls instead of pre-populated templates
977
+
978
+ request_options : typing.Optional[RequestOptions]
979
+ Request-specific configuration.
980
+
981
+ Returns
982
+ -------
983
+ AsyncHttpResponse[WorkflowsUpdateResponse]
984
+ Successfully updated workflow
985
+ """
986
+ _response = await self._client_wrapper.httpx_client.request(
987
+ f"workflows/{jsonable_encoder(id)}",
988
+ method="PUT",
989
+ params={
990
+ "verbose": verbose,
991
+ },
992
+ json={
993
+ "name": name,
994
+ "workflow_instructions": workflow_instructions,
995
+ "sample_data": sample_data,
996
+ "fhir_provider_id": convert_and_respect_annotation_metadata(
997
+ object_=fhir_provider_id, annotation=UpdateWorkflowRequestFhirProviderId, direction="write"
998
+ ),
999
+ "dynamic_generation": dynamic_generation,
1000
+ },
1001
+ headers={
1002
+ "content-type": "application/json",
1003
+ },
1004
+ request_options=request_options,
1005
+ omit=OMIT,
1006
+ )
1007
+ try:
1008
+ if 200 <= _response.status_code < 300:
1009
+ _data = typing.cast(
1010
+ WorkflowsUpdateResponse,
1011
+ parse_obj_as(
1012
+ type_=WorkflowsUpdateResponse, # type: ignore
1013
+ object_=_response.json(),
1014
+ ),
1015
+ )
1016
+ return AsyncHttpResponse(response=_response, data=_data)
1017
+ if _response.status_code == 400:
1018
+ raise BadRequestError(
1019
+ headers=dict(_response.headers),
1020
+ body=typing.cast(
1021
+ typing.Optional[typing.Any],
1022
+ parse_obj_as(
1023
+ type_=typing.Optional[typing.Any], # type: ignore
1024
+ object_=_response.json(),
1025
+ ),
1026
+ ),
1027
+ )
1028
+ if _response.status_code == 401:
1029
+ raise UnauthorizedError(
1030
+ headers=dict(_response.headers),
1031
+ body=typing.cast(
1032
+ typing.Optional[typing.Any],
1033
+ parse_obj_as(
1034
+ type_=typing.Optional[typing.Any], # type: ignore
1035
+ object_=_response.json(),
1036
+ ),
1037
+ ),
1038
+ )
1039
+ if _response.status_code == 403:
1040
+ raise ForbiddenError(
1041
+ headers=dict(_response.headers),
1042
+ body=typing.cast(
1043
+ typing.Optional[typing.Any],
1044
+ parse_obj_as(
1045
+ type_=typing.Optional[typing.Any], # type: ignore
1046
+ object_=_response.json(),
1047
+ ),
1048
+ ),
1049
+ )
1050
+ if _response.status_code == 404:
1051
+ raise NotFoundError(
1052
+ headers=dict(_response.headers),
1053
+ body=typing.cast(
1054
+ typing.Optional[typing.Any],
1055
+ parse_obj_as(
1056
+ type_=typing.Optional[typing.Any], # type: ignore
1057
+ object_=_response.json(),
1058
+ ),
1059
+ ),
1060
+ )
1061
+ if _response.status_code == 500:
1062
+ raise InternalServerError(
1063
+ headers=dict(_response.headers),
1064
+ body=typing.cast(
1065
+ typing.Optional[typing.Any],
1066
+ parse_obj_as(
1067
+ type_=typing.Optional[typing.Any], # type: ignore
1068
+ object_=_response.json(),
1069
+ ),
1070
+ ),
1071
+ )
1072
+ _response_json = _response.json()
1073
+ except JSONDecodeError:
1074
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1075
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1076
+
1077
+ async def delete(
1078
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1079
+ ) -> AsyncHttpResponse[WorkflowsDeleteResponse]:
1080
+ """
1081
+ Deletes a workflow definition by its ID
1082
+
1083
+ Parameters
1084
+ ----------
1085
+ id : str
1086
+ ID of the workflow to delete
1087
+
1088
+ request_options : typing.Optional[RequestOptions]
1089
+ Request-specific configuration.
1090
+
1091
+ Returns
1092
+ -------
1093
+ AsyncHttpResponse[WorkflowsDeleteResponse]
1094
+ Successfully deleted workflow
1095
+ """
1096
+ _response = await self._client_wrapper.httpx_client.request(
1097
+ f"workflows/{jsonable_encoder(id)}",
1098
+ method="DELETE",
1099
+ request_options=request_options,
1100
+ )
1101
+ try:
1102
+ if 200 <= _response.status_code < 300:
1103
+ _data = typing.cast(
1104
+ WorkflowsDeleteResponse,
1105
+ parse_obj_as(
1106
+ type_=WorkflowsDeleteResponse, # type: ignore
1107
+ object_=_response.json(),
1108
+ ),
1109
+ )
1110
+ return AsyncHttpResponse(response=_response, data=_data)
1111
+ if _response.status_code == 401:
1112
+ raise UnauthorizedError(
1113
+ headers=dict(_response.headers),
1114
+ body=typing.cast(
1115
+ typing.Optional[typing.Any],
1116
+ parse_obj_as(
1117
+ type_=typing.Optional[typing.Any], # type: ignore
1118
+ object_=_response.json(),
1119
+ ),
1120
+ ),
1121
+ )
1122
+ if _response.status_code == 403:
1123
+ raise ForbiddenError(
1124
+ headers=dict(_response.headers),
1125
+ body=typing.cast(
1126
+ typing.Optional[typing.Any],
1127
+ parse_obj_as(
1128
+ type_=typing.Optional[typing.Any], # type: ignore
1129
+ object_=_response.json(),
1130
+ ),
1131
+ ),
1132
+ )
1133
+ if _response.status_code == 404:
1134
+ raise NotFoundError(
1135
+ headers=dict(_response.headers),
1136
+ body=typing.cast(
1137
+ typing.Optional[typing.Any],
1138
+ parse_obj_as(
1139
+ type_=typing.Optional[typing.Any], # type: ignore
1140
+ object_=_response.json(),
1141
+ ),
1142
+ ),
1143
+ )
1144
+ if _response.status_code == 500:
1145
+ raise InternalServerError(
1146
+ headers=dict(_response.headers),
1147
+ body=typing.cast(
1148
+ typing.Optional[typing.Any],
1149
+ parse_obj_as(
1150
+ type_=typing.Optional[typing.Any], # type: ignore
1151
+ object_=_response.json(),
1152
+ ),
1153
+ ),
1154
+ )
1155
+ _response_json = _response.json()
1156
+ except JSONDecodeError:
1157
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1158
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1159
+
1160
+ async def execute(
1161
+ self,
1162
+ id: str,
1163
+ *,
1164
+ input_data: typing.Dict[str, typing.Optional[typing.Any]],
1165
+ request_options: typing.Optional[RequestOptions] = None,
1166
+ ) -> AsyncHttpResponse[ExecuteWorkflowResponse]:
1167
+ """
1168
+ Executes a workflow with provided input data and returns results
1169
+
1170
+ Parameters
1171
+ ----------
1172
+ id : str
1173
+ ID of the workflow to execute
1174
+
1175
+ input_data : typing.Dict[str, typing.Optional[typing.Any]]
1176
+ Input data for workflow execution
1177
+
151
1178
  request_options : typing.Optional[RequestOptions]
152
1179
  Request-specific configuration.
153
1180
 
154
1181
  Returns
155
1182
  -------
156
- AsyncHttpResponse[None]
1183
+ AsyncHttpResponse[ExecuteWorkflowResponse]
1184
+ Successfully executed workflow
157
1185
  """
158
1186
  _response = await self._client_wrapper.httpx_client.request(
159
- "tools/cohort",
1187
+ f"workflows/{jsonable_encoder(id)}/execute",
160
1188
  method="POST",
1189
+ json={
1190
+ "input_data": input_data,
1191
+ },
1192
+ headers={
1193
+ "content-type": "application/json",
1194
+ },
161
1195
  request_options=request_options,
1196
+ omit=OMIT,
162
1197
  )
163
1198
  try:
164
1199
  if 200 <= _response.status_code < 300:
165
- return AsyncHttpResponse(response=_response, data=None)
1200
+ _data = typing.cast(
1201
+ ExecuteWorkflowResponse,
1202
+ parse_obj_as(
1203
+ type_=ExecuteWorkflowResponse, # type: ignore
1204
+ object_=_response.json(),
1205
+ ),
1206
+ )
1207
+ return AsyncHttpResponse(response=_response, data=_data)
1208
+ if _response.status_code == 400:
1209
+ raise BadRequestError(
1210
+ headers=dict(_response.headers),
1211
+ body=typing.cast(
1212
+ typing.Optional[typing.Any],
1213
+ parse_obj_as(
1214
+ type_=typing.Optional[typing.Any], # type: ignore
1215
+ object_=_response.json(),
1216
+ ),
1217
+ ),
1218
+ )
1219
+ if _response.status_code == 401:
1220
+ raise UnauthorizedError(
1221
+ headers=dict(_response.headers),
1222
+ body=typing.cast(
1223
+ typing.Optional[typing.Any],
1224
+ parse_obj_as(
1225
+ type_=typing.Optional[typing.Any], # type: ignore
1226
+ object_=_response.json(),
1227
+ ),
1228
+ ),
1229
+ )
1230
+ if _response.status_code == 403:
1231
+ raise ForbiddenError(
1232
+ headers=dict(_response.headers),
1233
+ body=typing.cast(
1234
+ typing.Optional[typing.Any],
1235
+ parse_obj_as(
1236
+ type_=typing.Optional[typing.Any], # type: ignore
1237
+ object_=_response.json(),
1238
+ ),
1239
+ ),
1240
+ )
1241
+ if _response.status_code == 404:
1242
+ raise NotFoundError(
1243
+ headers=dict(_response.headers),
1244
+ body=typing.cast(
1245
+ typing.Optional[typing.Any],
1246
+ parse_obj_as(
1247
+ type_=typing.Optional[typing.Any], # type: ignore
1248
+ object_=_response.json(),
1249
+ ),
1250
+ ),
1251
+ )
1252
+ if _response.status_code == 500:
1253
+ raise InternalServerError(
1254
+ headers=dict(_response.headers),
1255
+ body=typing.cast(
1256
+ typing.Optional[typing.Any],
1257
+ parse_obj_as(
1258
+ type_=typing.Optional[typing.Any], # type: ignore
1259
+ object_=_response.json(),
1260
+ ),
1261
+ ),
1262
+ )
166
1263
  _response_json = _response.json()
167
1264
  except JSONDecodeError:
168
1265
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)