phenoml 0.0.6__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.
- phenoml/__init__.py +30 -0
- phenoml/agent/__init__.py +56 -0
- phenoml/agent/client.py +939 -0
- phenoml/agent/errors/__init__.py +11 -0
- phenoml/agent/errors/bad_request_error.py +10 -0
- phenoml/agent/errors/forbidden_error.py +10 -0
- phenoml/agent/errors/internal_server_error.py +10 -0
- phenoml/agent/errors/not_found_error.py +10 -0
- phenoml/agent/errors/unauthorized_error.py +10 -0
- phenoml/agent/prompts/__init__.py +7 -0
- phenoml/agent/prompts/client.py +707 -0
- phenoml/agent/prompts/raw_client.py +1345 -0
- phenoml/agent/prompts/types/__init__.py +8 -0
- phenoml/agent/prompts/types/prompts_delete_response.py +20 -0
- phenoml/agent/prompts/types/prompts_list_response.py +22 -0
- phenoml/agent/raw_client.py +1668 -0
- phenoml/agent/types/__init__.py +43 -0
- phenoml/agent/types/agent_chat_response.py +33 -0
- phenoml/agent/types/agent_create_request.py +53 -0
- phenoml/agent/types/agent_create_request_provider.py +5 -0
- phenoml/agent/types/agent_delete_response.py +20 -0
- phenoml/agent/types/agent_get_chat_messages_request_order.py +5 -0
- phenoml/agent/types/agent_get_chat_messages_response.py +22 -0
- phenoml/agent/types/agent_list_response.py +22 -0
- phenoml/agent/types/agent_prompts_response.py +22 -0
- phenoml/agent/types/agent_response.py +22 -0
- phenoml/agent/types/agent_template.py +58 -0
- phenoml/agent/types/agent_template_provider.py +5 -0
- phenoml/agent/types/chat_message_template.py +72 -0
- phenoml/agent/types/chat_session_template.py +67 -0
- phenoml/agent/types/json_patch.py +7 -0
- phenoml/agent/types/json_patch_operation.py +40 -0
- phenoml/agent/types/json_patch_operation_op.py +5 -0
- phenoml/agent/types/prompt_template.py +52 -0
- phenoml/agent/types/success_response.py +20 -0
- phenoml/authtoken/__init__.py +17 -0
- phenoml/authtoken/auth/__init__.py +7 -0
- phenoml/authtoken/auth/client.py +129 -0
- phenoml/authtoken/auth/raw_client.py +173 -0
- phenoml/authtoken/auth/types/__init__.py +7 -0
- phenoml/authtoken/auth/types/auth_generate_token_response.py +22 -0
- phenoml/authtoken/client.py +39 -0
- phenoml/authtoken/errors/__init__.py +8 -0
- phenoml/authtoken/errors/bad_request_error.py +10 -0
- phenoml/authtoken/errors/unauthorized_error.py +10 -0
- phenoml/authtoken/raw_client.py +13 -0
- phenoml/authtoken/types/__init__.py +8 -0
- phenoml/authtoken/types/bad_request_error_body.py +21 -0
- phenoml/authtoken/types/unauthorized_error_body.py +21 -0
- phenoml/client.py +177 -0
- phenoml/cohort/__init__.py +8 -0
- phenoml/cohort/client.py +113 -0
- phenoml/cohort/errors/__init__.py +9 -0
- phenoml/cohort/errors/bad_request_error.py +10 -0
- phenoml/cohort/errors/internal_server_error.py +10 -0
- phenoml/cohort/errors/unauthorized_error.py +10 -0
- phenoml/cohort/raw_client.py +185 -0
- phenoml/cohort/types/__init__.py +8 -0
- phenoml/cohort/types/cohort_response.py +33 -0
- phenoml/cohort/types/search_concept.py +37 -0
- phenoml/construe/__init__.py +45 -0
- phenoml/construe/client.py +399 -0
- phenoml/construe/errors/__init__.py +11 -0
- phenoml/construe/errors/bad_request_error.py +10 -0
- phenoml/construe/errors/conflict_error.py +10 -0
- phenoml/construe/errors/failed_dependency_error.py +10 -0
- phenoml/construe/errors/internal_server_error.py +10 -0
- phenoml/construe/errors/unauthorized_error.py +10 -0
- phenoml/construe/raw_client.py +706 -0
- phenoml/construe/types/__init__.py +41 -0
- phenoml/construe/types/bad_request_error_body.py +27 -0
- phenoml/construe/types/construe_cohort_request_config.py +37 -0
- phenoml/construe/types/construe_cohort_response.py +33 -0
- phenoml/construe/types/construe_cohort_response_queries_item.py +49 -0
- phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item.py +31 -0
- phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py +32 -0
- phenoml/construe/types/construe_upload_code_system_response.py +19 -0
- phenoml/construe/types/extract_codes_result.py +22 -0
- phenoml/construe/types/extract_request_config.py +23 -0
- phenoml/construe/types/extract_request_config_chunking_method.py +5 -0
- phenoml/construe/types/extract_request_system.py +37 -0
- phenoml/construe/types/extracted_code_result.py +41 -0
- phenoml/construe/types/internal_server_error_body.py +27 -0
- phenoml/construe/types/unauthorized_error_body.py +27 -0
- phenoml/construe/types/upload_request_format.py +5 -0
- phenoml/core/__init__.py +52 -0
- phenoml/core/api_error.py +23 -0
- phenoml/core/client_wrapper.py +87 -0
- phenoml/core/datetime_utils.py +28 -0
- phenoml/core/file.py +67 -0
- phenoml/core/force_multipart.py +16 -0
- phenoml/core/http_client.py +543 -0
- phenoml/core/http_response.py +55 -0
- phenoml/core/jsonable_encoder.py +100 -0
- phenoml/core/pydantic_utilities.py +255 -0
- phenoml/core/query_encoder.py +58 -0
- phenoml/core/remove_none_from_dict.py +11 -0
- phenoml/core/request_options.py +35 -0
- phenoml/core/serialization.py +276 -0
- phenoml/environment.py +7 -0
- phenoml/fhir/__init__.py +36 -0
- phenoml/fhir/client.py +970 -0
- phenoml/fhir/errors/__init__.py +10 -0
- phenoml/fhir/errors/bad_request_error.py +10 -0
- phenoml/fhir/errors/internal_server_error.py +10 -0
- phenoml/fhir/errors/not_found_error.py +10 -0
- phenoml/fhir/errors/unauthorized_error.py +10 -0
- phenoml/fhir/raw_client.py +1385 -0
- phenoml/fhir/types/__init__.py +29 -0
- phenoml/fhir/types/error_response.py +36 -0
- phenoml/fhir/types/fhir_bundle.py +43 -0
- phenoml/fhir/types/fhir_bundle_entry_item.py +34 -0
- phenoml/fhir/types/fhir_bundle_entry_item_request.py +25 -0
- phenoml/fhir/types/fhir_bundle_entry_item_request_method.py +5 -0
- phenoml/fhir/types/fhir_bundle_entry_item_response.py +24 -0
- phenoml/fhir/types/fhir_patch_request_body_item.py +40 -0
- phenoml/fhir/types/fhir_patch_request_body_item_op.py +7 -0
- phenoml/fhir/types/fhir_resource.py +40 -0
- phenoml/fhir/types/fhir_resource_meta.py +28 -0
- phenoml/fhir/types/fhir_search_response.py +8 -0
- phenoml/fhir_provider/__init__.py +43 -0
- phenoml/fhir_provider/client.py +731 -0
- phenoml/fhir_provider/errors/__init__.py +11 -0
- phenoml/fhir_provider/errors/bad_request_error.py +10 -0
- phenoml/fhir_provider/errors/forbidden_error.py +10 -0
- phenoml/fhir_provider/errors/internal_server_error.py +10 -0
- phenoml/fhir_provider/errors/not_found_error.py +10 -0
- phenoml/fhir_provider/errors/unauthorized_error.py +10 -0
- phenoml/fhir_provider/raw_client.py +1445 -0
- phenoml/fhir_provider/types/__init__.py +35 -0
- phenoml/fhir_provider/types/auth_method.py +7 -0
- phenoml/fhir_provider/types/fhir_provider_auth_config.py +53 -0
- phenoml/fhir_provider/types/fhir_provider_delete_response.py +20 -0
- phenoml/fhir_provider/types/fhir_provider_list_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_remove_auth_config_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_set_active_auth_config_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_template.py +66 -0
- phenoml/fhir_provider/types/fhir_query_response.py +27 -0
- phenoml/fhir_provider/types/fhir_query_response_data.py +5 -0
- phenoml/fhir_provider/types/json_web_key.py +51 -0
- phenoml/fhir_provider/types/provider.py +8 -0
- phenoml/fhir_provider/types/service_account_key.py +35 -0
- phenoml/fhir_provider/types/smart_configuration.py +46 -0
- phenoml/lang2fhir/__init__.py +27 -0
- phenoml/lang2fhir/client.py +430 -0
- phenoml/lang2fhir/errors/__init__.py +11 -0
- phenoml/lang2fhir/errors/bad_request_error.py +10 -0
- phenoml/lang2fhir/errors/failed_dependency_error.py +10 -0
- phenoml/lang2fhir/errors/forbidden_error.py +10 -0
- phenoml/lang2fhir/errors/internal_server_error.py +10 -0
- phenoml/lang2fhir/errors/unauthorized_error.py +10 -0
- phenoml/lang2fhir/raw_client.py +788 -0
- phenoml/lang2fhir/types/__init__.py +19 -0
- phenoml/lang2fhir/types/create_request_resource.py +25 -0
- phenoml/lang2fhir/types/document_request_file_type.py +7 -0
- phenoml/lang2fhir/types/document_request_resource.py +5 -0
- phenoml/lang2fhir/types/fhir_resource.py +5 -0
- phenoml/lang2fhir/types/lang2fhir_upload_profile_response.py +23 -0
- phenoml/lang2fhir/types/search_response.py +33 -0
- phenoml/py.typed +0 -0
- phenoml/tools/__init__.py +37 -0
- phenoml/tools/client.py +359 -0
- phenoml/tools/errors/__init__.py +11 -0
- phenoml/tools/errors/bad_request_error.py +10 -0
- phenoml/tools/errors/failed_dependency_error.py +10 -0
- phenoml/tools/errors/forbidden_error.py +10 -0
- phenoml/tools/errors/internal_server_error.py +10 -0
- phenoml/tools/errors/unauthorized_error.py +10 -0
- phenoml/tools/mcp_server/__init__.py +7 -0
- phenoml/tools/mcp_server/client.py +336 -0
- phenoml/tools/mcp_server/raw_client.py +641 -0
- phenoml/tools/mcp_server/tools/__init__.py +4 -0
- phenoml/tools/mcp_server/tools/client.py +358 -0
- phenoml/tools/mcp_server/tools/raw_client.py +656 -0
- phenoml/tools/raw_client.py +696 -0
- phenoml/tools/types/__init__.py +27 -0
- phenoml/tools/types/cohort_response.py +49 -0
- phenoml/tools/types/lang2fhir_and_create_request_resource.py +25 -0
- phenoml/tools/types/lang2fhir_and_create_response.py +33 -0
- phenoml/tools/types/lang2fhir_and_search_response.py +40 -0
- phenoml/tools/types/mcp_server_response.py +33 -0
- phenoml/tools/types/mcp_server_response_data.py +51 -0
- phenoml/tools/types/mcp_server_tool_call_response.py +37 -0
- phenoml/tools/types/mcp_server_tool_response.py +33 -0
- phenoml/tools/types/mcp_server_tool_response_data.py +61 -0
- phenoml/tools/types/search_concept.py +41 -0
- phenoml/types/__init__.py +21 -0
- phenoml/types/cohort_response.py +5 -0
- phenoml/types/lang2fhir_and_create_response.py +5 -0
- phenoml/types/lang2fhir_and_search_response.py +5 -0
- phenoml/types/mcp_server_response.py +5 -0
- phenoml/types/mcp_server_tool_call_response.py +5 -0
- phenoml/types/mcp_server_tool_response.py +5 -0
- phenoml/types/search_concept.py +5 -0
- phenoml/version.py +3 -0
- phenoml/workflows/__init__.py +66 -0
- phenoml/workflows/client.py +210 -0
- phenoml/workflows/errors/__init__.py +11 -0
- phenoml/workflows/errors/bad_request_error.py +10 -0
- phenoml/workflows/errors/forbidden_error.py +10 -0
- phenoml/workflows/errors/internal_server_error.py +10 -0
- phenoml/workflows/errors/not_found_error.py +10 -0
- phenoml/workflows/errors/unauthorized_error.py +10 -0
- phenoml/workflows/mcp_server/__init__.py +7 -0
- phenoml/workflows/mcp_server/client.py +274 -0
- phenoml/workflows/mcp_server/raw_client.py +226 -0
- phenoml/workflows/mcp_server/tools/__init__.py +4 -0
- phenoml/workflows/mcp_server/tools/client.py +287 -0
- phenoml/workflows/mcp_server/tools/raw_client.py +244 -0
- phenoml/workflows/raw_client.py +169 -0
- phenoml/workflows/types/__init__.py +43 -0
- phenoml/workflows/types/create_workflow_response.py +44 -0
- phenoml/workflows/types/decision_node_definition.py +32 -0
- phenoml/workflows/types/execute_workflow_response.py +30 -0
- phenoml/workflows/types/execute_workflow_response_results.py +22 -0
- phenoml/workflows/types/lang2fhir_create_definition.py +37 -0
- phenoml/workflows/types/lang2fhir_search_definition.py +42 -0
- phenoml/workflows/types/list_workflows_response.py +39 -0
- phenoml/workflows/types/step_operation.py +26 -0
- phenoml/workflows/types/sub_workflow_definition.py +32 -0
- phenoml/workflows/types/workflow_config.py +27 -0
- phenoml/workflows/types/workflow_definition.py +57 -0
- phenoml/workflows/types/workflow_graph.py +23 -0
- phenoml/workflows/types/workflow_response.py +61 -0
- phenoml/workflows/types/workflow_response_graph.py +23 -0
- phenoml/workflows/types/workflow_step.py +55 -0
- phenoml/workflows/types/workflow_step_summary.py +47 -0
- phenoml/workflows/types/workflow_step_summary_type.py +5 -0
- phenoml/workflows/types/workflow_step_type.py +5 -0
- phenoml/workflows/workflows/__init__.py +19 -0
- phenoml/workflows/workflows/client.py +694 -0
- phenoml/workflows/workflows/raw_client.py +1266 -0
- phenoml/workflows/workflows/types/__init__.py +17 -0
- phenoml/workflows/workflows/types/create_workflow_request_fhir_provider_id.py +5 -0
- phenoml/workflows/workflows/types/update_workflow_request_fhir_provider_id.py +5 -0
- phenoml/workflows/workflows/types/workflows_delete_response.py +20 -0
- phenoml/workflows/workflows/types/workflows_get_response.py +26 -0
- phenoml/workflows/workflows/types/workflows_update_response.py +31 -0
- phenoml/wrapper_client.py +123 -0
- phenoml-0.0.6.dist-info/LICENSE +21 -0
- phenoml-0.0.6.dist-info/METADATA +192 -0
- phenoml-0.0.6.dist-info/RECORD +244 -0
- phenoml-0.0.6.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,1266 @@
|
|
|
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 ..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_response import CreateWorkflowResponse
|
|
19
|
+
from ..types.execute_workflow_response import ExecuteWorkflowResponse
|
|
20
|
+
from ..types.list_workflows_response import ListWorkflowsResponse
|
|
21
|
+
from .types.create_workflow_request_fhir_provider_id import CreateWorkflowRequestFhirProviderId
|
|
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, ...)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class RawWorkflowsClient:
|
|
32
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
33
|
+
self._client_wrapper = client_wrapper
|
|
34
|
+
|
|
35
|
+
def list(
|
|
36
|
+
self, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
|
|
37
|
+
) -> HttpResponse[ListWorkflowsResponse]:
|
|
38
|
+
"""
|
|
39
|
+
Retrieves all workflow definitions for the authenticated user
|
|
40
|
+
|
|
41
|
+
Parameters
|
|
42
|
+
----------
|
|
43
|
+
verbose : typing.Optional[bool]
|
|
44
|
+
If true, includes full workflow implementation details in workflow_details field
|
|
45
|
+
|
|
46
|
+
request_options : typing.Optional[RequestOptions]
|
|
47
|
+
Request-specific configuration.
|
|
48
|
+
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
HttpResponse[ListWorkflowsResponse]
|
|
52
|
+
Successfully retrieved workflows
|
|
53
|
+
"""
|
|
54
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
55
|
+
"workflows",
|
|
56
|
+
method="GET",
|
|
57
|
+
params={
|
|
58
|
+
"verbose": verbose,
|
|
59
|
+
},
|
|
60
|
+
request_options=request_options,
|
|
61
|
+
)
|
|
62
|
+
try:
|
|
63
|
+
if 200 <= _response.status_code < 300:
|
|
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
|
+
)
|
|
105
|
+
_response_json = _response.json()
|
|
106
|
+
except JSONDecodeError:
|
|
107
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
108
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
109
|
+
|
|
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]:
|
|
121
|
+
"""
|
|
122
|
+
Creates a new workflow definition with graph generation from workflow instructions
|
|
123
|
+
|
|
124
|
+
Parameters
|
|
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
|
+
|
|
144
|
+
request_options : typing.Optional[RequestOptions]
|
|
145
|
+
Request-specific configuration.
|
|
146
|
+
|
|
147
|
+
Returns
|
|
148
|
+
-------
|
|
149
|
+
HttpResponse[CreateWorkflowResponse]
|
|
150
|
+
Successfully created workflow
|
|
151
|
+
"""
|
|
152
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
153
|
+
"workflows",
|
|
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",
|
|
480
|
+
request_options=request_options,
|
|
481
|
+
)
|
|
482
|
+
try:
|
|
483
|
+
if 200 <= _response.status_code < 300:
|
|
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
|
+
)
|
|
536
|
+
_response_json = _response.json()
|
|
537
|
+
except JSONDecodeError:
|
|
538
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
539
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
540
|
+
|
|
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]:
|
|
548
|
+
"""
|
|
549
|
+
Executes a workflow with provided input data and returns results
|
|
550
|
+
|
|
551
|
+
Parameters
|
|
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
|
+
|
|
559
|
+
request_options : typing.Optional[RequestOptions]
|
|
560
|
+
Request-specific configuration.
|
|
561
|
+
|
|
562
|
+
Returns
|
|
563
|
+
-------
|
|
564
|
+
HttpResponse[ExecuteWorkflowResponse]
|
|
565
|
+
Successfully executed workflow
|
|
566
|
+
"""
|
|
567
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
568
|
+
f"workflows/{jsonable_encoder(id)}/execute",
|
|
569
|
+
method="POST",
|
|
570
|
+
json={
|
|
571
|
+
"input_data": input_data,
|
|
572
|
+
},
|
|
573
|
+
headers={
|
|
574
|
+
"content-type": "application/json",
|
|
575
|
+
},
|
|
576
|
+
request_options=request_options,
|
|
577
|
+
omit=OMIT,
|
|
578
|
+
)
|
|
579
|
+
try:
|
|
580
|
+
if 200 <= _response.status_code < 300:
|
|
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
|
+
)
|
|
644
|
+
_response_json = _response.json()
|
|
645
|
+
except JSONDecodeError:
|
|
646
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
647
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
class AsyncRawWorkflowsClient:
|
|
651
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
652
|
+
self._client_wrapper = client_wrapper
|
|
653
|
+
|
|
654
|
+
async def list(
|
|
655
|
+
self, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
|
|
656
|
+
) -> AsyncHttpResponse[ListWorkflowsResponse]:
|
|
657
|
+
"""
|
|
658
|
+
Retrieves all workflow definitions for the authenticated user
|
|
659
|
+
|
|
660
|
+
Parameters
|
|
661
|
+
----------
|
|
662
|
+
verbose : typing.Optional[bool]
|
|
663
|
+
If true, includes full workflow implementation details in workflow_details field
|
|
664
|
+
|
|
665
|
+
request_options : typing.Optional[RequestOptions]
|
|
666
|
+
Request-specific configuration.
|
|
667
|
+
|
|
668
|
+
Returns
|
|
669
|
+
-------
|
|
670
|
+
AsyncHttpResponse[ListWorkflowsResponse]
|
|
671
|
+
Successfully retrieved workflows
|
|
672
|
+
"""
|
|
673
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
674
|
+
"workflows",
|
|
675
|
+
method="GET",
|
|
676
|
+
params={
|
|
677
|
+
"verbose": verbose,
|
|
678
|
+
},
|
|
679
|
+
request_options=request_options,
|
|
680
|
+
)
|
|
681
|
+
try:
|
|
682
|
+
if 200 <= _response.status_code < 300:
|
|
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
|
+
)
|
|
724
|
+
_response_json = _response.json()
|
|
725
|
+
except JSONDecodeError:
|
|
726
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
727
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
728
|
+
|
|
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]:
|
|
740
|
+
"""
|
|
741
|
+
Creates a new workflow definition with graph generation from workflow instructions
|
|
742
|
+
|
|
743
|
+
Parameters
|
|
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
|
+
|
|
763
|
+
request_options : typing.Optional[RequestOptions]
|
|
764
|
+
Request-specific configuration.
|
|
765
|
+
|
|
766
|
+
Returns
|
|
767
|
+
-------
|
|
768
|
+
AsyncHttpResponse[CreateWorkflowResponse]
|
|
769
|
+
Successfully created workflow
|
|
770
|
+
"""
|
|
771
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
772
|
+
"workflows",
|
|
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
|
+
},
|
|
879
|
+
request_options=request_options,
|
|
880
|
+
)
|
|
881
|
+
try:
|
|
882
|
+
if 200 <= _response.status_code < 300:
|
|
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
|
+
)
|
|
935
|
+
_response_json = _response.json()
|
|
936
|
+
except JSONDecodeError:
|
|
937
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
938
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
939
|
+
|
|
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]:
|
|
952
|
+
"""
|
|
953
|
+
Updates an existing workflow definition
|
|
954
|
+
|
|
955
|
+
Parameters
|
|
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
|
+
|
|
1178
|
+
request_options : typing.Optional[RequestOptions]
|
|
1179
|
+
Request-specific configuration.
|
|
1180
|
+
|
|
1181
|
+
Returns
|
|
1182
|
+
-------
|
|
1183
|
+
AsyncHttpResponse[ExecuteWorkflowResponse]
|
|
1184
|
+
Successfully executed workflow
|
|
1185
|
+
"""
|
|
1186
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1187
|
+
f"workflows/{jsonable_encoder(id)}/execute",
|
|
1188
|
+
method="POST",
|
|
1189
|
+
json={
|
|
1190
|
+
"input_data": input_data,
|
|
1191
|
+
},
|
|
1192
|
+
headers={
|
|
1193
|
+
"content-type": "application/json",
|
|
1194
|
+
},
|
|
1195
|
+
request_options=request_options,
|
|
1196
|
+
omit=OMIT,
|
|
1197
|
+
)
|
|
1198
|
+
try:
|
|
1199
|
+
if 200 <= _response.status_code < 300:
|
|
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
|
+
)
|
|
1263
|
+
_response_json = _response.json()
|
|
1264
|
+
except JSONDecodeError:
|
|
1265
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1266
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|