agenta 0.48.9__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/types.py +28 -1
- {agenta-0.48.9.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.9.dist-info/RECORD +0 -255
- {agenta-0.48.9.dist-info → agenta-0.48.10.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,774 @@
|
|
|
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.unprocessable_entity_error import UnprocessableEntityError
|
|
14
|
+
from ..types.http_validation_error import HttpValidationError
|
|
15
|
+
from ..types.invite_request import InviteRequest
|
|
16
|
+
from ..types.organization import Organization
|
|
17
|
+
from ..types.organization_details import OrganizationDetails
|
|
18
|
+
|
|
19
|
+
# this is used as the default value for optional parameters
|
|
20
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class RawOrganizationClient:
|
|
24
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
25
|
+
self._client_wrapper = client_wrapper
|
|
26
|
+
|
|
27
|
+
def fetch_organization_details(
|
|
28
|
+
self, org_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
29
|
+
) -> HttpResponse[OrganizationDetails]:
|
|
30
|
+
"""
|
|
31
|
+
Return the details of the organization.
|
|
32
|
+
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
org_id : str
|
|
36
|
+
|
|
37
|
+
request_options : typing.Optional[RequestOptions]
|
|
38
|
+
Request-specific configuration.
|
|
39
|
+
|
|
40
|
+
Returns
|
|
41
|
+
-------
|
|
42
|
+
HttpResponse[OrganizationDetails]
|
|
43
|
+
Successful Response
|
|
44
|
+
"""
|
|
45
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
46
|
+
f"organizations/{jsonable_encoder(org_id)}",
|
|
47
|
+
method="GET",
|
|
48
|
+
request_options=request_options,
|
|
49
|
+
)
|
|
50
|
+
try:
|
|
51
|
+
if 200 <= _response.status_code < 300:
|
|
52
|
+
_data = typing.cast(
|
|
53
|
+
OrganizationDetails,
|
|
54
|
+
parse_obj_as(
|
|
55
|
+
type_=OrganizationDetails, # type: ignore
|
|
56
|
+
object_=_response.json(),
|
|
57
|
+
),
|
|
58
|
+
)
|
|
59
|
+
return HttpResponse(response=_response, data=_data)
|
|
60
|
+
if _response.status_code == 422:
|
|
61
|
+
raise UnprocessableEntityError(
|
|
62
|
+
headers=dict(_response.headers),
|
|
63
|
+
body=typing.cast(
|
|
64
|
+
HttpValidationError,
|
|
65
|
+
parse_obj_as(
|
|
66
|
+
type_=HttpValidationError, # type: ignore
|
|
67
|
+
object_=_response.json(),
|
|
68
|
+
),
|
|
69
|
+
),
|
|
70
|
+
)
|
|
71
|
+
_response_json = _response.json()
|
|
72
|
+
except JSONDecodeError:
|
|
73
|
+
raise ApiError(
|
|
74
|
+
status_code=_response.status_code,
|
|
75
|
+
headers=dict(_response.headers),
|
|
76
|
+
body=_response.text,
|
|
77
|
+
)
|
|
78
|
+
raise ApiError(
|
|
79
|
+
status_code=_response.status_code,
|
|
80
|
+
headers=dict(_response.headers),
|
|
81
|
+
body=_response_json,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
def list_organizations(
|
|
85
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
86
|
+
) -> HttpResponse[typing.List[Organization]]:
|
|
87
|
+
"""
|
|
88
|
+
Returns a list of organizations associated with the user's session.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
list[Organization]: A list of organizations associated with the user's session.
|
|
92
|
+
|
|
93
|
+
Raises:
|
|
94
|
+
HTTPException: If there is an error retrieving the organizations from the database.
|
|
95
|
+
|
|
96
|
+
Parameters
|
|
97
|
+
----------
|
|
98
|
+
request_options : typing.Optional[RequestOptions]
|
|
99
|
+
Request-specific configuration.
|
|
100
|
+
|
|
101
|
+
Returns
|
|
102
|
+
-------
|
|
103
|
+
HttpResponse[typing.List[Organization]]
|
|
104
|
+
Successful Response
|
|
105
|
+
"""
|
|
106
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
107
|
+
"organizations",
|
|
108
|
+
method="GET",
|
|
109
|
+
request_options=request_options,
|
|
110
|
+
)
|
|
111
|
+
try:
|
|
112
|
+
if 200 <= _response.status_code < 300:
|
|
113
|
+
_data = typing.cast(
|
|
114
|
+
typing.List[Organization],
|
|
115
|
+
parse_obj_as(
|
|
116
|
+
type_=typing.List[Organization], # type: ignore
|
|
117
|
+
object_=_response.json(),
|
|
118
|
+
),
|
|
119
|
+
)
|
|
120
|
+
return HttpResponse(response=_response, data=_data)
|
|
121
|
+
_response_json = _response.json()
|
|
122
|
+
except JSONDecodeError:
|
|
123
|
+
raise ApiError(
|
|
124
|
+
status_code=_response.status_code,
|
|
125
|
+
headers=dict(_response.headers),
|
|
126
|
+
body=_response.text,
|
|
127
|
+
)
|
|
128
|
+
raise ApiError(
|
|
129
|
+
status_code=_response.status_code,
|
|
130
|
+
headers=dict(_response.headers),
|
|
131
|
+
body=_response_json,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
def invite_user_to_workspace(
|
|
135
|
+
self,
|
|
136
|
+
org_id: str,
|
|
137
|
+
workspace_id: str,
|
|
138
|
+
*,
|
|
139
|
+
request: typing.Sequence[InviteRequest],
|
|
140
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
141
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
142
|
+
"""
|
|
143
|
+
Assigns a role to a user in an organization.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
org_id (str): The ID of the organization.
|
|
147
|
+
payload (InviteRequest): The payload containing the organization id, user email, and role to assign.
|
|
148
|
+
workspace_id (str): The ID of the workspace.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
bool: True if the role was successfully assigned, False otherwise.
|
|
152
|
+
|
|
153
|
+
Raises:
|
|
154
|
+
HTTPException: If the user does not have permission to perform this action.
|
|
155
|
+
HTTPException: If there is an error assigning the role to the user.
|
|
156
|
+
|
|
157
|
+
Parameters
|
|
158
|
+
----------
|
|
159
|
+
org_id : str
|
|
160
|
+
|
|
161
|
+
workspace_id : str
|
|
162
|
+
|
|
163
|
+
request : typing.Sequence[InviteRequest]
|
|
164
|
+
|
|
165
|
+
request_options : typing.Optional[RequestOptions]
|
|
166
|
+
Request-specific configuration.
|
|
167
|
+
|
|
168
|
+
Returns
|
|
169
|
+
-------
|
|
170
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
171
|
+
Successful Response
|
|
172
|
+
"""
|
|
173
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
174
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite",
|
|
175
|
+
method="POST",
|
|
176
|
+
json=convert_and_respect_annotation_metadata(
|
|
177
|
+
object_=request,
|
|
178
|
+
annotation=typing.Sequence[InviteRequest],
|
|
179
|
+
direction="write",
|
|
180
|
+
),
|
|
181
|
+
headers={
|
|
182
|
+
"content-type": "application/json",
|
|
183
|
+
},
|
|
184
|
+
request_options=request_options,
|
|
185
|
+
omit=OMIT,
|
|
186
|
+
)
|
|
187
|
+
try:
|
|
188
|
+
if _response is None or not _response.text.strip():
|
|
189
|
+
return HttpResponse(response=_response, data=None)
|
|
190
|
+
if 200 <= _response.status_code < 300:
|
|
191
|
+
_data = typing.cast(
|
|
192
|
+
typing.Optional[typing.Any],
|
|
193
|
+
parse_obj_as(
|
|
194
|
+
type_=typing.Optional[typing.Any], # 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 resend_invitation(
|
|
224
|
+
self,
|
|
225
|
+
org_id: str,
|
|
226
|
+
workspace_id: str,
|
|
227
|
+
*,
|
|
228
|
+
email: str,
|
|
229
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
230
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
231
|
+
"""
|
|
232
|
+
Resend an invitation to a user to an Organization.
|
|
233
|
+
|
|
234
|
+
Raises:
|
|
235
|
+
HTTPException: _description_; status_code: 500
|
|
236
|
+
HTTPException: Invitation not found or has expired; status_code: 400
|
|
237
|
+
HTTPException: You already belong to this organization; status_code: 400
|
|
238
|
+
|
|
239
|
+
Returns:
|
|
240
|
+
JSONResponse: Resent invitation to user; status_code: 200
|
|
241
|
+
|
|
242
|
+
Parameters
|
|
243
|
+
----------
|
|
244
|
+
org_id : str
|
|
245
|
+
|
|
246
|
+
workspace_id : str
|
|
247
|
+
|
|
248
|
+
email : str
|
|
249
|
+
|
|
250
|
+
request_options : typing.Optional[RequestOptions]
|
|
251
|
+
Request-specific configuration.
|
|
252
|
+
|
|
253
|
+
Returns
|
|
254
|
+
-------
|
|
255
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
256
|
+
Successful Response
|
|
257
|
+
"""
|
|
258
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
259
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite/resend",
|
|
260
|
+
method="POST",
|
|
261
|
+
json={
|
|
262
|
+
"email": email,
|
|
263
|
+
},
|
|
264
|
+
headers={
|
|
265
|
+
"content-type": "application/json",
|
|
266
|
+
},
|
|
267
|
+
request_options=request_options,
|
|
268
|
+
omit=OMIT,
|
|
269
|
+
)
|
|
270
|
+
try:
|
|
271
|
+
if _response is None or not _response.text.strip():
|
|
272
|
+
return HttpResponse(response=_response, data=None)
|
|
273
|
+
if 200 <= _response.status_code < 300:
|
|
274
|
+
_data = typing.cast(
|
|
275
|
+
typing.Optional[typing.Any],
|
|
276
|
+
parse_obj_as(
|
|
277
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
278
|
+
object_=_response.json(),
|
|
279
|
+
),
|
|
280
|
+
)
|
|
281
|
+
return HttpResponse(response=_response, data=_data)
|
|
282
|
+
if _response.status_code == 422:
|
|
283
|
+
raise UnprocessableEntityError(
|
|
284
|
+
headers=dict(_response.headers),
|
|
285
|
+
body=typing.cast(
|
|
286
|
+
HttpValidationError,
|
|
287
|
+
parse_obj_as(
|
|
288
|
+
type_=HttpValidationError, # type: ignore
|
|
289
|
+
object_=_response.json(),
|
|
290
|
+
),
|
|
291
|
+
),
|
|
292
|
+
)
|
|
293
|
+
_response_json = _response.json()
|
|
294
|
+
except JSONDecodeError:
|
|
295
|
+
raise ApiError(
|
|
296
|
+
status_code=_response.status_code,
|
|
297
|
+
headers=dict(_response.headers),
|
|
298
|
+
body=_response.text,
|
|
299
|
+
)
|
|
300
|
+
raise ApiError(
|
|
301
|
+
status_code=_response.status_code,
|
|
302
|
+
headers=dict(_response.headers),
|
|
303
|
+
body=_response_json,
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
def accept_invitation(
|
|
307
|
+
self,
|
|
308
|
+
org_id: str,
|
|
309
|
+
workspace_id: str,
|
|
310
|
+
*,
|
|
311
|
+
project_id: str,
|
|
312
|
+
token: str,
|
|
313
|
+
email: str,
|
|
314
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
315
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
316
|
+
"""
|
|
317
|
+
Accept an invitation to an organization.
|
|
318
|
+
|
|
319
|
+
Raises:
|
|
320
|
+
HTTPException: _description_; status_code: 500
|
|
321
|
+
HTTPException: Invitation not found or has expired; status_code: 400
|
|
322
|
+
HTTPException: You already belong to this organization; status_code: 400
|
|
323
|
+
|
|
324
|
+
Returns:
|
|
325
|
+
JSONResponse: Accepted invitation to workspace; status_code: 200
|
|
326
|
+
|
|
327
|
+
Parameters
|
|
328
|
+
----------
|
|
329
|
+
org_id : str
|
|
330
|
+
|
|
331
|
+
workspace_id : str
|
|
332
|
+
|
|
333
|
+
project_id : str
|
|
334
|
+
|
|
335
|
+
token : str
|
|
336
|
+
|
|
337
|
+
email : str
|
|
338
|
+
|
|
339
|
+
request_options : typing.Optional[RequestOptions]
|
|
340
|
+
Request-specific configuration.
|
|
341
|
+
|
|
342
|
+
Returns
|
|
343
|
+
-------
|
|
344
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
345
|
+
Successful Response
|
|
346
|
+
"""
|
|
347
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
348
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite/accept",
|
|
349
|
+
method="POST",
|
|
350
|
+
params={
|
|
351
|
+
"project_id": project_id,
|
|
352
|
+
},
|
|
353
|
+
json={
|
|
354
|
+
"token": token,
|
|
355
|
+
"email": email,
|
|
356
|
+
},
|
|
357
|
+
headers={
|
|
358
|
+
"content-type": "application/json",
|
|
359
|
+
},
|
|
360
|
+
request_options=request_options,
|
|
361
|
+
omit=OMIT,
|
|
362
|
+
)
|
|
363
|
+
try:
|
|
364
|
+
if _response is None or not _response.text.strip():
|
|
365
|
+
return HttpResponse(response=_response, data=None)
|
|
366
|
+
if 200 <= _response.status_code < 300:
|
|
367
|
+
_data = typing.cast(
|
|
368
|
+
typing.Optional[typing.Any],
|
|
369
|
+
parse_obj_as(
|
|
370
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
371
|
+
object_=_response.json(),
|
|
372
|
+
),
|
|
373
|
+
)
|
|
374
|
+
return HttpResponse(response=_response, data=_data)
|
|
375
|
+
if _response.status_code == 422:
|
|
376
|
+
raise UnprocessableEntityError(
|
|
377
|
+
headers=dict(_response.headers),
|
|
378
|
+
body=typing.cast(
|
|
379
|
+
HttpValidationError,
|
|
380
|
+
parse_obj_as(
|
|
381
|
+
type_=HttpValidationError, # type: ignore
|
|
382
|
+
object_=_response.json(),
|
|
383
|
+
),
|
|
384
|
+
),
|
|
385
|
+
)
|
|
386
|
+
_response_json = _response.json()
|
|
387
|
+
except JSONDecodeError:
|
|
388
|
+
raise ApiError(
|
|
389
|
+
status_code=_response.status_code,
|
|
390
|
+
headers=dict(_response.headers),
|
|
391
|
+
body=_response.text,
|
|
392
|
+
)
|
|
393
|
+
raise ApiError(
|
|
394
|
+
status_code=_response.status_code,
|
|
395
|
+
headers=dict(_response.headers),
|
|
396
|
+
body=_response_json,
|
|
397
|
+
)
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
class AsyncRawOrganizationClient:
|
|
401
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
402
|
+
self._client_wrapper = client_wrapper
|
|
403
|
+
|
|
404
|
+
async def fetch_organization_details(
|
|
405
|
+
self, org_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
406
|
+
) -> AsyncHttpResponse[OrganizationDetails]:
|
|
407
|
+
"""
|
|
408
|
+
Return the details of the organization.
|
|
409
|
+
|
|
410
|
+
Parameters
|
|
411
|
+
----------
|
|
412
|
+
org_id : str
|
|
413
|
+
|
|
414
|
+
request_options : typing.Optional[RequestOptions]
|
|
415
|
+
Request-specific configuration.
|
|
416
|
+
|
|
417
|
+
Returns
|
|
418
|
+
-------
|
|
419
|
+
AsyncHttpResponse[OrganizationDetails]
|
|
420
|
+
Successful Response
|
|
421
|
+
"""
|
|
422
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
423
|
+
f"organizations/{jsonable_encoder(org_id)}",
|
|
424
|
+
method="GET",
|
|
425
|
+
request_options=request_options,
|
|
426
|
+
)
|
|
427
|
+
try:
|
|
428
|
+
if 200 <= _response.status_code < 300:
|
|
429
|
+
_data = typing.cast(
|
|
430
|
+
OrganizationDetails,
|
|
431
|
+
parse_obj_as(
|
|
432
|
+
type_=OrganizationDetails, # type: ignore
|
|
433
|
+
object_=_response.json(),
|
|
434
|
+
),
|
|
435
|
+
)
|
|
436
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
437
|
+
if _response.status_code == 422:
|
|
438
|
+
raise UnprocessableEntityError(
|
|
439
|
+
headers=dict(_response.headers),
|
|
440
|
+
body=typing.cast(
|
|
441
|
+
HttpValidationError,
|
|
442
|
+
parse_obj_as(
|
|
443
|
+
type_=HttpValidationError, # type: ignore
|
|
444
|
+
object_=_response.json(),
|
|
445
|
+
),
|
|
446
|
+
),
|
|
447
|
+
)
|
|
448
|
+
_response_json = _response.json()
|
|
449
|
+
except JSONDecodeError:
|
|
450
|
+
raise ApiError(
|
|
451
|
+
status_code=_response.status_code,
|
|
452
|
+
headers=dict(_response.headers),
|
|
453
|
+
body=_response.text,
|
|
454
|
+
)
|
|
455
|
+
raise ApiError(
|
|
456
|
+
status_code=_response.status_code,
|
|
457
|
+
headers=dict(_response.headers),
|
|
458
|
+
body=_response_json,
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
async def list_organizations(
|
|
462
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
463
|
+
) -> AsyncHttpResponse[typing.List[Organization]]:
|
|
464
|
+
"""
|
|
465
|
+
Returns a list of organizations associated with the user's session.
|
|
466
|
+
|
|
467
|
+
Returns:
|
|
468
|
+
list[Organization]: A list of organizations associated with the user's session.
|
|
469
|
+
|
|
470
|
+
Raises:
|
|
471
|
+
HTTPException: If there is an error retrieving the organizations from the database.
|
|
472
|
+
|
|
473
|
+
Parameters
|
|
474
|
+
----------
|
|
475
|
+
request_options : typing.Optional[RequestOptions]
|
|
476
|
+
Request-specific configuration.
|
|
477
|
+
|
|
478
|
+
Returns
|
|
479
|
+
-------
|
|
480
|
+
AsyncHttpResponse[typing.List[Organization]]
|
|
481
|
+
Successful Response
|
|
482
|
+
"""
|
|
483
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
484
|
+
"organizations",
|
|
485
|
+
method="GET",
|
|
486
|
+
request_options=request_options,
|
|
487
|
+
)
|
|
488
|
+
try:
|
|
489
|
+
if 200 <= _response.status_code < 300:
|
|
490
|
+
_data = typing.cast(
|
|
491
|
+
typing.List[Organization],
|
|
492
|
+
parse_obj_as(
|
|
493
|
+
type_=typing.List[Organization], # type: ignore
|
|
494
|
+
object_=_response.json(),
|
|
495
|
+
),
|
|
496
|
+
)
|
|
497
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
498
|
+
_response_json = _response.json()
|
|
499
|
+
except JSONDecodeError:
|
|
500
|
+
raise ApiError(
|
|
501
|
+
status_code=_response.status_code,
|
|
502
|
+
headers=dict(_response.headers),
|
|
503
|
+
body=_response.text,
|
|
504
|
+
)
|
|
505
|
+
raise ApiError(
|
|
506
|
+
status_code=_response.status_code,
|
|
507
|
+
headers=dict(_response.headers),
|
|
508
|
+
body=_response_json,
|
|
509
|
+
)
|
|
510
|
+
|
|
511
|
+
async def invite_user_to_workspace(
|
|
512
|
+
self,
|
|
513
|
+
org_id: str,
|
|
514
|
+
workspace_id: str,
|
|
515
|
+
*,
|
|
516
|
+
request: typing.Sequence[InviteRequest],
|
|
517
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
518
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
519
|
+
"""
|
|
520
|
+
Assigns a role to a user in an organization.
|
|
521
|
+
|
|
522
|
+
Args:
|
|
523
|
+
org_id (str): The ID of the organization.
|
|
524
|
+
payload (InviteRequest): The payload containing the organization id, user email, and role to assign.
|
|
525
|
+
workspace_id (str): The ID of the workspace.
|
|
526
|
+
|
|
527
|
+
Returns:
|
|
528
|
+
bool: True if the role was successfully assigned, False otherwise.
|
|
529
|
+
|
|
530
|
+
Raises:
|
|
531
|
+
HTTPException: If the user does not have permission to perform this action.
|
|
532
|
+
HTTPException: If there is an error assigning the role to the user.
|
|
533
|
+
|
|
534
|
+
Parameters
|
|
535
|
+
----------
|
|
536
|
+
org_id : str
|
|
537
|
+
|
|
538
|
+
workspace_id : str
|
|
539
|
+
|
|
540
|
+
request : typing.Sequence[InviteRequest]
|
|
541
|
+
|
|
542
|
+
request_options : typing.Optional[RequestOptions]
|
|
543
|
+
Request-specific configuration.
|
|
544
|
+
|
|
545
|
+
Returns
|
|
546
|
+
-------
|
|
547
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
548
|
+
Successful Response
|
|
549
|
+
"""
|
|
550
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
551
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite",
|
|
552
|
+
method="POST",
|
|
553
|
+
json=convert_and_respect_annotation_metadata(
|
|
554
|
+
object_=request,
|
|
555
|
+
annotation=typing.Sequence[InviteRequest],
|
|
556
|
+
direction="write",
|
|
557
|
+
),
|
|
558
|
+
headers={
|
|
559
|
+
"content-type": "application/json",
|
|
560
|
+
},
|
|
561
|
+
request_options=request_options,
|
|
562
|
+
omit=OMIT,
|
|
563
|
+
)
|
|
564
|
+
try:
|
|
565
|
+
if _response is None or not _response.text.strip():
|
|
566
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
567
|
+
if 200 <= _response.status_code < 300:
|
|
568
|
+
_data = typing.cast(
|
|
569
|
+
typing.Optional[typing.Any],
|
|
570
|
+
parse_obj_as(
|
|
571
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
572
|
+
object_=_response.json(),
|
|
573
|
+
),
|
|
574
|
+
)
|
|
575
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
576
|
+
if _response.status_code == 422:
|
|
577
|
+
raise UnprocessableEntityError(
|
|
578
|
+
headers=dict(_response.headers),
|
|
579
|
+
body=typing.cast(
|
|
580
|
+
HttpValidationError,
|
|
581
|
+
parse_obj_as(
|
|
582
|
+
type_=HttpValidationError, # type: ignore
|
|
583
|
+
object_=_response.json(),
|
|
584
|
+
),
|
|
585
|
+
),
|
|
586
|
+
)
|
|
587
|
+
_response_json = _response.json()
|
|
588
|
+
except JSONDecodeError:
|
|
589
|
+
raise ApiError(
|
|
590
|
+
status_code=_response.status_code,
|
|
591
|
+
headers=dict(_response.headers),
|
|
592
|
+
body=_response.text,
|
|
593
|
+
)
|
|
594
|
+
raise ApiError(
|
|
595
|
+
status_code=_response.status_code,
|
|
596
|
+
headers=dict(_response.headers),
|
|
597
|
+
body=_response_json,
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
async def resend_invitation(
|
|
601
|
+
self,
|
|
602
|
+
org_id: str,
|
|
603
|
+
workspace_id: str,
|
|
604
|
+
*,
|
|
605
|
+
email: str,
|
|
606
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
607
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
608
|
+
"""
|
|
609
|
+
Resend an invitation to a user to an Organization.
|
|
610
|
+
|
|
611
|
+
Raises:
|
|
612
|
+
HTTPException: _description_; status_code: 500
|
|
613
|
+
HTTPException: Invitation not found or has expired; status_code: 400
|
|
614
|
+
HTTPException: You already belong to this organization; status_code: 400
|
|
615
|
+
|
|
616
|
+
Returns:
|
|
617
|
+
JSONResponse: Resent invitation to user; status_code: 200
|
|
618
|
+
|
|
619
|
+
Parameters
|
|
620
|
+
----------
|
|
621
|
+
org_id : str
|
|
622
|
+
|
|
623
|
+
workspace_id : str
|
|
624
|
+
|
|
625
|
+
email : str
|
|
626
|
+
|
|
627
|
+
request_options : typing.Optional[RequestOptions]
|
|
628
|
+
Request-specific configuration.
|
|
629
|
+
|
|
630
|
+
Returns
|
|
631
|
+
-------
|
|
632
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
633
|
+
Successful Response
|
|
634
|
+
"""
|
|
635
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
636
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite/resend",
|
|
637
|
+
method="POST",
|
|
638
|
+
json={
|
|
639
|
+
"email": email,
|
|
640
|
+
},
|
|
641
|
+
headers={
|
|
642
|
+
"content-type": "application/json",
|
|
643
|
+
},
|
|
644
|
+
request_options=request_options,
|
|
645
|
+
omit=OMIT,
|
|
646
|
+
)
|
|
647
|
+
try:
|
|
648
|
+
if _response is None or not _response.text.strip():
|
|
649
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
650
|
+
if 200 <= _response.status_code < 300:
|
|
651
|
+
_data = typing.cast(
|
|
652
|
+
typing.Optional[typing.Any],
|
|
653
|
+
parse_obj_as(
|
|
654
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
655
|
+
object_=_response.json(),
|
|
656
|
+
),
|
|
657
|
+
)
|
|
658
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
659
|
+
if _response.status_code == 422:
|
|
660
|
+
raise UnprocessableEntityError(
|
|
661
|
+
headers=dict(_response.headers),
|
|
662
|
+
body=typing.cast(
|
|
663
|
+
HttpValidationError,
|
|
664
|
+
parse_obj_as(
|
|
665
|
+
type_=HttpValidationError, # type: ignore
|
|
666
|
+
object_=_response.json(),
|
|
667
|
+
),
|
|
668
|
+
),
|
|
669
|
+
)
|
|
670
|
+
_response_json = _response.json()
|
|
671
|
+
except JSONDecodeError:
|
|
672
|
+
raise ApiError(
|
|
673
|
+
status_code=_response.status_code,
|
|
674
|
+
headers=dict(_response.headers),
|
|
675
|
+
body=_response.text,
|
|
676
|
+
)
|
|
677
|
+
raise ApiError(
|
|
678
|
+
status_code=_response.status_code,
|
|
679
|
+
headers=dict(_response.headers),
|
|
680
|
+
body=_response_json,
|
|
681
|
+
)
|
|
682
|
+
|
|
683
|
+
async def accept_invitation(
|
|
684
|
+
self,
|
|
685
|
+
org_id: str,
|
|
686
|
+
workspace_id: str,
|
|
687
|
+
*,
|
|
688
|
+
project_id: str,
|
|
689
|
+
token: str,
|
|
690
|
+
email: str,
|
|
691
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
692
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
693
|
+
"""
|
|
694
|
+
Accept an invitation to an organization.
|
|
695
|
+
|
|
696
|
+
Raises:
|
|
697
|
+
HTTPException: _description_; status_code: 500
|
|
698
|
+
HTTPException: Invitation not found or has expired; status_code: 400
|
|
699
|
+
HTTPException: You already belong to this organization; status_code: 400
|
|
700
|
+
|
|
701
|
+
Returns:
|
|
702
|
+
JSONResponse: Accepted invitation to workspace; status_code: 200
|
|
703
|
+
|
|
704
|
+
Parameters
|
|
705
|
+
----------
|
|
706
|
+
org_id : str
|
|
707
|
+
|
|
708
|
+
workspace_id : str
|
|
709
|
+
|
|
710
|
+
project_id : str
|
|
711
|
+
|
|
712
|
+
token : str
|
|
713
|
+
|
|
714
|
+
email : str
|
|
715
|
+
|
|
716
|
+
request_options : typing.Optional[RequestOptions]
|
|
717
|
+
Request-specific configuration.
|
|
718
|
+
|
|
719
|
+
Returns
|
|
720
|
+
-------
|
|
721
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
722
|
+
Successful Response
|
|
723
|
+
"""
|
|
724
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
725
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite/accept",
|
|
726
|
+
method="POST",
|
|
727
|
+
params={
|
|
728
|
+
"project_id": project_id,
|
|
729
|
+
},
|
|
730
|
+
json={
|
|
731
|
+
"token": token,
|
|
732
|
+
"email": email,
|
|
733
|
+
},
|
|
734
|
+
headers={
|
|
735
|
+
"content-type": "application/json",
|
|
736
|
+
},
|
|
737
|
+
request_options=request_options,
|
|
738
|
+
omit=OMIT,
|
|
739
|
+
)
|
|
740
|
+
try:
|
|
741
|
+
if _response is None or not _response.text.strip():
|
|
742
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
743
|
+
if 200 <= _response.status_code < 300:
|
|
744
|
+
_data = typing.cast(
|
|
745
|
+
typing.Optional[typing.Any],
|
|
746
|
+
parse_obj_as(
|
|
747
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
748
|
+
object_=_response.json(),
|
|
749
|
+
),
|
|
750
|
+
)
|
|
751
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
752
|
+
if _response.status_code == 422:
|
|
753
|
+
raise UnprocessableEntityError(
|
|
754
|
+
headers=dict(_response.headers),
|
|
755
|
+
body=typing.cast(
|
|
756
|
+
HttpValidationError,
|
|
757
|
+
parse_obj_as(
|
|
758
|
+
type_=HttpValidationError, # type: ignore
|
|
759
|
+
object_=_response.json(),
|
|
760
|
+
),
|
|
761
|
+
),
|
|
762
|
+
)
|
|
763
|
+
_response_json = _response.json()
|
|
764
|
+
except JSONDecodeError:
|
|
765
|
+
raise ApiError(
|
|
766
|
+
status_code=_response.status_code,
|
|
767
|
+
headers=dict(_response.headers),
|
|
768
|
+
body=_response.text,
|
|
769
|
+
)
|
|
770
|
+
raise ApiError(
|
|
771
|
+
status_code=_response.status_code,
|
|
772
|
+
headers=dict(_response.headers),
|
|
773
|
+
body=_response_json,
|
|
774
|
+
)
|