agenta 0.48.8__py3-none-any.whl → 0.48.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of agenta might be problematic. Click here for more details.
- agenta/__init__.py +3 -2
- agenta/client/Readme.md +258 -80
- agenta/client/__init__.py +205 -29
- agenta/client/backend/__init__.py +461 -0
- agenta/client/backend/access_control/__init__.py +2 -0
- agenta/client/backend/access_control/client.py +53 -73
- agenta/client/backend/access_control/raw_client.py +180 -0
- agenta/client/backend/admin/__init__.py +2 -0
- agenta/client/backend/admin/client.py +473 -268
- agenta/client/backend/admin/raw_client.py +1017 -0
- agenta/client/backend/api_keys/__init__.py +2 -0
- agenta/client/backend/api_keys/client.py +43 -276
- agenta/client/backend/api_keys/raw_client.py +364 -0
- agenta/client/backend/apps/__init__.py +2 -0
- agenta/client/backend/apps/client.py +132 -895
- agenta/client/backend/apps/raw_client.py +1516 -0
- agenta/client/backend/bases/__init__.py +2 -0
- agenta/client/backend/bases/client.py +33 -73
- agenta/client/backend/bases/raw_client.py +179 -0
- agenta/client/backend/billing/__init__.py +3 -0
- agenta/client/backend/billing/client.py +564 -0
- agenta/client/backend/billing/raw_client.py +805 -0
- agenta/client/backend/client.py +1268 -0
- agenta/client/backend/configs/__init__.py +2 -0
- agenta/client/backend/configs/client.py +49 -361
- agenta/client/backend/configs/raw_client.py +402 -0
- agenta/client/backend/containers/__init__.py +1 -3
- agenta/client/backend/containers/client.py +25 -548
- agenta/client/backend/containers/raw_client.py +112 -0
- agenta/client/backend/core/__init__.py +5 -0
- agenta/client/backend/core/api_error.py +12 -6
- agenta/client/backend/core/client_wrapper.py +4 -4
- agenta/client/backend/core/file.py +1 -3
- agenta/client/backend/core/force_multipart.py +16 -0
- agenta/client/backend/core/http_client.py +78 -34
- agenta/client/backend/core/http_response.py +55 -0
- agenta/client/backend/core/jsonable_encoder.py +0 -1
- agenta/client/backend/core/pydantic_utilities.py +88 -113
- agenta/client/backend/core/serialization.py +9 -3
- agenta/client/backend/environment.py +7 -0
- agenta/client/backend/environments/__init__.py +2 -0
- agenta/client/backend/environments/client.py +43 -79
- agenta/client/backend/environments/raw_client.py +193 -0
- agenta/client/backend/errors/__init__.py +2 -0
- agenta/client/backend/errors/unprocessable_entity_error.py +8 -2
- agenta/client/backend/evals/__init__.py +3 -0
- agenta/client/backend/evals/client.py +1042 -0
- agenta/client/backend/evals/raw_client.py +1549 -0
- agenta/client/backend/evaluations/__init__.py +2 -0
- agenta/client/backend/evaluations/client.py +106 -590
- agenta/client/backend/evaluations/raw_client.py +1344 -0
- agenta/client/backend/evaluators/__init__.py +2 -0
- agenta/client/backend/evaluators/client.py +99 -516
- agenta/client/backend/evaluators/raw_client.py +1182 -0
- agenta/client/backend/human_evaluations/__init__.py +2 -0
- agenta/client/backend/human_evaluations/client.py +120 -680
- agenta/client/backend/human_evaluations/raw_client.py +1577 -0
- agenta/client/backend/observability/__init__.py +14 -2
- agenta/client/backend/observability/client.py +185 -341
- agenta/client/backend/observability/raw_client.py +943 -0
- agenta/client/backend/observability/types/__init__.py +10 -2
- agenta/client/backend/observability/types/{format.py → fetch_trace_by_id_request_trace_id.py} +1 -1
- agenta/client/backend/observability/types/fetch_trace_by_id_response.py +15 -0
- agenta/client/backend/observability/types/query_analytics_response.py +2 -1
- agenta/client/backend/observability/types/query_traces_response.py +7 -3
- agenta/client/backend/organization/__init__.py +2 -0
- agenta/client/backend/organization/client.py +105 -361
- agenta/client/backend/organization/raw_client.py +774 -0
- agenta/client/backend/raw_client.py +1432 -0
- agenta/client/backend/scopes/__init__.py +2 -0
- agenta/client/backend/scopes/client.py +31 -45
- agenta/client/backend/scopes/raw_client.py +105 -0
- agenta/client/backend/testsets/__init__.py +14 -0
- agenta/client/backend/testsets/client.py +1098 -653
- agenta/client/backend/testsets/raw_client.py +2348 -0
- agenta/client/backend/testsets/types/__init__.py +17 -0
- agenta/client/backend/testsets/types/create_testset_from_file_request_file_type.py +7 -0
- agenta/client/backend/testsets/types/fetch_testset_to_file_request_file_type.py +7 -0
- agenta/client/backend/testsets/types/update_testset_from_file_request_file_type.py +7 -0
- agenta/client/backend/tracing/__init__.py +7 -0
- agenta/client/backend/tracing/client.py +782 -0
- agenta/client/backend/tracing/raw_client.py +1223 -0
- agenta/client/backend/tracing/types/__init__.py +8 -0
- agenta/client/backend/{types/variant_action_enum.py → tracing/types/fetch_trace_request_trace_id.py} +1 -1
- agenta/client/backend/tracing/types/remove_trace_request_trace_id.py +5 -0
- agenta/client/backend/types/__init__.py +153 -26
- agenta/client/backend/types/account_request.py +24 -0
- agenta/client/backend/types/account_response.py +5 -7
- agenta/client/backend/types/agenta_node_dto.py +13 -13
- agenta/client/backend/types/agenta_node_dto_nodes_value.py +1 -0
- agenta/client/backend/types/agenta_nodes_response.py +14 -8
- agenta/client/backend/types/agenta_root_dto.py +16 -8
- agenta/client/backend/types/agenta_roots_response.py +16 -8
- agenta/client/backend/types/agenta_tree_dto.py +16 -8
- agenta/client/backend/types/agenta_trees_response.py +16 -8
- agenta/client/backend/types/aggregated_result.py +5 -7
- agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -0
- agenta/client/backend/types/analytics_response.py +4 -6
- agenta/client/backend/types/annotation.py +50 -0
- agenta/client/backend/types/annotation_create.py +39 -0
- agenta/client/backend/types/annotation_edit.py +31 -0
- agenta/client/backend/types/annotation_kind.py +5 -0
- agenta/client/backend/types/{uri.py → annotation_link.py} +6 -7
- agenta/client/backend/types/{provider_key_dto.py → annotation_link_response.py} +6 -7
- agenta/client/backend/types/annotation_query.py +40 -0
- agenta/client/backend/types/annotation_query_request.py +20 -0
- agenta/client/backend/types/annotation_reference.py +21 -0
- agenta/client/backend/types/annotation_references.py +22 -0
- agenta/client/backend/types/{docker_env_vars.py → annotation_response.py} +6 -7
- agenta/client/backend/types/annotation_source.py +5 -0
- agenta/client/backend/types/annotations_response.py +24 -0
- agenta/client/backend/types/app.py +3 -5
- agenta/client/backend/types/app_variant_response.py +3 -6
- agenta/client/backend/types/app_variant_revision.py +5 -6
- agenta/client/backend/types/artifact.py +44 -0
- agenta/client/backend/types/base_output.py +3 -5
- agenta/client/backend/types/body_fetch_workflow_revision.py +21 -0
- agenta/client/backend/types/body_import_testset.py +3 -5
- agenta/client/backend/types/bucket_dto.py +4 -6
- agenta/client/backend/types/collect_status_response.py +3 -5
- agenta/client/backend/types/config_db.py +3 -5
- agenta/client/backend/types/config_dto.py +5 -7
- agenta/client/backend/types/config_response_model.py +5 -7
- agenta/client/backend/types/correct_answer.py +3 -5
- agenta/client/backend/types/create_app_output.py +3 -5
- agenta/client/backend/types/custom_model_settings_dto.py +3 -5
- agenta/client/backend/types/custom_provider_dto.py +6 -9
- agenta/client/backend/types/custom_provider_kind.py +5 -5
- agenta/client/backend/types/custom_provider_settings_dto.py +3 -5
- agenta/client/backend/types/data.py +2 -1
- agenta/client/backend/types/delete_evaluation.py +3 -5
- agenta/client/backend/types/environment_output.py +3 -5
- agenta/client/backend/types/environment_output_extended.py +4 -6
- agenta/client/backend/types/environment_revision.py +5 -5
- agenta/client/backend/types/error.py +3 -5
- agenta/client/backend/types/evaluation.py +6 -8
- agenta/client/backend/types/evaluation_scenario.py +5 -7
- agenta/client/backend/types/evaluation_scenario_input.py +3 -5
- agenta/client/backend/types/evaluation_scenario_output.py +4 -6
- agenta/client/backend/types/evaluation_scenario_result.py +4 -6
- agenta/client/backend/types/evaluator.py +31 -12
- agenta/client/backend/types/evaluator_config.py +3 -5
- agenta/client/backend/types/evaluator_flags.py +21 -0
- agenta/client/backend/types/evaluator_mapping_output_interface.py +3 -5
- agenta/client/backend/types/evaluator_output_interface.py +3 -5
- agenta/client/backend/types/evaluator_query.py +32 -0
- agenta/client/backend/types/evaluator_query_request.py +30 -0
- agenta/client/backend/types/evaluator_request.py +20 -0
- agenta/client/backend/types/evaluator_response.py +21 -0
- agenta/client/backend/types/evaluators_response.py +21 -0
- agenta/client/backend/types/exception_dto.py +3 -5
- agenta/client/backend/types/{o_tel_spans_response.py → extended_o_tel_tracing_response.py} +5 -7
- agenta/client/backend/types/focus.py +5 -0
- agenta/client/backend/types/format.py +5 -0
- agenta/client/backend/types/full_json_input.py +34 -0
- agenta/client/backend/types/full_json_output.py +29 -0
- agenta/client/backend/types/get_config_response.py +3 -5
- agenta/client/backend/types/{header_dto.py → header.py} +4 -6
- agenta/client/backend/types/http_validation_error.py +4 -6
- agenta/client/backend/types/human_evaluation.py +3 -5
- agenta/client/backend/types/human_evaluation_scenario.py +4 -6
- agenta/client/backend/types/human_evaluation_scenario_input.py +3 -5
- agenta/client/backend/types/human_evaluation_scenario_output.py +3 -5
- agenta/client/backend/types/invite_request.py +4 -6
- agenta/client/backend/types/legacy_analytics_response.py +4 -6
- agenta/client/backend/types/legacy_data_point.py +3 -5
- agenta/client/backend/types/legacy_evaluator.py +26 -0
- agenta/client/backend/types/legacy_scope_request.py +4 -6
- agenta/client/backend/types/legacy_scopes_response.py +3 -5
- agenta/client/backend/types/legacy_subscription_request.py +19 -0
- agenta/client/backend/types/legacy_user_request.py +5 -7
- agenta/client/backend/types/legacy_user_response.py +3 -5
- agenta/client/backend/types/lifecycle_dto.py +3 -5
- agenta/client/backend/types/link_dto.py +4 -6
- agenta/client/backend/types/list_api_keys_response.py +3 -5
- agenta/client/backend/types/llm_run_rate_limit.py +3 -5
- agenta/client/backend/types/meta_request.py +30 -0
- agenta/client/backend/types/metrics_dto.py +3 -5
- agenta/client/backend/types/new_testset.py +3 -5
- agenta/client/backend/types/node_dto.py +4 -6
- agenta/client/backend/types/o_tel_context_dto.py +3 -5
- agenta/client/backend/types/o_tel_event.py +35 -0
- agenta/client/backend/types/o_tel_event_dto.py +3 -5
- agenta/client/backend/types/o_tel_extra_dto.py +4 -6
- agenta/client/backend/types/o_tel_flat_span.py +56 -0
- agenta/client/backend/types/o_tel_flat_span_input_end_time.py +6 -0
- agenta/client/backend/types/o_tel_flat_span_input_start_time.py +6 -0
- agenta/client/backend/types/o_tel_flat_span_output_end_time.py +6 -0
- agenta/client/backend/types/o_tel_flat_span_output_start_time.py +6 -0
- agenta/client/backend/types/o_tel_link.py +34 -0
- agenta/client/backend/types/o_tel_link_dto.py +4 -6
- agenta/client/backend/types/o_tel_links_response.py +22 -0
- agenta/client/backend/types/o_tel_span.py +58 -0
- agenta/client/backend/types/o_tel_span_dto.py +8 -10
- agenta/client/backend/types/o_tel_span_input_end_time.py +6 -0
- agenta/client/backend/types/o_tel_span_input_spans_value.py +7 -0
- agenta/client/backend/types/o_tel_span_input_start_time.py +6 -0
- agenta/client/backend/types/o_tel_span_output_end_time.py +6 -0
- agenta/client/backend/types/o_tel_span_output_spans_value.py +30 -0
- agenta/client/backend/types/o_tel_span_output_start_time.py +6 -0
- agenta/client/backend/types/o_tel_spans_tree.py +22 -0
- agenta/client/backend/types/o_tel_spans_tree_input_spans_value.py +7 -0
- agenta/client/backend/types/o_tel_spans_tree_output_spans_value.py +5 -0
- agenta/client/backend/types/o_tel_status_code.py +1 -1
- agenta/client/backend/types/o_tel_tracing_data_response.py +22 -0
- agenta/client/backend/types/o_tel_tracing_request.py +22 -0
- agenta/client/backend/types/o_tel_tracing_response.py +27 -0
- agenta/client/backend/types/organization.py +3 -5
- agenta/client/backend/types/organization_details.py +3 -5
- agenta/client/backend/types/organization_membership_request.py +5 -7
- agenta/client/backend/types/organization_output.py +3 -5
- agenta/client/backend/types/organization_request.py +3 -5
- agenta/client/backend/types/parent_dto.py +3 -5
- agenta/client/backend/types/permission.py +11 -0
- agenta/client/backend/types/plan.py +14 -0
- agenta/client/backend/types/project_membership_request.py +5 -7
- agenta/client/backend/types/project_request.py +4 -6
- agenta/client/backend/types/project_scope.py +5 -7
- agenta/client/backend/types/projects_response.py +3 -5
- agenta/client/backend/types/recursive_types.py +23 -0
- agenta/client/backend/types/reference.py +18 -5
- agenta/client/backend/types/reference_dto.py +4 -5
- agenta/client/backend/types/reference_request_model.py +4 -5
- agenta/client/backend/types/result.py +4 -6
- agenta/client/backend/types/root_dto.py +3 -5
- agenta/client/backend/types/scopes_response_model.py +4 -6
- agenta/client/backend/types/secret_dto.py +5 -7
- agenta/client/backend/types/secret_response_dto.py +11 -11
- agenta/client/backend/types/simple_evaluation_output.py +4 -6
- agenta/client/backend/types/span_dto.py +18 -14
- agenta/client/backend/types/span_dto_nodes_value.py +1 -1
- agenta/client/backend/types/standard_provider_dto.py +5 -7
- agenta/client/backend/types/standard_provider_settings_dto.py +3 -5
- agenta/client/backend/types/status_dto.py +4 -6
- agenta/client/backend/types/tags_request.py +30 -0
- agenta/client/backend/types/test_set_output_response.py +5 -7
- agenta/client/backend/types/test_set_simple_response.py +3 -5
- agenta/client/backend/types/testcase_response.py +33 -0
- agenta/client/backend/types/testset.py +46 -0
- agenta/client/backend/types/testset_request.py +20 -0
- agenta/client/backend/types/testset_response.py +21 -0
- agenta/client/backend/types/testsets_response.py +21 -0
- agenta/client/backend/types/time_dto.py +3 -5
- agenta/client/backend/types/timestamp.py +6 -0
- agenta/client/backend/types/tree_dto.py +4 -6
- agenta/client/backend/types/update_app_output.py +3 -5
- agenta/client/backend/types/user_request.py +3 -5
- agenta/client/backend/types/validation_error.py +4 -6
- agenta/client/backend/types/workflow_artifact.py +45 -0
- agenta/client/backend/types/workflow_data.py +20 -0
- agenta/client/backend/types/workflow_flags.py +21 -0
- agenta/client/backend/types/workflow_request.py +20 -0
- agenta/client/backend/types/workflow_response.py +21 -0
- agenta/client/backend/types/workflow_revision.py +57 -0
- agenta/client/backend/types/workflow_revision_request.py +20 -0
- agenta/client/backend/types/workflow_revision_response.py +21 -0
- agenta/client/backend/types/workflow_revisions_response.py +21 -0
- agenta/client/backend/types/workflow_variant.py +48 -0
- agenta/client/backend/types/workflow_variant_request.py +20 -0
- agenta/client/backend/types/workflow_variant_response.py +21 -0
- agenta/client/backend/types/workflow_variants_response.py +21 -0
- agenta/client/backend/types/workflows_response.py +21 -0
- agenta/client/backend/types/workspace.py +3 -5
- agenta/client/backend/types/workspace_member_response.py +4 -6
- agenta/client/backend/types/workspace_membership_request.py +5 -7
- agenta/client/backend/types/workspace_permission.py +5 -7
- agenta/client/backend/types/workspace_request.py +4 -6
- agenta/client/backend/types/workspace_response.py +4 -6
- agenta/client/backend/variants/__init__.py +2 -0
- agenta/client/backend/variants/client.py +306 -1651
- agenta/client/backend/variants/raw_client.py +2482 -0
- agenta/client/backend/variants/types/__init__.py +2 -0
- agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +1 -0
- agenta/client/backend/vault/__init__.py +2 -0
- agenta/client/backend/vault/client.py +69 -323
- agenta/client/backend/vault/raw_client.py +616 -0
- agenta/client/backend/workflows/__init__.py +3 -0
- agenta/client/backend/workflows/client.py +2398 -0
- agenta/client/backend/workflows/raw_client.py +3639 -0
- agenta/client/backend/workspace/__init__.py +2 -0
- agenta/client/backend/workspace/client.py +46 -147
- agenta/client/backend/workspace/raw_client.py +376 -0
- agenta/client/types.py +4 -0
- agenta/sdk/decorators/tracing.py +2 -4
- agenta/sdk/tracing/processors.py +26 -39
- agenta/sdk/types.py +28 -1
- {agenta-0.48.8.dist-info → agenta-0.48.10.dist-info}/METADATA +1 -1
- agenta-0.48.10.dist-info/RECORD +362 -0
- agenta/client/backend/containers/types/__init__.py +0 -5
- agenta/client/backend/containers/types/container_templates_response.py +0 -6
- agenta/client/backend/types/image.py +0 -25
- agenta/client/backend/types/provider_kind.py +0 -21
- agenta/client/backend/types/template.py +0 -23
- agenta/client/backend/types/template_image_info.py +0 -29
- agenta/client/backend/types/variant_action.py +0 -22
- agenta-0.48.8.dist-info/RECORD +0 -255
- {agenta-0.48.8.dist-info → agenta-0.48.10.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,1432 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
from json.decoder import JSONDecodeError
|
|
6
|
+
|
|
7
|
+
from .core.api_error import ApiError
|
|
8
|
+
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
9
|
+
from .core.http_response import AsyncHttpResponse, HttpResponse
|
|
10
|
+
from .core.jsonable_encoder import jsonable_encoder
|
|
11
|
+
from .core.pydantic_utilities import parse_obj_as
|
|
12
|
+
from .core.request_options import RequestOptions
|
|
13
|
+
from .errors.unprocessable_entity_error import UnprocessableEntityError
|
|
14
|
+
from .types.http_validation_error import HttpValidationError
|
|
15
|
+
from .types.organization_output import OrganizationOutput
|
|
16
|
+
from .types.permission import Permission
|
|
17
|
+
from .types.workspace_response import WorkspaceResponse
|
|
18
|
+
|
|
19
|
+
# this is used as the default value for optional parameters
|
|
20
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class RawAgentaApi:
|
|
24
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
25
|
+
self._client_wrapper = client_wrapper
|
|
26
|
+
|
|
27
|
+
def get_own_org(
|
|
28
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
29
|
+
) -> HttpResponse[OrganizationOutput]:
|
|
30
|
+
"""
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
request_options : typing.Optional[RequestOptions]
|
|
34
|
+
Request-specific configuration.
|
|
35
|
+
|
|
36
|
+
Returns
|
|
37
|
+
-------
|
|
38
|
+
HttpResponse[OrganizationOutput]
|
|
39
|
+
Successful Response
|
|
40
|
+
"""
|
|
41
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
42
|
+
"organizations/own",
|
|
43
|
+
method="GET",
|
|
44
|
+
request_options=request_options,
|
|
45
|
+
)
|
|
46
|
+
try:
|
|
47
|
+
if 200 <= _response.status_code < 300:
|
|
48
|
+
_data = typing.cast(
|
|
49
|
+
OrganizationOutput,
|
|
50
|
+
parse_obj_as(
|
|
51
|
+
type_=OrganizationOutput, # type: ignore
|
|
52
|
+
object_=_response.json(),
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
return HttpResponse(response=_response, data=_data)
|
|
56
|
+
_response_json = _response.json()
|
|
57
|
+
except JSONDecodeError:
|
|
58
|
+
raise ApiError(
|
|
59
|
+
status_code=_response.status_code,
|
|
60
|
+
headers=dict(_response.headers),
|
|
61
|
+
body=_response.text,
|
|
62
|
+
)
|
|
63
|
+
raise ApiError(
|
|
64
|
+
status_code=_response.status_code,
|
|
65
|
+
headers=dict(_response.headers),
|
|
66
|
+
body=_response_json,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
def update_organization(
|
|
70
|
+
self,
|
|
71
|
+
org_id: str,
|
|
72
|
+
*,
|
|
73
|
+
name: typing.Optional[str] = OMIT,
|
|
74
|
+
description: typing.Optional[str] = OMIT,
|
|
75
|
+
updated_at: typing.Optional[str] = OMIT,
|
|
76
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
77
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
78
|
+
"""
|
|
79
|
+
Parameters
|
|
80
|
+
----------
|
|
81
|
+
org_id : str
|
|
82
|
+
|
|
83
|
+
name : typing.Optional[str]
|
|
84
|
+
|
|
85
|
+
description : typing.Optional[str]
|
|
86
|
+
|
|
87
|
+
updated_at : typing.Optional[str]
|
|
88
|
+
|
|
89
|
+
request_options : typing.Optional[RequestOptions]
|
|
90
|
+
Request-specific configuration.
|
|
91
|
+
|
|
92
|
+
Returns
|
|
93
|
+
-------
|
|
94
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
95
|
+
Successful Response
|
|
96
|
+
"""
|
|
97
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
98
|
+
f"organizations/{jsonable_encoder(org_id)}",
|
|
99
|
+
method="PUT",
|
|
100
|
+
json={
|
|
101
|
+
"name": name,
|
|
102
|
+
"description": description,
|
|
103
|
+
"updated_at": updated_at,
|
|
104
|
+
},
|
|
105
|
+
headers={
|
|
106
|
+
"content-type": "application/json",
|
|
107
|
+
},
|
|
108
|
+
request_options=request_options,
|
|
109
|
+
omit=OMIT,
|
|
110
|
+
)
|
|
111
|
+
try:
|
|
112
|
+
if _response is None or not _response.text.strip():
|
|
113
|
+
return HttpResponse(response=_response, data=None)
|
|
114
|
+
if 200 <= _response.status_code < 300:
|
|
115
|
+
_data = typing.cast(
|
|
116
|
+
typing.Optional[typing.Any],
|
|
117
|
+
parse_obj_as(
|
|
118
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
119
|
+
object_=_response.json(),
|
|
120
|
+
),
|
|
121
|
+
)
|
|
122
|
+
return HttpResponse(response=_response, data=_data)
|
|
123
|
+
if _response.status_code == 422:
|
|
124
|
+
raise UnprocessableEntityError(
|
|
125
|
+
headers=dict(_response.headers),
|
|
126
|
+
body=typing.cast(
|
|
127
|
+
HttpValidationError,
|
|
128
|
+
parse_obj_as(
|
|
129
|
+
type_=HttpValidationError, # type: ignore
|
|
130
|
+
object_=_response.json(),
|
|
131
|
+
),
|
|
132
|
+
),
|
|
133
|
+
)
|
|
134
|
+
_response_json = _response.json()
|
|
135
|
+
except JSONDecodeError:
|
|
136
|
+
raise ApiError(
|
|
137
|
+
status_code=_response.status_code,
|
|
138
|
+
headers=dict(_response.headers),
|
|
139
|
+
body=_response.text,
|
|
140
|
+
)
|
|
141
|
+
raise ApiError(
|
|
142
|
+
status_code=_response.status_code,
|
|
143
|
+
headers=dict(_response.headers),
|
|
144
|
+
body=_response_json,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
def create_workspace(
|
|
148
|
+
self,
|
|
149
|
+
org_id: str,
|
|
150
|
+
*,
|
|
151
|
+
name: str,
|
|
152
|
+
description: typing.Optional[str] = OMIT,
|
|
153
|
+
type: typing.Optional[str] = OMIT,
|
|
154
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
155
|
+
) -> HttpResponse[WorkspaceResponse]:
|
|
156
|
+
"""
|
|
157
|
+
Parameters
|
|
158
|
+
----------
|
|
159
|
+
org_id : str
|
|
160
|
+
|
|
161
|
+
name : str
|
|
162
|
+
|
|
163
|
+
description : typing.Optional[str]
|
|
164
|
+
|
|
165
|
+
type : typing.Optional[str]
|
|
166
|
+
|
|
167
|
+
request_options : typing.Optional[RequestOptions]
|
|
168
|
+
Request-specific configuration.
|
|
169
|
+
|
|
170
|
+
Returns
|
|
171
|
+
-------
|
|
172
|
+
HttpResponse[WorkspaceResponse]
|
|
173
|
+
Successful Response
|
|
174
|
+
"""
|
|
175
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
176
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces",
|
|
177
|
+
method="POST",
|
|
178
|
+
json={
|
|
179
|
+
"name": name,
|
|
180
|
+
"description": description,
|
|
181
|
+
"type": type,
|
|
182
|
+
},
|
|
183
|
+
headers={
|
|
184
|
+
"content-type": "application/json",
|
|
185
|
+
},
|
|
186
|
+
request_options=request_options,
|
|
187
|
+
omit=OMIT,
|
|
188
|
+
)
|
|
189
|
+
try:
|
|
190
|
+
if 200 <= _response.status_code < 300:
|
|
191
|
+
_data = typing.cast(
|
|
192
|
+
WorkspaceResponse,
|
|
193
|
+
parse_obj_as(
|
|
194
|
+
type_=WorkspaceResponse, # type: ignore
|
|
195
|
+
object_=_response.json(),
|
|
196
|
+
),
|
|
197
|
+
)
|
|
198
|
+
return HttpResponse(response=_response, data=_data)
|
|
199
|
+
if _response.status_code == 422:
|
|
200
|
+
raise UnprocessableEntityError(
|
|
201
|
+
headers=dict(_response.headers),
|
|
202
|
+
body=typing.cast(
|
|
203
|
+
HttpValidationError,
|
|
204
|
+
parse_obj_as(
|
|
205
|
+
type_=HttpValidationError, # type: ignore
|
|
206
|
+
object_=_response.json(),
|
|
207
|
+
),
|
|
208
|
+
),
|
|
209
|
+
)
|
|
210
|
+
_response_json = _response.json()
|
|
211
|
+
except JSONDecodeError:
|
|
212
|
+
raise ApiError(
|
|
213
|
+
status_code=_response.status_code,
|
|
214
|
+
headers=dict(_response.headers),
|
|
215
|
+
body=_response.text,
|
|
216
|
+
)
|
|
217
|
+
raise ApiError(
|
|
218
|
+
status_code=_response.status_code,
|
|
219
|
+
headers=dict(_response.headers),
|
|
220
|
+
body=_response_json,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
def update_workspace(
|
|
224
|
+
self,
|
|
225
|
+
org_id: str,
|
|
226
|
+
workspace_id: str,
|
|
227
|
+
*,
|
|
228
|
+
name: typing.Optional[str] = OMIT,
|
|
229
|
+
description: typing.Optional[str] = OMIT,
|
|
230
|
+
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
231
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
232
|
+
) -> HttpResponse[WorkspaceResponse]:
|
|
233
|
+
"""
|
|
234
|
+
Parameters
|
|
235
|
+
----------
|
|
236
|
+
org_id : str
|
|
237
|
+
|
|
238
|
+
workspace_id : str
|
|
239
|
+
|
|
240
|
+
name : typing.Optional[str]
|
|
241
|
+
|
|
242
|
+
description : typing.Optional[str]
|
|
243
|
+
|
|
244
|
+
updated_at : typing.Optional[dt.datetime]
|
|
245
|
+
|
|
246
|
+
request_options : typing.Optional[RequestOptions]
|
|
247
|
+
Request-specific configuration.
|
|
248
|
+
|
|
249
|
+
Returns
|
|
250
|
+
-------
|
|
251
|
+
HttpResponse[WorkspaceResponse]
|
|
252
|
+
Successful Response
|
|
253
|
+
"""
|
|
254
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
255
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}",
|
|
256
|
+
method="PUT",
|
|
257
|
+
json={
|
|
258
|
+
"name": name,
|
|
259
|
+
"description": description,
|
|
260
|
+
"updated_at": updated_at,
|
|
261
|
+
},
|
|
262
|
+
headers={
|
|
263
|
+
"content-type": "application/json",
|
|
264
|
+
},
|
|
265
|
+
request_options=request_options,
|
|
266
|
+
omit=OMIT,
|
|
267
|
+
)
|
|
268
|
+
try:
|
|
269
|
+
if 200 <= _response.status_code < 300:
|
|
270
|
+
_data = typing.cast(
|
|
271
|
+
WorkspaceResponse,
|
|
272
|
+
parse_obj_as(
|
|
273
|
+
type_=WorkspaceResponse, # type: ignore
|
|
274
|
+
object_=_response.json(),
|
|
275
|
+
),
|
|
276
|
+
)
|
|
277
|
+
return HttpResponse(response=_response, data=_data)
|
|
278
|
+
if _response.status_code == 422:
|
|
279
|
+
raise UnprocessableEntityError(
|
|
280
|
+
headers=dict(_response.headers),
|
|
281
|
+
body=typing.cast(
|
|
282
|
+
HttpValidationError,
|
|
283
|
+
parse_obj_as(
|
|
284
|
+
type_=HttpValidationError, # type: ignore
|
|
285
|
+
object_=_response.json(),
|
|
286
|
+
),
|
|
287
|
+
),
|
|
288
|
+
)
|
|
289
|
+
_response_json = _response.json()
|
|
290
|
+
except JSONDecodeError:
|
|
291
|
+
raise ApiError(
|
|
292
|
+
status_code=_response.status_code,
|
|
293
|
+
headers=dict(_response.headers),
|
|
294
|
+
body=_response.text,
|
|
295
|
+
)
|
|
296
|
+
raise ApiError(
|
|
297
|
+
status_code=_response.status_code,
|
|
298
|
+
headers=dict(_response.headers),
|
|
299
|
+
body=_response_json,
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
def get_all_workspace_permissions(
|
|
303
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
304
|
+
) -> HttpResponse[typing.List[Permission]]:
|
|
305
|
+
"""
|
|
306
|
+
Get all workspace permissions.
|
|
307
|
+
|
|
308
|
+
Returns a list of all available workspace permissions.
|
|
309
|
+
|
|
310
|
+
Returns:
|
|
311
|
+
List[Permission]: A list of Permission objects representing the available workspace permissions.
|
|
312
|
+
|
|
313
|
+
Raises:
|
|
314
|
+
HTTPException: If there is an error retrieving the workspace permissions.
|
|
315
|
+
|
|
316
|
+
Parameters
|
|
317
|
+
----------
|
|
318
|
+
request_options : typing.Optional[RequestOptions]
|
|
319
|
+
Request-specific configuration.
|
|
320
|
+
|
|
321
|
+
Returns
|
|
322
|
+
-------
|
|
323
|
+
HttpResponse[typing.List[Permission]]
|
|
324
|
+
Successful Response
|
|
325
|
+
"""
|
|
326
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
327
|
+
"workspaces/permissions",
|
|
328
|
+
method="GET",
|
|
329
|
+
request_options=request_options,
|
|
330
|
+
)
|
|
331
|
+
try:
|
|
332
|
+
if 200 <= _response.status_code < 300:
|
|
333
|
+
_data = typing.cast(
|
|
334
|
+
typing.List[Permission],
|
|
335
|
+
parse_obj_as(
|
|
336
|
+
type_=typing.List[Permission], # type: ignore
|
|
337
|
+
object_=_response.json(),
|
|
338
|
+
),
|
|
339
|
+
)
|
|
340
|
+
return HttpResponse(response=_response, data=_data)
|
|
341
|
+
_response_json = _response.json()
|
|
342
|
+
except JSONDecodeError:
|
|
343
|
+
raise ApiError(
|
|
344
|
+
status_code=_response.status_code,
|
|
345
|
+
headers=dict(_response.headers),
|
|
346
|
+
body=_response.text,
|
|
347
|
+
)
|
|
348
|
+
raise ApiError(
|
|
349
|
+
status_code=_response.status_code,
|
|
350
|
+
headers=dict(_response.headers),
|
|
351
|
+
body=_response_json,
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
def assign_role_to_user(
|
|
355
|
+
self,
|
|
356
|
+
workspace_id: str,
|
|
357
|
+
*,
|
|
358
|
+
email: str,
|
|
359
|
+
organization_id: str,
|
|
360
|
+
role: typing.Optional[str] = OMIT,
|
|
361
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
362
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
363
|
+
"""
|
|
364
|
+
Assigns a role to a user in a workspace.
|
|
365
|
+
|
|
366
|
+
Args:
|
|
367
|
+
payload (UserRole): The payload containing the organization id, user email, and role to assign.
|
|
368
|
+
workspace_id (str): The ID of the workspace.
|
|
369
|
+
request (Request): The FastAPI request object.
|
|
370
|
+
|
|
371
|
+
Returns:
|
|
372
|
+
bool: True if the role was successfully assigned, False otherwise.
|
|
373
|
+
|
|
374
|
+
Raises:
|
|
375
|
+
HTTPException: If the user does not have permission to perform this action.
|
|
376
|
+
HTTPException: If there is an error assigning the role to the user.
|
|
377
|
+
|
|
378
|
+
Parameters
|
|
379
|
+
----------
|
|
380
|
+
workspace_id : str
|
|
381
|
+
|
|
382
|
+
email : str
|
|
383
|
+
|
|
384
|
+
organization_id : str
|
|
385
|
+
|
|
386
|
+
role : typing.Optional[str]
|
|
387
|
+
|
|
388
|
+
request_options : typing.Optional[RequestOptions]
|
|
389
|
+
Request-specific configuration.
|
|
390
|
+
|
|
391
|
+
Returns
|
|
392
|
+
-------
|
|
393
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
394
|
+
Successful Response
|
|
395
|
+
"""
|
|
396
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
397
|
+
f"workspaces/{jsonable_encoder(workspace_id)}/roles",
|
|
398
|
+
method="POST",
|
|
399
|
+
json={
|
|
400
|
+
"email": email,
|
|
401
|
+
"organization_id": organization_id,
|
|
402
|
+
"role": role,
|
|
403
|
+
},
|
|
404
|
+
headers={
|
|
405
|
+
"content-type": "application/json",
|
|
406
|
+
},
|
|
407
|
+
request_options=request_options,
|
|
408
|
+
omit=OMIT,
|
|
409
|
+
)
|
|
410
|
+
try:
|
|
411
|
+
if _response is None or not _response.text.strip():
|
|
412
|
+
return HttpResponse(response=_response, data=None)
|
|
413
|
+
if 200 <= _response.status_code < 300:
|
|
414
|
+
_data = typing.cast(
|
|
415
|
+
typing.Optional[typing.Any],
|
|
416
|
+
parse_obj_as(
|
|
417
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
418
|
+
object_=_response.json(),
|
|
419
|
+
),
|
|
420
|
+
)
|
|
421
|
+
return HttpResponse(response=_response, data=_data)
|
|
422
|
+
if _response.status_code == 422:
|
|
423
|
+
raise UnprocessableEntityError(
|
|
424
|
+
headers=dict(_response.headers),
|
|
425
|
+
body=typing.cast(
|
|
426
|
+
HttpValidationError,
|
|
427
|
+
parse_obj_as(
|
|
428
|
+
type_=HttpValidationError, # type: ignore
|
|
429
|
+
object_=_response.json(),
|
|
430
|
+
),
|
|
431
|
+
),
|
|
432
|
+
)
|
|
433
|
+
_response_json = _response.json()
|
|
434
|
+
except JSONDecodeError:
|
|
435
|
+
raise ApiError(
|
|
436
|
+
status_code=_response.status_code,
|
|
437
|
+
headers=dict(_response.headers),
|
|
438
|
+
body=_response.text,
|
|
439
|
+
)
|
|
440
|
+
raise ApiError(
|
|
441
|
+
status_code=_response.status_code,
|
|
442
|
+
headers=dict(_response.headers),
|
|
443
|
+
body=_response_json,
|
|
444
|
+
)
|
|
445
|
+
|
|
446
|
+
def unassign_role_from_user(
|
|
447
|
+
self,
|
|
448
|
+
workspace_id: str,
|
|
449
|
+
*,
|
|
450
|
+
email: str,
|
|
451
|
+
org_id: str,
|
|
452
|
+
role: str,
|
|
453
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
454
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
455
|
+
"""
|
|
456
|
+
Delete a role assignment from a user in a workspace.
|
|
457
|
+
|
|
458
|
+
Args:
|
|
459
|
+
workspace_id (str): The ID of the workspace.
|
|
460
|
+
email (str): The email of the user to remove the role from.
|
|
461
|
+
org_id (str): The ID of the organization.
|
|
462
|
+
role (str): The role to remove from the user.
|
|
463
|
+
request (Request): The FastAPI request object.
|
|
464
|
+
|
|
465
|
+
Returns:
|
|
466
|
+
bool: True if the role assignment was successfully deleted.
|
|
467
|
+
|
|
468
|
+
Raises:
|
|
469
|
+
HTTPException: If there is an error in the request or the user does not have permission to perform the action.
|
|
470
|
+
HTTPException: If there is an error in updating the user's roles.
|
|
471
|
+
|
|
472
|
+
Parameters
|
|
473
|
+
----------
|
|
474
|
+
workspace_id : str
|
|
475
|
+
|
|
476
|
+
email : str
|
|
477
|
+
|
|
478
|
+
org_id : str
|
|
479
|
+
|
|
480
|
+
role : str
|
|
481
|
+
|
|
482
|
+
request_options : typing.Optional[RequestOptions]
|
|
483
|
+
Request-specific configuration.
|
|
484
|
+
|
|
485
|
+
Returns
|
|
486
|
+
-------
|
|
487
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
488
|
+
Successful Response
|
|
489
|
+
"""
|
|
490
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
491
|
+
f"workspaces/{jsonable_encoder(workspace_id)}/roles",
|
|
492
|
+
method="DELETE",
|
|
493
|
+
params={
|
|
494
|
+
"email": email,
|
|
495
|
+
"org_id": org_id,
|
|
496
|
+
"role": role,
|
|
497
|
+
},
|
|
498
|
+
request_options=request_options,
|
|
499
|
+
)
|
|
500
|
+
try:
|
|
501
|
+
if _response is None or not _response.text.strip():
|
|
502
|
+
return HttpResponse(response=_response, data=None)
|
|
503
|
+
if 200 <= _response.status_code < 300:
|
|
504
|
+
_data = typing.cast(
|
|
505
|
+
typing.Optional[typing.Any],
|
|
506
|
+
parse_obj_as(
|
|
507
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
508
|
+
object_=_response.json(),
|
|
509
|
+
),
|
|
510
|
+
)
|
|
511
|
+
return HttpResponse(response=_response, data=_data)
|
|
512
|
+
if _response.status_code == 422:
|
|
513
|
+
raise UnprocessableEntityError(
|
|
514
|
+
headers=dict(_response.headers),
|
|
515
|
+
body=typing.cast(
|
|
516
|
+
HttpValidationError,
|
|
517
|
+
parse_obj_as(
|
|
518
|
+
type_=HttpValidationError, # type: ignore
|
|
519
|
+
object_=_response.json(),
|
|
520
|
+
),
|
|
521
|
+
),
|
|
522
|
+
)
|
|
523
|
+
_response_json = _response.json()
|
|
524
|
+
except JSONDecodeError:
|
|
525
|
+
raise ApiError(
|
|
526
|
+
status_code=_response.status_code,
|
|
527
|
+
headers=dict(_response.headers),
|
|
528
|
+
body=_response.text,
|
|
529
|
+
)
|
|
530
|
+
raise ApiError(
|
|
531
|
+
status_code=_response.status_code,
|
|
532
|
+
headers=dict(_response.headers),
|
|
533
|
+
body=_response_json,
|
|
534
|
+
)
|
|
535
|
+
|
|
536
|
+
def delete_accounts(
|
|
537
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
538
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
539
|
+
"""
|
|
540
|
+
Parameters
|
|
541
|
+
----------
|
|
542
|
+
request_options : typing.Optional[RequestOptions]
|
|
543
|
+
Request-specific configuration.
|
|
544
|
+
|
|
545
|
+
Returns
|
|
546
|
+
-------
|
|
547
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
548
|
+
Successful Response
|
|
549
|
+
"""
|
|
550
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
551
|
+
"admin/accounts/delete-all",
|
|
552
|
+
method="POST",
|
|
553
|
+
request_options=request_options,
|
|
554
|
+
)
|
|
555
|
+
try:
|
|
556
|
+
if _response is None or not _response.text.strip():
|
|
557
|
+
return HttpResponse(response=_response, data=None)
|
|
558
|
+
if 200 <= _response.status_code < 300:
|
|
559
|
+
_data = typing.cast(
|
|
560
|
+
typing.Optional[typing.Any],
|
|
561
|
+
parse_obj_as(
|
|
562
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
563
|
+
object_=_response.json(),
|
|
564
|
+
),
|
|
565
|
+
)
|
|
566
|
+
return HttpResponse(response=_response, data=_data)
|
|
567
|
+
_response_json = _response.json()
|
|
568
|
+
except JSONDecodeError:
|
|
569
|
+
raise ApiError(
|
|
570
|
+
status_code=_response.status_code,
|
|
571
|
+
headers=dict(_response.headers),
|
|
572
|
+
body=_response.text,
|
|
573
|
+
)
|
|
574
|
+
raise ApiError(
|
|
575
|
+
status_code=_response.status_code,
|
|
576
|
+
headers=dict(_response.headers),
|
|
577
|
+
body=_response_json,
|
|
578
|
+
)
|
|
579
|
+
|
|
580
|
+
def health_check(
|
|
581
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
582
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
583
|
+
"""
|
|
584
|
+
Parameters
|
|
585
|
+
----------
|
|
586
|
+
request_options : typing.Optional[RequestOptions]
|
|
587
|
+
Request-specific configuration.
|
|
588
|
+
|
|
589
|
+
Returns
|
|
590
|
+
-------
|
|
591
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
592
|
+
Successful Response
|
|
593
|
+
"""
|
|
594
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
595
|
+
"health",
|
|
596
|
+
method="GET",
|
|
597
|
+
request_options=request_options,
|
|
598
|
+
)
|
|
599
|
+
try:
|
|
600
|
+
if _response is None or not _response.text.strip():
|
|
601
|
+
return HttpResponse(response=_response, data=None)
|
|
602
|
+
if 200 <= _response.status_code < 300:
|
|
603
|
+
_data = 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
|
+
return HttpResponse(response=_response, data=_data)
|
|
611
|
+
_response_json = _response.json()
|
|
612
|
+
except JSONDecodeError:
|
|
613
|
+
raise ApiError(
|
|
614
|
+
status_code=_response.status_code,
|
|
615
|
+
headers=dict(_response.headers),
|
|
616
|
+
body=_response.text,
|
|
617
|
+
)
|
|
618
|
+
raise ApiError(
|
|
619
|
+
status_code=_response.status_code,
|
|
620
|
+
headers=dict(_response.headers),
|
|
621
|
+
body=_response_json,
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
def fetch_user_profile(
|
|
625
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
626
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
627
|
+
"""
|
|
628
|
+
Parameters
|
|
629
|
+
----------
|
|
630
|
+
request_options : typing.Optional[RequestOptions]
|
|
631
|
+
Request-specific configuration.
|
|
632
|
+
|
|
633
|
+
Returns
|
|
634
|
+
-------
|
|
635
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
636
|
+
Successful Response
|
|
637
|
+
"""
|
|
638
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
639
|
+
"profile",
|
|
640
|
+
method="GET",
|
|
641
|
+
request_options=request_options,
|
|
642
|
+
)
|
|
643
|
+
try:
|
|
644
|
+
if _response is None or not _response.text.strip():
|
|
645
|
+
return HttpResponse(response=_response, data=None)
|
|
646
|
+
if 200 <= _response.status_code < 300:
|
|
647
|
+
_data = typing.cast(
|
|
648
|
+
typing.Optional[typing.Any],
|
|
649
|
+
parse_obj_as(
|
|
650
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
651
|
+
object_=_response.json(),
|
|
652
|
+
),
|
|
653
|
+
)
|
|
654
|
+
return HttpResponse(response=_response, data=_data)
|
|
655
|
+
_response_json = _response.json()
|
|
656
|
+
except JSONDecodeError:
|
|
657
|
+
raise ApiError(
|
|
658
|
+
status_code=_response.status_code,
|
|
659
|
+
headers=dict(_response.headers),
|
|
660
|
+
body=_response.text,
|
|
661
|
+
)
|
|
662
|
+
raise ApiError(
|
|
663
|
+
status_code=_response.status_code,
|
|
664
|
+
headers=dict(_response.headers),
|
|
665
|
+
body=_response_json,
|
|
666
|
+
)
|
|
667
|
+
|
|
668
|
+
def reset_user_password(
|
|
669
|
+
self, *, user_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
670
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
671
|
+
"""
|
|
672
|
+
Parameters
|
|
673
|
+
----------
|
|
674
|
+
user_id : str
|
|
675
|
+
|
|
676
|
+
request_options : typing.Optional[RequestOptions]
|
|
677
|
+
Request-specific configuration.
|
|
678
|
+
|
|
679
|
+
Returns
|
|
680
|
+
-------
|
|
681
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
682
|
+
Successful Response
|
|
683
|
+
"""
|
|
684
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
685
|
+
"profile/reset-password",
|
|
686
|
+
method="POST",
|
|
687
|
+
params={
|
|
688
|
+
"user_id": user_id,
|
|
689
|
+
},
|
|
690
|
+
request_options=request_options,
|
|
691
|
+
)
|
|
692
|
+
try:
|
|
693
|
+
if _response is None or not _response.text.strip():
|
|
694
|
+
return HttpResponse(response=_response, data=None)
|
|
695
|
+
if 200 <= _response.status_code < 300:
|
|
696
|
+
_data = typing.cast(
|
|
697
|
+
typing.Optional[typing.Any],
|
|
698
|
+
parse_obj_as(
|
|
699
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
700
|
+
object_=_response.json(),
|
|
701
|
+
),
|
|
702
|
+
)
|
|
703
|
+
return HttpResponse(response=_response, data=_data)
|
|
704
|
+
if _response.status_code == 422:
|
|
705
|
+
raise UnprocessableEntityError(
|
|
706
|
+
headers=dict(_response.headers),
|
|
707
|
+
body=typing.cast(
|
|
708
|
+
HttpValidationError,
|
|
709
|
+
parse_obj_as(
|
|
710
|
+
type_=HttpValidationError, # type: ignore
|
|
711
|
+
object_=_response.json(),
|
|
712
|
+
),
|
|
713
|
+
),
|
|
714
|
+
)
|
|
715
|
+
_response_json = _response.json()
|
|
716
|
+
except JSONDecodeError:
|
|
717
|
+
raise ApiError(
|
|
718
|
+
status_code=_response.status_code,
|
|
719
|
+
headers=dict(_response.headers),
|
|
720
|
+
body=_response.text,
|
|
721
|
+
)
|
|
722
|
+
raise ApiError(
|
|
723
|
+
status_code=_response.status_code,
|
|
724
|
+
headers=dict(_response.headers),
|
|
725
|
+
body=_response_json,
|
|
726
|
+
)
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
class AsyncRawAgentaApi:
|
|
730
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
731
|
+
self._client_wrapper = client_wrapper
|
|
732
|
+
|
|
733
|
+
async def get_own_org(
|
|
734
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
735
|
+
) -> AsyncHttpResponse[OrganizationOutput]:
|
|
736
|
+
"""
|
|
737
|
+
Parameters
|
|
738
|
+
----------
|
|
739
|
+
request_options : typing.Optional[RequestOptions]
|
|
740
|
+
Request-specific configuration.
|
|
741
|
+
|
|
742
|
+
Returns
|
|
743
|
+
-------
|
|
744
|
+
AsyncHttpResponse[OrganizationOutput]
|
|
745
|
+
Successful Response
|
|
746
|
+
"""
|
|
747
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
748
|
+
"organizations/own",
|
|
749
|
+
method="GET",
|
|
750
|
+
request_options=request_options,
|
|
751
|
+
)
|
|
752
|
+
try:
|
|
753
|
+
if 200 <= _response.status_code < 300:
|
|
754
|
+
_data = typing.cast(
|
|
755
|
+
OrganizationOutput,
|
|
756
|
+
parse_obj_as(
|
|
757
|
+
type_=OrganizationOutput, # type: ignore
|
|
758
|
+
object_=_response.json(),
|
|
759
|
+
),
|
|
760
|
+
)
|
|
761
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
762
|
+
_response_json = _response.json()
|
|
763
|
+
except JSONDecodeError:
|
|
764
|
+
raise ApiError(
|
|
765
|
+
status_code=_response.status_code,
|
|
766
|
+
headers=dict(_response.headers),
|
|
767
|
+
body=_response.text,
|
|
768
|
+
)
|
|
769
|
+
raise ApiError(
|
|
770
|
+
status_code=_response.status_code,
|
|
771
|
+
headers=dict(_response.headers),
|
|
772
|
+
body=_response_json,
|
|
773
|
+
)
|
|
774
|
+
|
|
775
|
+
async def update_organization(
|
|
776
|
+
self,
|
|
777
|
+
org_id: str,
|
|
778
|
+
*,
|
|
779
|
+
name: typing.Optional[str] = OMIT,
|
|
780
|
+
description: typing.Optional[str] = OMIT,
|
|
781
|
+
updated_at: typing.Optional[str] = OMIT,
|
|
782
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
783
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
784
|
+
"""
|
|
785
|
+
Parameters
|
|
786
|
+
----------
|
|
787
|
+
org_id : str
|
|
788
|
+
|
|
789
|
+
name : typing.Optional[str]
|
|
790
|
+
|
|
791
|
+
description : typing.Optional[str]
|
|
792
|
+
|
|
793
|
+
updated_at : typing.Optional[str]
|
|
794
|
+
|
|
795
|
+
request_options : typing.Optional[RequestOptions]
|
|
796
|
+
Request-specific configuration.
|
|
797
|
+
|
|
798
|
+
Returns
|
|
799
|
+
-------
|
|
800
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
801
|
+
Successful Response
|
|
802
|
+
"""
|
|
803
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
804
|
+
f"organizations/{jsonable_encoder(org_id)}",
|
|
805
|
+
method="PUT",
|
|
806
|
+
json={
|
|
807
|
+
"name": name,
|
|
808
|
+
"description": description,
|
|
809
|
+
"updated_at": updated_at,
|
|
810
|
+
},
|
|
811
|
+
headers={
|
|
812
|
+
"content-type": "application/json",
|
|
813
|
+
},
|
|
814
|
+
request_options=request_options,
|
|
815
|
+
omit=OMIT,
|
|
816
|
+
)
|
|
817
|
+
try:
|
|
818
|
+
if _response is None or not _response.text.strip():
|
|
819
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
820
|
+
if 200 <= _response.status_code < 300:
|
|
821
|
+
_data = typing.cast(
|
|
822
|
+
typing.Optional[typing.Any],
|
|
823
|
+
parse_obj_as(
|
|
824
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
825
|
+
object_=_response.json(),
|
|
826
|
+
),
|
|
827
|
+
)
|
|
828
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
829
|
+
if _response.status_code == 422:
|
|
830
|
+
raise UnprocessableEntityError(
|
|
831
|
+
headers=dict(_response.headers),
|
|
832
|
+
body=typing.cast(
|
|
833
|
+
HttpValidationError,
|
|
834
|
+
parse_obj_as(
|
|
835
|
+
type_=HttpValidationError, # type: ignore
|
|
836
|
+
object_=_response.json(),
|
|
837
|
+
),
|
|
838
|
+
),
|
|
839
|
+
)
|
|
840
|
+
_response_json = _response.json()
|
|
841
|
+
except JSONDecodeError:
|
|
842
|
+
raise ApiError(
|
|
843
|
+
status_code=_response.status_code,
|
|
844
|
+
headers=dict(_response.headers),
|
|
845
|
+
body=_response.text,
|
|
846
|
+
)
|
|
847
|
+
raise ApiError(
|
|
848
|
+
status_code=_response.status_code,
|
|
849
|
+
headers=dict(_response.headers),
|
|
850
|
+
body=_response_json,
|
|
851
|
+
)
|
|
852
|
+
|
|
853
|
+
async def create_workspace(
|
|
854
|
+
self,
|
|
855
|
+
org_id: str,
|
|
856
|
+
*,
|
|
857
|
+
name: str,
|
|
858
|
+
description: typing.Optional[str] = OMIT,
|
|
859
|
+
type: typing.Optional[str] = OMIT,
|
|
860
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
861
|
+
) -> AsyncHttpResponse[WorkspaceResponse]:
|
|
862
|
+
"""
|
|
863
|
+
Parameters
|
|
864
|
+
----------
|
|
865
|
+
org_id : str
|
|
866
|
+
|
|
867
|
+
name : str
|
|
868
|
+
|
|
869
|
+
description : typing.Optional[str]
|
|
870
|
+
|
|
871
|
+
type : typing.Optional[str]
|
|
872
|
+
|
|
873
|
+
request_options : typing.Optional[RequestOptions]
|
|
874
|
+
Request-specific configuration.
|
|
875
|
+
|
|
876
|
+
Returns
|
|
877
|
+
-------
|
|
878
|
+
AsyncHttpResponse[WorkspaceResponse]
|
|
879
|
+
Successful Response
|
|
880
|
+
"""
|
|
881
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
882
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces",
|
|
883
|
+
method="POST",
|
|
884
|
+
json={
|
|
885
|
+
"name": name,
|
|
886
|
+
"description": description,
|
|
887
|
+
"type": type,
|
|
888
|
+
},
|
|
889
|
+
headers={
|
|
890
|
+
"content-type": "application/json",
|
|
891
|
+
},
|
|
892
|
+
request_options=request_options,
|
|
893
|
+
omit=OMIT,
|
|
894
|
+
)
|
|
895
|
+
try:
|
|
896
|
+
if 200 <= _response.status_code < 300:
|
|
897
|
+
_data = typing.cast(
|
|
898
|
+
WorkspaceResponse,
|
|
899
|
+
parse_obj_as(
|
|
900
|
+
type_=WorkspaceResponse, # type: ignore
|
|
901
|
+
object_=_response.json(),
|
|
902
|
+
),
|
|
903
|
+
)
|
|
904
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
905
|
+
if _response.status_code == 422:
|
|
906
|
+
raise UnprocessableEntityError(
|
|
907
|
+
headers=dict(_response.headers),
|
|
908
|
+
body=typing.cast(
|
|
909
|
+
HttpValidationError,
|
|
910
|
+
parse_obj_as(
|
|
911
|
+
type_=HttpValidationError, # type: ignore
|
|
912
|
+
object_=_response.json(),
|
|
913
|
+
),
|
|
914
|
+
),
|
|
915
|
+
)
|
|
916
|
+
_response_json = _response.json()
|
|
917
|
+
except JSONDecodeError:
|
|
918
|
+
raise ApiError(
|
|
919
|
+
status_code=_response.status_code,
|
|
920
|
+
headers=dict(_response.headers),
|
|
921
|
+
body=_response.text,
|
|
922
|
+
)
|
|
923
|
+
raise ApiError(
|
|
924
|
+
status_code=_response.status_code,
|
|
925
|
+
headers=dict(_response.headers),
|
|
926
|
+
body=_response_json,
|
|
927
|
+
)
|
|
928
|
+
|
|
929
|
+
async def update_workspace(
|
|
930
|
+
self,
|
|
931
|
+
org_id: str,
|
|
932
|
+
workspace_id: str,
|
|
933
|
+
*,
|
|
934
|
+
name: typing.Optional[str] = OMIT,
|
|
935
|
+
description: typing.Optional[str] = OMIT,
|
|
936
|
+
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
937
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
938
|
+
) -> AsyncHttpResponse[WorkspaceResponse]:
|
|
939
|
+
"""
|
|
940
|
+
Parameters
|
|
941
|
+
----------
|
|
942
|
+
org_id : str
|
|
943
|
+
|
|
944
|
+
workspace_id : str
|
|
945
|
+
|
|
946
|
+
name : typing.Optional[str]
|
|
947
|
+
|
|
948
|
+
description : typing.Optional[str]
|
|
949
|
+
|
|
950
|
+
updated_at : typing.Optional[dt.datetime]
|
|
951
|
+
|
|
952
|
+
request_options : typing.Optional[RequestOptions]
|
|
953
|
+
Request-specific configuration.
|
|
954
|
+
|
|
955
|
+
Returns
|
|
956
|
+
-------
|
|
957
|
+
AsyncHttpResponse[WorkspaceResponse]
|
|
958
|
+
Successful Response
|
|
959
|
+
"""
|
|
960
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
961
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}",
|
|
962
|
+
method="PUT",
|
|
963
|
+
json={
|
|
964
|
+
"name": name,
|
|
965
|
+
"description": description,
|
|
966
|
+
"updated_at": updated_at,
|
|
967
|
+
},
|
|
968
|
+
headers={
|
|
969
|
+
"content-type": "application/json",
|
|
970
|
+
},
|
|
971
|
+
request_options=request_options,
|
|
972
|
+
omit=OMIT,
|
|
973
|
+
)
|
|
974
|
+
try:
|
|
975
|
+
if 200 <= _response.status_code < 300:
|
|
976
|
+
_data = typing.cast(
|
|
977
|
+
WorkspaceResponse,
|
|
978
|
+
parse_obj_as(
|
|
979
|
+
type_=WorkspaceResponse, # type: ignore
|
|
980
|
+
object_=_response.json(),
|
|
981
|
+
),
|
|
982
|
+
)
|
|
983
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
984
|
+
if _response.status_code == 422:
|
|
985
|
+
raise UnprocessableEntityError(
|
|
986
|
+
headers=dict(_response.headers),
|
|
987
|
+
body=typing.cast(
|
|
988
|
+
HttpValidationError,
|
|
989
|
+
parse_obj_as(
|
|
990
|
+
type_=HttpValidationError, # type: ignore
|
|
991
|
+
object_=_response.json(),
|
|
992
|
+
),
|
|
993
|
+
),
|
|
994
|
+
)
|
|
995
|
+
_response_json = _response.json()
|
|
996
|
+
except JSONDecodeError:
|
|
997
|
+
raise ApiError(
|
|
998
|
+
status_code=_response.status_code,
|
|
999
|
+
headers=dict(_response.headers),
|
|
1000
|
+
body=_response.text,
|
|
1001
|
+
)
|
|
1002
|
+
raise ApiError(
|
|
1003
|
+
status_code=_response.status_code,
|
|
1004
|
+
headers=dict(_response.headers),
|
|
1005
|
+
body=_response_json,
|
|
1006
|
+
)
|
|
1007
|
+
|
|
1008
|
+
async def get_all_workspace_permissions(
|
|
1009
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1010
|
+
) -> AsyncHttpResponse[typing.List[Permission]]:
|
|
1011
|
+
"""
|
|
1012
|
+
Get all workspace permissions.
|
|
1013
|
+
|
|
1014
|
+
Returns a list of all available workspace permissions.
|
|
1015
|
+
|
|
1016
|
+
Returns:
|
|
1017
|
+
List[Permission]: A list of Permission objects representing the available workspace permissions.
|
|
1018
|
+
|
|
1019
|
+
Raises:
|
|
1020
|
+
HTTPException: If there is an error retrieving the workspace permissions.
|
|
1021
|
+
|
|
1022
|
+
Parameters
|
|
1023
|
+
----------
|
|
1024
|
+
request_options : typing.Optional[RequestOptions]
|
|
1025
|
+
Request-specific configuration.
|
|
1026
|
+
|
|
1027
|
+
Returns
|
|
1028
|
+
-------
|
|
1029
|
+
AsyncHttpResponse[typing.List[Permission]]
|
|
1030
|
+
Successful Response
|
|
1031
|
+
"""
|
|
1032
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1033
|
+
"workspaces/permissions",
|
|
1034
|
+
method="GET",
|
|
1035
|
+
request_options=request_options,
|
|
1036
|
+
)
|
|
1037
|
+
try:
|
|
1038
|
+
if 200 <= _response.status_code < 300:
|
|
1039
|
+
_data = typing.cast(
|
|
1040
|
+
typing.List[Permission],
|
|
1041
|
+
parse_obj_as(
|
|
1042
|
+
type_=typing.List[Permission], # type: ignore
|
|
1043
|
+
object_=_response.json(),
|
|
1044
|
+
),
|
|
1045
|
+
)
|
|
1046
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1047
|
+
_response_json = _response.json()
|
|
1048
|
+
except JSONDecodeError:
|
|
1049
|
+
raise ApiError(
|
|
1050
|
+
status_code=_response.status_code,
|
|
1051
|
+
headers=dict(_response.headers),
|
|
1052
|
+
body=_response.text,
|
|
1053
|
+
)
|
|
1054
|
+
raise ApiError(
|
|
1055
|
+
status_code=_response.status_code,
|
|
1056
|
+
headers=dict(_response.headers),
|
|
1057
|
+
body=_response_json,
|
|
1058
|
+
)
|
|
1059
|
+
|
|
1060
|
+
async def assign_role_to_user(
|
|
1061
|
+
self,
|
|
1062
|
+
workspace_id: str,
|
|
1063
|
+
*,
|
|
1064
|
+
email: str,
|
|
1065
|
+
organization_id: str,
|
|
1066
|
+
role: typing.Optional[str] = OMIT,
|
|
1067
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1068
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
1069
|
+
"""
|
|
1070
|
+
Assigns a role to a user in a workspace.
|
|
1071
|
+
|
|
1072
|
+
Args:
|
|
1073
|
+
payload (UserRole): The payload containing the organization id, user email, and role to assign.
|
|
1074
|
+
workspace_id (str): The ID of the workspace.
|
|
1075
|
+
request (Request): The FastAPI request object.
|
|
1076
|
+
|
|
1077
|
+
Returns:
|
|
1078
|
+
bool: True if the role was successfully assigned, False otherwise.
|
|
1079
|
+
|
|
1080
|
+
Raises:
|
|
1081
|
+
HTTPException: If the user does not have permission to perform this action.
|
|
1082
|
+
HTTPException: If there is an error assigning the role to the user.
|
|
1083
|
+
|
|
1084
|
+
Parameters
|
|
1085
|
+
----------
|
|
1086
|
+
workspace_id : str
|
|
1087
|
+
|
|
1088
|
+
email : str
|
|
1089
|
+
|
|
1090
|
+
organization_id : str
|
|
1091
|
+
|
|
1092
|
+
role : typing.Optional[str]
|
|
1093
|
+
|
|
1094
|
+
request_options : typing.Optional[RequestOptions]
|
|
1095
|
+
Request-specific configuration.
|
|
1096
|
+
|
|
1097
|
+
Returns
|
|
1098
|
+
-------
|
|
1099
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
1100
|
+
Successful Response
|
|
1101
|
+
"""
|
|
1102
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1103
|
+
f"workspaces/{jsonable_encoder(workspace_id)}/roles",
|
|
1104
|
+
method="POST",
|
|
1105
|
+
json={
|
|
1106
|
+
"email": email,
|
|
1107
|
+
"organization_id": organization_id,
|
|
1108
|
+
"role": role,
|
|
1109
|
+
},
|
|
1110
|
+
headers={
|
|
1111
|
+
"content-type": "application/json",
|
|
1112
|
+
},
|
|
1113
|
+
request_options=request_options,
|
|
1114
|
+
omit=OMIT,
|
|
1115
|
+
)
|
|
1116
|
+
try:
|
|
1117
|
+
if _response is None or not _response.text.strip():
|
|
1118
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1119
|
+
if 200 <= _response.status_code < 300:
|
|
1120
|
+
_data = typing.cast(
|
|
1121
|
+
typing.Optional[typing.Any],
|
|
1122
|
+
parse_obj_as(
|
|
1123
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1124
|
+
object_=_response.json(),
|
|
1125
|
+
),
|
|
1126
|
+
)
|
|
1127
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1128
|
+
if _response.status_code == 422:
|
|
1129
|
+
raise UnprocessableEntityError(
|
|
1130
|
+
headers=dict(_response.headers),
|
|
1131
|
+
body=typing.cast(
|
|
1132
|
+
HttpValidationError,
|
|
1133
|
+
parse_obj_as(
|
|
1134
|
+
type_=HttpValidationError, # type: ignore
|
|
1135
|
+
object_=_response.json(),
|
|
1136
|
+
),
|
|
1137
|
+
),
|
|
1138
|
+
)
|
|
1139
|
+
_response_json = _response.json()
|
|
1140
|
+
except JSONDecodeError:
|
|
1141
|
+
raise ApiError(
|
|
1142
|
+
status_code=_response.status_code,
|
|
1143
|
+
headers=dict(_response.headers),
|
|
1144
|
+
body=_response.text,
|
|
1145
|
+
)
|
|
1146
|
+
raise ApiError(
|
|
1147
|
+
status_code=_response.status_code,
|
|
1148
|
+
headers=dict(_response.headers),
|
|
1149
|
+
body=_response_json,
|
|
1150
|
+
)
|
|
1151
|
+
|
|
1152
|
+
async def unassign_role_from_user(
|
|
1153
|
+
self,
|
|
1154
|
+
workspace_id: str,
|
|
1155
|
+
*,
|
|
1156
|
+
email: str,
|
|
1157
|
+
org_id: str,
|
|
1158
|
+
role: str,
|
|
1159
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1160
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
1161
|
+
"""
|
|
1162
|
+
Delete a role assignment from a user in a workspace.
|
|
1163
|
+
|
|
1164
|
+
Args:
|
|
1165
|
+
workspace_id (str): The ID of the workspace.
|
|
1166
|
+
email (str): The email of the user to remove the role from.
|
|
1167
|
+
org_id (str): The ID of the organization.
|
|
1168
|
+
role (str): The role to remove from the user.
|
|
1169
|
+
request (Request): The FastAPI request object.
|
|
1170
|
+
|
|
1171
|
+
Returns:
|
|
1172
|
+
bool: True if the role assignment was successfully deleted.
|
|
1173
|
+
|
|
1174
|
+
Raises:
|
|
1175
|
+
HTTPException: If there is an error in the request or the user does not have permission to perform the action.
|
|
1176
|
+
HTTPException: If there is an error in updating the user's roles.
|
|
1177
|
+
|
|
1178
|
+
Parameters
|
|
1179
|
+
----------
|
|
1180
|
+
workspace_id : str
|
|
1181
|
+
|
|
1182
|
+
email : str
|
|
1183
|
+
|
|
1184
|
+
org_id : str
|
|
1185
|
+
|
|
1186
|
+
role : str
|
|
1187
|
+
|
|
1188
|
+
request_options : typing.Optional[RequestOptions]
|
|
1189
|
+
Request-specific configuration.
|
|
1190
|
+
|
|
1191
|
+
Returns
|
|
1192
|
+
-------
|
|
1193
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
1194
|
+
Successful Response
|
|
1195
|
+
"""
|
|
1196
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1197
|
+
f"workspaces/{jsonable_encoder(workspace_id)}/roles",
|
|
1198
|
+
method="DELETE",
|
|
1199
|
+
params={
|
|
1200
|
+
"email": email,
|
|
1201
|
+
"org_id": org_id,
|
|
1202
|
+
"role": role,
|
|
1203
|
+
},
|
|
1204
|
+
request_options=request_options,
|
|
1205
|
+
)
|
|
1206
|
+
try:
|
|
1207
|
+
if _response is None or not _response.text.strip():
|
|
1208
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1209
|
+
if 200 <= _response.status_code < 300:
|
|
1210
|
+
_data = typing.cast(
|
|
1211
|
+
typing.Optional[typing.Any],
|
|
1212
|
+
parse_obj_as(
|
|
1213
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1214
|
+
object_=_response.json(),
|
|
1215
|
+
),
|
|
1216
|
+
)
|
|
1217
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1218
|
+
if _response.status_code == 422:
|
|
1219
|
+
raise UnprocessableEntityError(
|
|
1220
|
+
headers=dict(_response.headers),
|
|
1221
|
+
body=typing.cast(
|
|
1222
|
+
HttpValidationError,
|
|
1223
|
+
parse_obj_as(
|
|
1224
|
+
type_=HttpValidationError, # type: ignore
|
|
1225
|
+
object_=_response.json(),
|
|
1226
|
+
),
|
|
1227
|
+
),
|
|
1228
|
+
)
|
|
1229
|
+
_response_json = _response.json()
|
|
1230
|
+
except JSONDecodeError:
|
|
1231
|
+
raise ApiError(
|
|
1232
|
+
status_code=_response.status_code,
|
|
1233
|
+
headers=dict(_response.headers),
|
|
1234
|
+
body=_response.text,
|
|
1235
|
+
)
|
|
1236
|
+
raise ApiError(
|
|
1237
|
+
status_code=_response.status_code,
|
|
1238
|
+
headers=dict(_response.headers),
|
|
1239
|
+
body=_response_json,
|
|
1240
|
+
)
|
|
1241
|
+
|
|
1242
|
+
async def delete_accounts(
|
|
1243
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1244
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
1245
|
+
"""
|
|
1246
|
+
Parameters
|
|
1247
|
+
----------
|
|
1248
|
+
request_options : typing.Optional[RequestOptions]
|
|
1249
|
+
Request-specific configuration.
|
|
1250
|
+
|
|
1251
|
+
Returns
|
|
1252
|
+
-------
|
|
1253
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
1254
|
+
Successful Response
|
|
1255
|
+
"""
|
|
1256
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1257
|
+
"admin/accounts/delete-all",
|
|
1258
|
+
method="POST",
|
|
1259
|
+
request_options=request_options,
|
|
1260
|
+
)
|
|
1261
|
+
try:
|
|
1262
|
+
if _response is None or not _response.text.strip():
|
|
1263
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1264
|
+
if 200 <= _response.status_code < 300:
|
|
1265
|
+
_data = typing.cast(
|
|
1266
|
+
typing.Optional[typing.Any],
|
|
1267
|
+
parse_obj_as(
|
|
1268
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1269
|
+
object_=_response.json(),
|
|
1270
|
+
),
|
|
1271
|
+
)
|
|
1272
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1273
|
+
_response_json = _response.json()
|
|
1274
|
+
except JSONDecodeError:
|
|
1275
|
+
raise ApiError(
|
|
1276
|
+
status_code=_response.status_code,
|
|
1277
|
+
headers=dict(_response.headers),
|
|
1278
|
+
body=_response.text,
|
|
1279
|
+
)
|
|
1280
|
+
raise ApiError(
|
|
1281
|
+
status_code=_response.status_code,
|
|
1282
|
+
headers=dict(_response.headers),
|
|
1283
|
+
body=_response_json,
|
|
1284
|
+
)
|
|
1285
|
+
|
|
1286
|
+
async def health_check(
|
|
1287
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1288
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
1289
|
+
"""
|
|
1290
|
+
Parameters
|
|
1291
|
+
----------
|
|
1292
|
+
request_options : typing.Optional[RequestOptions]
|
|
1293
|
+
Request-specific configuration.
|
|
1294
|
+
|
|
1295
|
+
Returns
|
|
1296
|
+
-------
|
|
1297
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
1298
|
+
Successful Response
|
|
1299
|
+
"""
|
|
1300
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1301
|
+
"health",
|
|
1302
|
+
method="GET",
|
|
1303
|
+
request_options=request_options,
|
|
1304
|
+
)
|
|
1305
|
+
try:
|
|
1306
|
+
if _response is None or not _response.text.strip():
|
|
1307
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1308
|
+
if 200 <= _response.status_code < 300:
|
|
1309
|
+
_data = typing.cast(
|
|
1310
|
+
typing.Optional[typing.Any],
|
|
1311
|
+
parse_obj_as(
|
|
1312
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1313
|
+
object_=_response.json(),
|
|
1314
|
+
),
|
|
1315
|
+
)
|
|
1316
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1317
|
+
_response_json = _response.json()
|
|
1318
|
+
except JSONDecodeError:
|
|
1319
|
+
raise ApiError(
|
|
1320
|
+
status_code=_response.status_code,
|
|
1321
|
+
headers=dict(_response.headers),
|
|
1322
|
+
body=_response.text,
|
|
1323
|
+
)
|
|
1324
|
+
raise ApiError(
|
|
1325
|
+
status_code=_response.status_code,
|
|
1326
|
+
headers=dict(_response.headers),
|
|
1327
|
+
body=_response_json,
|
|
1328
|
+
)
|
|
1329
|
+
|
|
1330
|
+
async def fetch_user_profile(
|
|
1331
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1332
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
1333
|
+
"""
|
|
1334
|
+
Parameters
|
|
1335
|
+
----------
|
|
1336
|
+
request_options : typing.Optional[RequestOptions]
|
|
1337
|
+
Request-specific configuration.
|
|
1338
|
+
|
|
1339
|
+
Returns
|
|
1340
|
+
-------
|
|
1341
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
1342
|
+
Successful Response
|
|
1343
|
+
"""
|
|
1344
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1345
|
+
"profile",
|
|
1346
|
+
method="GET",
|
|
1347
|
+
request_options=request_options,
|
|
1348
|
+
)
|
|
1349
|
+
try:
|
|
1350
|
+
if _response is None or not _response.text.strip():
|
|
1351
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1352
|
+
if 200 <= _response.status_code < 300:
|
|
1353
|
+
_data = typing.cast(
|
|
1354
|
+
typing.Optional[typing.Any],
|
|
1355
|
+
parse_obj_as(
|
|
1356
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1357
|
+
object_=_response.json(),
|
|
1358
|
+
),
|
|
1359
|
+
)
|
|
1360
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1361
|
+
_response_json = _response.json()
|
|
1362
|
+
except JSONDecodeError:
|
|
1363
|
+
raise ApiError(
|
|
1364
|
+
status_code=_response.status_code,
|
|
1365
|
+
headers=dict(_response.headers),
|
|
1366
|
+
body=_response.text,
|
|
1367
|
+
)
|
|
1368
|
+
raise ApiError(
|
|
1369
|
+
status_code=_response.status_code,
|
|
1370
|
+
headers=dict(_response.headers),
|
|
1371
|
+
body=_response_json,
|
|
1372
|
+
)
|
|
1373
|
+
|
|
1374
|
+
async def reset_user_password(
|
|
1375
|
+
self, *, user_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
1376
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
1377
|
+
"""
|
|
1378
|
+
Parameters
|
|
1379
|
+
----------
|
|
1380
|
+
user_id : str
|
|
1381
|
+
|
|
1382
|
+
request_options : typing.Optional[RequestOptions]
|
|
1383
|
+
Request-specific configuration.
|
|
1384
|
+
|
|
1385
|
+
Returns
|
|
1386
|
+
-------
|
|
1387
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
1388
|
+
Successful Response
|
|
1389
|
+
"""
|
|
1390
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1391
|
+
"profile/reset-password",
|
|
1392
|
+
method="POST",
|
|
1393
|
+
params={
|
|
1394
|
+
"user_id": user_id,
|
|
1395
|
+
},
|
|
1396
|
+
request_options=request_options,
|
|
1397
|
+
)
|
|
1398
|
+
try:
|
|
1399
|
+
if _response is None or not _response.text.strip():
|
|
1400
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1401
|
+
if 200 <= _response.status_code < 300:
|
|
1402
|
+
_data = typing.cast(
|
|
1403
|
+
typing.Optional[typing.Any],
|
|
1404
|
+
parse_obj_as(
|
|
1405
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1406
|
+
object_=_response.json(),
|
|
1407
|
+
),
|
|
1408
|
+
)
|
|
1409
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1410
|
+
if _response.status_code == 422:
|
|
1411
|
+
raise UnprocessableEntityError(
|
|
1412
|
+
headers=dict(_response.headers),
|
|
1413
|
+
body=typing.cast(
|
|
1414
|
+
HttpValidationError,
|
|
1415
|
+
parse_obj_as(
|
|
1416
|
+
type_=HttpValidationError, # type: ignore
|
|
1417
|
+
object_=_response.json(),
|
|
1418
|
+
),
|
|
1419
|
+
),
|
|
1420
|
+
)
|
|
1421
|
+
_response_json = _response.json()
|
|
1422
|
+
except JSONDecodeError:
|
|
1423
|
+
raise ApiError(
|
|
1424
|
+
status_code=_response.status_code,
|
|
1425
|
+
headers=dict(_response.headers),
|
|
1426
|
+
body=_response.text,
|
|
1427
|
+
)
|
|
1428
|
+
raise ApiError(
|
|
1429
|
+
status_code=_response.status_code,
|
|
1430
|
+
headers=dict(_response.headers),
|
|
1431
|
+
body=_response_json,
|
|
1432
|
+
)
|