agenta 0.48.9__py3-none-any.whl → 0.49.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of 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/litellm/mocks/__init__.py +144 -0
- agenta/sdk/middleware/auth.py +26 -25
- agenta/sdk/types.py +28 -1
- {agenta-0.48.9.dist-info → agenta-0.49.0.dist-info}/METADATA +1 -1
- agenta-0.49.0.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.49.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,1516 @@
|
|
|
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 ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
13
|
+
from ..types.app import App
|
|
14
|
+
from ..types.app_variant_response import AppVariantResponse
|
|
15
|
+
from ..types.create_app_output import CreateAppOutput
|
|
16
|
+
from ..types.environment_output import EnvironmentOutput
|
|
17
|
+
from ..types.environment_output_extended import EnvironmentOutputExtended
|
|
18
|
+
from ..types.http_validation_error import HttpValidationError
|
|
19
|
+
from ..types.update_app_output import UpdateAppOutput
|
|
20
|
+
|
|
21
|
+
# this is used as the default value for optional parameters
|
|
22
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class RawAppsClient:
|
|
26
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
27
|
+
self._client_wrapper = client_wrapper
|
|
28
|
+
|
|
29
|
+
def list_app_variants(
|
|
30
|
+
self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
31
|
+
) -> HttpResponse[typing.List[AppVariantResponse]]:
|
|
32
|
+
"""
|
|
33
|
+
Retrieve a list of app variants for a given app ID.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
app_id (str): The ID of the app to retrieve variants for.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
List[AppVariantResponse]: A list of app variants for the given app ID.
|
|
40
|
+
|
|
41
|
+
Parameters
|
|
42
|
+
----------
|
|
43
|
+
app_id : str
|
|
44
|
+
|
|
45
|
+
request_options : typing.Optional[RequestOptions]
|
|
46
|
+
Request-specific configuration.
|
|
47
|
+
|
|
48
|
+
Returns
|
|
49
|
+
-------
|
|
50
|
+
HttpResponse[typing.List[AppVariantResponse]]
|
|
51
|
+
Successful Response
|
|
52
|
+
"""
|
|
53
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
54
|
+
f"apps/{jsonable_encoder(app_id)}/variants",
|
|
55
|
+
method="GET",
|
|
56
|
+
request_options=request_options,
|
|
57
|
+
)
|
|
58
|
+
try:
|
|
59
|
+
if 200 <= _response.status_code < 300:
|
|
60
|
+
_data = typing.cast(
|
|
61
|
+
typing.List[AppVariantResponse],
|
|
62
|
+
parse_obj_as(
|
|
63
|
+
type_=typing.List[AppVariantResponse], # type: ignore
|
|
64
|
+
object_=_response.json(),
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
return HttpResponse(response=_response, data=_data)
|
|
68
|
+
if _response.status_code == 422:
|
|
69
|
+
raise UnprocessableEntityError(
|
|
70
|
+
headers=dict(_response.headers),
|
|
71
|
+
body=typing.cast(
|
|
72
|
+
HttpValidationError,
|
|
73
|
+
parse_obj_as(
|
|
74
|
+
type_=HttpValidationError, # type: ignore
|
|
75
|
+
object_=_response.json(),
|
|
76
|
+
),
|
|
77
|
+
),
|
|
78
|
+
)
|
|
79
|
+
_response_json = _response.json()
|
|
80
|
+
except JSONDecodeError:
|
|
81
|
+
raise ApiError(
|
|
82
|
+
status_code=_response.status_code,
|
|
83
|
+
headers=dict(_response.headers),
|
|
84
|
+
body=_response.text,
|
|
85
|
+
)
|
|
86
|
+
raise ApiError(
|
|
87
|
+
status_code=_response.status_code,
|
|
88
|
+
headers=dict(_response.headers),
|
|
89
|
+
body=_response_json,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
def get_variant_by_env(
|
|
93
|
+
self,
|
|
94
|
+
*,
|
|
95
|
+
app_id: str,
|
|
96
|
+
environment: str,
|
|
97
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
98
|
+
) -> HttpResponse[AppVariantResponse]:
|
|
99
|
+
"""
|
|
100
|
+
Retrieve the app variant based on the provided app_id and environment.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
app_id (str): The ID of the app to retrieve the variant for.
|
|
104
|
+
environment (str): The environment of the app variant to retrieve.
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
HTTPException: If the app variant is not found (status_code=500), or if a ValueError is raised (status_code=400), or if any other exception is raised (status_code=500).
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
AppVariantResponse: The retrieved app variant.
|
|
111
|
+
|
|
112
|
+
Parameters
|
|
113
|
+
----------
|
|
114
|
+
app_id : str
|
|
115
|
+
|
|
116
|
+
environment : str
|
|
117
|
+
|
|
118
|
+
request_options : typing.Optional[RequestOptions]
|
|
119
|
+
Request-specific configuration.
|
|
120
|
+
|
|
121
|
+
Returns
|
|
122
|
+
-------
|
|
123
|
+
HttpResponse[AppVariantResponse]
|
|
124
|
+
Successful Response
|
|
125
|
+
"""
|
|
126
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
127
|
+
"apps/get_variant_by_env",
|
|
128
|
+
method="GET",
|
|
129
|
+
params={
|
|
130
|
+
"app_id": app_id,
|
|
131
|
+
"environment": environment,
|
|
132
|
+
},
|
|
133
|
+
request_options=request_options,
|
|
134
|
+
)
|
|
135
|
+
try:
|
|
136
|
+
if 200 <= _response.status_code < 300:
|
|
137
|
+
_data = typing.cast(
|
|
138
|
+
AppVariantResponse,
|
|
139
|
+
parse_obj_as(
|
|
140
|
+
type_=AppVariantResponse, # type: ignore
|
|
141
|
+
object_=_response.json(),
|
|
142
|
+
),
|
|
143
|
+
)
|
|
144
|
+
return HttpResponse(response=_response, data=_data)
|
|
145
|
+
if _response.status_code == 422:
|
|
146
|
+
raise UnprocessableEntityError(
|
|
147
|
+
headers=dict(_response.headers),
|
|
148
|
+
body=typing.cast(
|
|
149
|
+
HttpValidationError,
|
|
150
|
+
parse_obj_as(
|
|
151
|
+
type_=HttpValidationError, # type: ignore
|
|
152
|
+
object_=_response.json(),
|
|
153
|
+
),
|
|
154
|
+
),
|
|
155
|
+
)
|
|
156
|
+
_response_json = _response.json()
|
|
157
|
+
except JSONDecodeError:
|
|
158
|
+
raise ApiError(
|
|
159
|
+
status_code=_response.status_code,
|
|
160
|
+
headers=dict(_response.headers),
|
|
161
|
+
body=_response.text,
|
|
162
|
+
)
|
|
163
|
+
raise ApiError(
|
|
164
|
+
status_code=_response.status_code,
|
|
165
|
+
headers=dict(_response.headers),
|
|
166
|
+
body=_response_json,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
def list_apps(
|
|
170
|
+
self,
|
|
171
|
+
*,
|
|
172
|
+
app_name: typing.Optional[str] = None,
|
|
173
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
174
|
+
) -> HttpResponse[typing.List[App]]:
|
|
175
|
+
"""
|
|
176
|
+
Retrieve a list of apps filtered by app_name.
|
|
177
|
+
|
|
178
|
+
Args:
|
|
179
|
+
app_name (Optional[str]): The name of the app to filter by.
|
|
180
|
+
|
|
181
|
+
Returns:
|
|
182
|
+
List[App]: A list of apps filtered by app_name.
|
|
183
|
+
|
|
184
|
+
Raises:
|
|
185
|
+
HTTPException: If there was an error retrieving the list of apps.
|
|
186
|
+
|
|
187
|
+
Parameters
|
|
188
|
+
----------
|
|
189
|
+
app_name : typing.Optional[str]
|
|
190
|
+
|
|
191
|
+
request_options : typing.Optional[RequestOptions]
|
|
192
|
+
Request-specific configuration.
|
|
193
|
+
|
|
194
|
+
Returns
|
|
195
|
+
-------
|
|
196
|
+
HttpResponse[typing.List[App]]
|
|
197
|
+
Successful Response
|
|
198
|
+
"""
|
|
199
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
200
|
+
"apps",
|
|
201
|
+
method="GET",
|
|
202
|
+
params={
|
|
203
|
+
"app_name": app_name,
|
|
204
|
+
},
|
|
205
|
+
request_options=request_options,
|
|
206
|
+
)
|
|
207
|
+
try:
|
|
208
|
+
if 200 <= _response.status_code < 300:
|
|
209
|
+
_data = typing.cast(
|
|
210
|
+
typing.List[App],
|
|
211
|
+
parse_obj_as(
|
|
212
|
+
type_=typing.List[App], # type: ignore
|
|
213
|
+
object_=_response.json(),
|
|
214
|
+
),
|
|
215
|
+
)
|
|
216
|
+
return HttpResponse(response=_response, data=_data)
|
|
217
|
+
if _response.status_code == 422:
|
|
218
|
+
raise UnprocessableEntityError(
|
|
219
|
+
headers=dict(_response.headers),
|
|
220
|
+
body=typing.cast(
|
|
221
|
+
HttpValidationError,
|
|
222
|
+
parse_obj_as(
|
|
223
|
+
type_=HttpValidationError, # type: ignore
|
|
224
|
+
object_=_response.json(),
|
|
225
|
+
),
|
|
226
|
+
),
|
|
227
|
+
)
|
|
228
|
+
_response_json = _response.json()
|
|
229
|
+
except JSONDecodeError:
|
|
230
|
+
raise ApiError(
|
|
231
|
+
status_code=_response.status_code,
|
|
232
|
+
headers=dict(_response.headers),
|
|
233
|
+
body=_response.text,
|
|
234
|
+
)
|
|
235
|
+
raise ApiError(
|
|
236
|
+
status_code=_response.status_code,
|
|
237
|
+
headers=dict(_response.headers),
|
|
238
|
+
body=_response_json,
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
def create_app(
|
|
242
|
+
self,
|
|
243
|
+
*,
|
|
244
|
+
app_name: str,
|
|
245
|
+
template_key: typing.Optional[str] = OMIT,
|
|
246
|
+
project_id: typing.Optional[str] = OMIT,
|
|
247
|
+
workspace_id: typing.Optional[str] = OMIT,
|
|
248
|
+
organization_id: typing.Optional[str] = OMIT,
|
|
249
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
250
|
+
) -> HttpResponse[CreateAppOutput]:
|
|
251
|
+
"""
|
|
252
|
+
Create a new app for a user or organization.
|
|
253
|
+
|
|
254
|
+
Args:
|
|
255
|
+
payload (CreateApp): The payload containing the app name and organization ID (optional).
|
|
256
|
+
|
|
257
|
+
Returns:
|
|
258
|
+
CreateAppOutput: The output containing the newly created app's ID and name.
|
|
259
|
+
|
|
260
|
+
Raises:
|
|
261
|
+
HTTPException: If there is an error creating the app or the user does not have permission to access the app.
|
|
262
|
+
|
|
263
|
+
Parameters
|
|
264
|
+
----------
|
|
265
|
+
app_name : str
|
|
266
|
+
|
|
267
|
+
template_key : typing.Optional[str]
|
|
268
|
+
|
|
269
|
+
project_id : typing.Optional[str]
|
|
270
|
+
|
|
271
|
+
workspace_id : typing.Optional[str]
|
|
272
|
+
|
|
273
|
+
organization_id : typing.Optional[str]
|
|
274
|
+
|
|
275
|
+
request_options : typing.Optional[RequestOptions]
|
|
276
|
+
Request-specific configuration.
|
|
277
|
+
|
|
278
|
+
Returns
|
|
279
|
+
-------
|
|
280
|
+
HttpResponse[CreateAppOutput]
|
|
281
|
+
Successful Response
|
|
282
|
+
"""
|
|
283
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
284
|
+
"apps",
|
|
285
|
+
method="POST",
|
|
286
|
+
json={
|
|
287
|
+
"app_name": app_name,
|
|
288
|
+
"template_key": template_key,
|
|
289
|
+
"project_id": project_id,
|
|
290
|
+
"workspace_id": workspace_id,
|
|
291
|
+
"organization_id": organization_id,
|
|
292
|
+
},
|
|
293
|
+
headers={
|
|
294
|
+
"content-type": "application/json",
|
|
295
|
+
},
|
|
296
|
+
request_options=request_options,
|
|
297
|
+
omit=OMIT,
|
|
298
|
+
)
|
|
299
|
+
try:
|
|
300
|
+
if 200 <= _response.status_code < 300:
|
|
301
|
+
_data = typing.cast(
|
|
302
|
+
CreateAppOutput,
|
|
303
|
+
parse_obj_as(
|
|
304
|
+
type_=CreateAppOutput, # type: ignore
|
|
305
|
+
object_=_response.json(),
|
|
306
|
+
),
|
|
307
|
+
)
|
|
308
|
+
return HttpResponse(response=_response, data=_data)
|
|
309
|
+
if _response.status_code == 422:
|
|
310
|
+
raise UnprocessableEntityError(
|
|
311
|
+
headers=dict(_response.headers),
|
|
312
|
+
body=typing.cast(
|
|
313
|
+
HttpValidationError,
|
|
314
|
+
parse_obj_as(
|
|
315
|
+
type_=HttpValidationError, # type: ignore
|
|
316
|
+
object_=_response.json(),
|
|
317
|
+
),
|
|
318
|
+
),
|
|
319
|
+
)
|
|
320
|
+
_response_json = _response.json()
|
|
321
|
+
except JSONDecodeError:
|
|
322
|
+
raise ApiError(
|
|
323
|
+
status_code=_response.status_code,
|
|
324
|
+
headers=dict(_response.headers),
|
|
325
|
+
body=_response.text,
|
|
326
|
+
)
|
|
327
|
+
raise ApiError(
|
|
328
|
+
status_code=_response.status_code,
|
|
329
|
+
headers=dict(_response.headers),
|
|
330
|
+
body=_response_json,
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
def remove_app(
|
|
334
|
+
self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
335
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
336
|
+
"""
|
|
337
|
+
Remove app, all its variant.
|
|
338
|
+
|
|
339
|
+
Arguments:
|
|
340
|
+
app -- App to remove
|
|
341
|
+
|
|
342
|
+
Parameters
|
|
343
|
+
----------
|
|
344
|
+
app_id : str
|
|
345
|
+
|
|
346
|
+
request_options : typing.Optional[RequestOptions]
|
|
347
|
+
Request-specific configuration.
|
|
348
|
+
|
|
349
|
+
Returns
|
|
350
|
+
-------
|
|
351
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
352
|
+
Successful Response
|
|
353
|
+
"""
|
|
354
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
355
|
+
f"apps/{jsonable_encoder(app_id)}",
|
|
356
|
+
method="DELETE",
|
|
357
|
+
request_options=request_options,
|
|
358
|
+
)
|
|
359
|
+
try:
|
|
360
|
+
if _response is None or not _response.text.strip():
|
|
361
|
+
return HttpResponse(response=_response, data=None)
|
|
362
|
+
if 200 <= _response.status_code < 300:
|
|
363
|
+
_data = typing.cast(
|
|
364
|
+
typing.Optional[typing.Any],
|
|
365
|
+
parse_obj_as(
|
|
366
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
367
|
+
object_=_response.json(),
|
|
368
|
+
),
|
|
369
|
+
)
|
|
370
|
+
return HttpResponse(response=_response, data=_data)
|
|
371
|
+
if _response.status_code == 422:
|
|
372
|
+
raise UnprocessableEntityError(
|
|
373
|
+
headers=dict(_response.headers),
|
|
374
|
+
body=typing.cast(
|
|
375
|
+
HttpValidationError,
|
|
376
|
+
parse_obj_as(
|
|
377
|
+
type_=HttpValidationError, # type: ignore
|
|
378
|
+
object_=_response.json(),
|
|
379
|
+
),
|
|
380
|
+
),
|
|
381
|
+
)
|
|
382
|
+
_response_json = _response.json()
|
|
383
|
+
except JSONDecodeError:
|
|
384
|
+
raise ApiError(
|
|
385
|
+
status_code=_response.status_code,
|
|
386
|
+
headers=dict(_response.headers),
|
|
387
|
+
body=_response.text,
|
|
388
|
+
)
|
|
389
|
+
raise ApiError(
|
|
390
|
+
status_code=_response.status_code,
|
|
391
|
+
headers=dict(_response.headers),
|
|
392
|
+
body=_response_json,
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
def update_app(
|
|
396
|
+
self,
|
|
397
|
+
app_id: str,
|
|
398
|
+
*,
|
|
399
|
+
app_name: str,
|
|
400
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
401
|
+
) -> HttpResponse[UpdateAppOutput]:
|
|
402
|
+
"""
|
|
403
|
+
Update an app for a user or organization.
|
|
404
|
+
|
|
405
|
+
Args:
|
|
406
|
+
app_id (str): The ID of the app.
|
|
407
|
+
payload (UpdateApp): The payload containing the app name.
|
|
408
|
+
|
|
409
|
+
Returns:
|
|
410
|
+
UpdateAppOutput: The output containing the newly created app's ID and name.
|
|
411
|
+
|
|
412
|
+
Raises:
|
|
413
|
+
HTTPException: If there is an error creating the app or the user does not have permission to access the app.
|
|
414
|
+
|
|
415
|
+
Parameters
|
|
416
|
+
----------
|
|
417
|
+
app_id : str
|
|
418
|
+
|
|
419
|
+
app_name : str
|
|
420
|
+
|
|
421
|
+
request_options : typing.Optional[RequestOptions]
|
|
422
|
+
Request-specific configuration.
|
|
423
|
+
|
|
424
|
+
Returns
|
|
425
|
+
-------
|
|
426
|
+
HttpResponse[UpdateAppOutput]
|
|
427
|
+
Successful Response
|
|
428
|
+
"""
|
|
429
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
430
|
+
f"apps/{jsonable_encoder(app_id)}",
|
|
431
|
+
method="PATCH",
|
|
432
|
+
json={
|
|
433
|
+
"app_name": app_name,
|
|
434
|
+
},
|
|
435
|
+
headers={
|
|
436
|
+
"content-type": "application/json",
|
|
437
|
+
},
|
|
438
|
+
request_options=request_options,
|
|
439
|
+
omit=OMIT,
|
|
440
|
+
)
|
|
441
|
+
try:
|
|
442
|
+
if 200 <= _response.status_code < 300:
|
|
443
|
+
_data = typing.cast(
|
|
444
|
+
UpdateAppOutput,
|
|
445
|
+
parse_obj_as(
|
|
446
|
+
type_=UpdateAppOutput, # type: ignore
|
|
447
|
+
object_=_response.json(),
|
|
448
|
+
),
|
|
449
|
+
)
|
|
450
|
+
return HttpResponse(response=_response, data=_data)
|
|
451
|
+
if _response.status_code == 422:
|
|
452
|
+
raise UnprocessableEntityError(
|
|
453
|
+
headers=dict(_response.headers),
|
|
454
|
+
body=typing.cast(
|
|
455
|
+
HttpValidationError,
|
|
456
|
+
parse_obj_as(
|
|
457
|
+
type_=HttpValidationError, # type: ignore
|
|
458
|
+
object_=_response.json(),
|
|
459
|
+
),
|
|
460
|
+
),
|
|
461
|
+
)
|
|
462
|
+
_response_json = _response.json()
|
|
463
|
+
except JSONDecodeError:
|
|
464
|
+
raise ApiError(
|
|
465
|
+
status_code=_response.status_code,
|
|
466
|
+
headers=dict(_response.headers),
|
|
467
|
+
body=_response.text,
|
|
468
|
+
)
|
|
469
|
+
raise ApiError(
|
|
470
|
+
status_code=_response.status_code,
|
|
471
|
+
headers=dict(_response.headers),
|
|
472
|
+
body=_response_json,
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
def add_variant_from_url(
|
|
476
|
+
self,
|
|
477
|
+
app_id: str,
|
|
478
|
+
*,
|
|
479
|
+
variant_name: str,
|
|
480
|
+
url: str,
|
|
481
|
+
commit_message: typing.Optional[str] = OMIT,
|
|
482
|
+
base_name: typing.Optional[str] = OMIT,
|
|
483
|
+
config_name: typing.Optional[str] = OMIT,
|
|
484
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
485
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
486
|
+
"""
|
|
487
|
+
Parameters
|
|
488
|
+
----------
|
|
489
|
+
app_id : str
|
|
490
|
+
|
|
491
|
+
variant_name : str
|
|
492
|
+
|
|
493
|
+
url : str
|
|
494
|
+
|
|
495
|
+
commit_message : typing.Optional[str]
|
|
496
|
+
|
|
497
|
+
base_name : typing.Optional[str]
|
|
498
|
+
|
|
499
|
+
config_name : typing.Optional[str]
|
|
500
|
+
|
|
501
|
+
request_options : typing.Optional[RequestOptions]
|
|
502
|
+
Request-specific configuration.
|
|
503
|
+
|
|
504
|
+
Returns
|
|
505
|
+
-------
|
|
506
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
507
|
+
Successful Response
|
|
508
|
+
"""
|
|
509
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
510
|
+
f"apps/{jsonable_encoder(app_id)}/variant/from-service",
|
|
511
|
+
method="POST",
|
|
512
|
+
json={
|
|
513
|
+
"variant_name": variant_name,
|
|
514
|
+
"url": url,
|
|
515
|
+
"commit_message": commit_message,
|
|
516
|
+
"base_name": base_name,
|
|
517
|
+
"config_name": config_name,
|
|
518
|
+
},
|
|
519
|
+
headers={
|
|
520
|
+
"content-type": "application/json",
|
|
521
|
+
},
|
|
522
|
+
request_options=request_options,
|
|
523
|
+
omit=OMIT,
|
|
524
|
+
)
|
|
525
|
+
try:
|
|
526
|
+
if _response is None or not _response.text.strip():
|
|
527
|
+
return HttpResponse(response=_response, data=None)
|
|
528
|
+
if 200 <= _response.status_code < 300:
|
|
529
|
+
_data = typing.cast(
|
|
530
|
+
typing.Optional[typing.Any],
|
|
531
|
+
parse_obj_as(
|
|
532
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
533
|
+
object_=_response.json(),
|
|
534
|
+
),
|
|
535
|
+
)
|
|
536
|
+
return HttpResponse(response=_response, data=_data)
|
|
537
|
+
if _response.status_code == 422:
|
|
538
|
+
raise UnprocessableEntityError(
|
|
539
|
+
headers=dict(_response.headers),
|
|
540
|
+
body=typing.cast(
|
|
541
|
+
HttpValidationError,
|
|
542
|
+
parse_obj_as(
|
|
543
|
+
type_=HttpValidationError, # type: ignore
|
|
544
|
+
object_=_response.json(),
|
|
545
|
+
),
|
|
546
|
+
),
|
|
547
|
+
)
|
|
548
|
+
_response_json = _response.json()
|
|
549
|
+
except JSONDecodeError:
|
|
550
|
+
raise ApiError(
|
|
551
|
+
status_code=_response.status_code,
|
|
552
|
+
headers=dict(_response.headers),
|
|
553
|
+
body=_response.text,
|
|
554
|
+
)
|
|
555
|
+
raise ApiError(
|
|
556
|
+
status_code=_response.status_code,
|
|
557
|
+
headers=dict(_response.headers),
|
|
558
|
+
body=_response_json,
|
|
559
|
+
)
|
|
560
|
+
|
|
561
|
+
def add_variant_from_key(
|
|
562
|
+
self,
|
|
563
|
+
app_id: str,
|
|
564
|
+
*,
|
|
565
|
+
variant_name: str,
|
|
566
|
+
key: str,
|
|
567
|
+
commit_message: typing.Optional[str] = OMIT,
|
|
568
|
+
base_name: typing.Optional[str] = OMIT,
|
|
569
|
+
config_name: typing.Optional[str] = OMIT,
|
|
570
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
571
|
+
) -> HttpResponse[typing.Optional[typing.Any]]:
|
|
572
|
+
"""
|
|
573
|
+
Parameters
|
|
574
|
+
----------
|
|
575
|
+
app_id : str
|
|
576
|
+
|
|
577
|
+
variant_name : str
|
|
578
|
+
|
|
579
|
+
key : str
|
|
580
|
+
|
|
581
|
+
commit_message : typing.Optional[str]
|
|
582
|
+
|
|
583
|
+
base_name : typing.Optional[str]
|
|
584
|
+
|
|
585
|
+
config_name : typing.Optional[str]
|
|
586
|
+
|
|
587
|
+
request_options : typing.Optional[RequestOptions]
|
|
588
|
+
Request-specific configuration.
|
|
589
|
+
|
|
590
|
+
Returns
|
|
591
|
+
-------
|
|
592
|
+
HttpResponse[typing.Optional[typing.Any]]
|
|
593
|
+
Successful Response
|
|
594
|
+
"""
|
|
595
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
596
|
+
f"apps/{jsonable_encoder(app_id)}/variant/from-template",
|
|
597
|
+
method="POST",
|
|
598
|
+
json={
|
|
599
|
+
"variant_name": variant_name,
|
|
600
|
+
"key": key,
|
|
601
|
+
"commit_message": commit_message,
|
|
602
|
+
"base_name": base_name,
|
|
603
|
+
"config_name": config_name,
|
|
604
|
+
},
|
|
605
|
+
headers={
|
|
606
|
+
"content-type": "application/json",
|
|
607
|
+
},
|
|
608
|
+
request_options=request_options,
|
|
609
|
+
omit=OMIT,
|
|
610
|
+
)
|
|
611
|
+
try:
|
|
612
|
+
if _response is None or not _response.text.strip():
|
|
613
|
+
return HttpResponse(response=_response, data=None)
|
|
614
|
+
if 200 <= _response.status_code < 300:
|
|
615
|
+
_data = typing.cast(
|
|
616
|
+
typing.Optional[typing.Any],
|
|
617
|
+
parse_obj_as(
|
|
618
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
619
|
+
object_=_response.json(),
|
|
620
|
+
),
|
|
621
|
+
)
|
|
622
|
+
return HttpResponse(response=_response, data=_data)
|
|
623
|
+
if _response.status_code == 422:
|
|
624
|
+
raise UnprocessableEntityError(
|
|
625
|
+
headers=dict(_response.headers),
|
|
626
|
+
body=typing.cast(
|
|
627
|
+
HttpValidationError,
|
|
628
|
+
parse_obj_as(
|
|
629
|
+
type_=HttpValidationError, # type: ignore
|
|
630
|
+
object_=_response.json(),
|
|
631
|
+
),
|
|
632
|
+
),
|
|
633
|
+
)
|
|
634
|
+
_response_json = _response.json()
|
|
635
|
+
except JSONDecodeError:
|
|
636
|
+
raise ApiError(
|
|
637
|
+
status_code=_response.status_code,
|
|
638
|
+
headers=dict(_response.headers),
|
|
639
|
+
body=_response.text,
|
|
640
|
+
)
|
|
641
|
+
raise ApiError(
|
|
642
|
+
status_code=_response.status_code,
|
|
643
|
+
headers=dict(_response.headers),
|
|
644
|
+
body=_response_json,
|
|
645
|
+
)
|
|
646
|
+
|
|
647
|
+
def list_environments(
|
|
648
|
+
self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
649
|
+
) -> HttpResponse[typing.List[EnvironmentOutput]]:
|
|
650
|
+
"""
|
|
651
|
+
Retrieve a list of environments for a given app ID.
|
|
652
|
+
|
|
653
|
+
Args:
|
|
654
|
+
app_id (str): The ID of the app to retrieve environments for.
|
|
655
|
+
|
|
656
|
+
Returns:
|
|
657
|
+
List[EnvironmentOutput]: A list of environment objects.
|
|
658
|
+
|
|
659
|
+
Parameters
|
|
660
|
+
----------
|
|
661
|
+
app_id : str
|
|
662
|
+
|
|
663
|
+
request_options : typing.Optional[RequestOptions]
|
|
664
|
+
Request-specific configuration.
|
|
665
|
+
|
|
666
|
+
Returns
|
|
667
|
+
-------
|
|
668
|
+
HttpResponse[typing.List[EnvironmentOutput]]
|
|
669
|
+
Successful Response
|
|
670
|
+
"""
|
|
671
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
672
|
+
f"apps/{jsonable_encoder(app_id)}/environments",
|
|
673
|
+
method="GET",
|
|
674
|
+
request_options=request_options,
|
|
675
|
+
)
|
|
676
|
+
try:
|
|
677
|
+
if 200 <= _response.status_code < 300:
|
|
678
|
+
_data = typing.cast(
|
|
679
|
+
typing.List[EnvironmentOutput],
|
|
680
|
+
parse_obj_as(
|
|
681
|
+
type_=typing.List[EnvironmentOutput], # type: ignore
|
|
682
|
+
object_=_response.json(),
|
|
683
|
+
),
|
|
684
|
+
)
|
|
685
|
+
return HttpResponse(response=_response, data=_data)
|
|
686
|
+
if _response.status_code == 422:
|
|
687
|
+
raise UnprocessableEntityError(
|
|
688
|
+
headers=dict(_response.headers),
|
|
689
|
+
body=typing.cast(
|
|
690
|
+
HttpValidationError,
|
|
691
|
+
parse_obj_as(
|
|
692
|
+
type_=HttpValidationError, # type: ignore
|
|
693
|
+
object_=_response.json(),
|
|
694
|
+
),
|
|
695
|
+
),
|
|
696
|
+
)
|
|
697
|
+
_response_json = _response.json()
|
|
698
|
+
except JSONDecodeError:
|
|
699
|
+
raise ApiError(
|
|
700
|
+
status_code=_response.status_code,
|
|
701
|
+
headers=dict(_response.headers),
|
|
702
|
+
body=_response.text,
|
|
703
|
+
)
|
|
704
|
+
raise ApiError(
|
|
705
|
+
status_code=_response.status_code,
|
|
706
|
+
headers=dict(_response.headers),
|
|
707
|
+
body=_response_json,
|
|
708
|
+
)
|
|
709
|
+
|
|
710
|
+
def environment_revisions(
|
|
711
|
+
self,
|
|
712
|
+
app_id: str,
|
|
713
|
+
environment_name: typing.Optional[typing.Any],
|
|
714
|
+
*,
|
|
715
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
716
|
+
) -> HttpResponse[EnvironmentOutputExtended]:
|
|
717
|
+
"""
|
|
718
|
+
Parameters
|
|
719
|
+
----------
|
|
720
|
+
app_id : str
|
|
721
|
+
|
|
722
|
+
environment_name : typing.Optional[typing.Any]
|
|
723
|
+
|
|
724
|
+
request_options : typing.Optional[RequestOptions]
|
|
725
|
+
Request-specific configuration.
|
|
726
|
+
|
|
727
|
+
Returns
|
|
728
|
+
-------
|
|
729
|
+
HttpResponse[EnvironmentOutputExtended]
|
|
730
|
+
Successful Response
|
|
731
|
+
"""
|
|
732
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
733
|
+
f"apps/{jsonable_encoder(app_id)}/revisions/{jsonable_encoder(environment_name)}",
|
|
734
|
+
method="GET",
|
|
735
|
+
request_options=request_options,
|
|
736
|
+
)
|
|
737
|
+
try:
|
|
738
|
+
if 200 <= _response.status_code < 300:
|
|
739
|
+
_data = typing.cast(
|
|
740
|
+
EnvironmentOutputExtended,
|
|
741
|
+
parse_obj_as(
|
|
742
|
+
type_=EnvironmentOutputExtended, # type: ignore
|
|
743
|
+
object_=_response.json(),
|
|
744
|
+
),
|
|
745
|
+
)
|
|
746
|
+
return HttpResponse(response=_response, data=_data)
|
|
747
|
+
if _response.status_code == 422:
|
|
748
|
+
raise UnprocessableEntityError(
|
|
749
|
+
headers=dict(_response.headers),
|
|
750
|
+
body=typing.cast(
|
|
751
|
+
HttpValidationError,
|
|
752
|
+
parse_obj_as(
|
|
753
|
+
type_=HttpValidationError, # type: ignore
|
|
754
|
+
object_=_response.json(),
|
|
755
|
+
),
|
|
756
|
+
),
|
|
757
|
+
)
|
|
758
|
+
_response_json = _response.json()
|
|
759
|
+
except JSONDecodeError:
|
|
760
|
+
raise ApiError(
|
|
761
|
+
status_code=_response.status_code,
|
|
762
|
+
headers=dict(_response.headers),
|
|
763
|
+
body=_response.text,
|
|
764
|
+
)
|
|
765
|
+
raise ApiError(
|
|
766
|
+
status_code=_response.status_code,
|
|
767
|
+
headers=dict(_response.headers),
|
|
768
|
+
body=_response_json,
|
|
769
|
+
)
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
class AsyncRawAppsClient:
|
|
773
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
774
|
+
self._client_wrapper = client_wrapper
|
|
775
|
+
|
|
776
|
+
async def list_app_variants(
|
|
777
|
+
self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
778
|
+
) -> AsyncHttpResponse[typing.List[AppVariantResponse]]:
|
|
779
|
+
"""
|
|
780
|
+
Retrieve a list of app variants for a given app ID.
|
|
781
|
+
|
|
782
|
+
Args:
|
|
783
|
+
app_id (str): The ID of the app to retrieve variants for.
|
|
784
|
+
|
|
785
|
+
Returns:
|
|
786
|
+
List[AppVariantResponse]: A list of app variants for the given app ID.
|
|
787
|
+
|
|
788
|
+
Parameters
|
|
789
|
+
----------
|
|
790
|
+
app_id : str
|
|
791
|
+
|
|
792
|
+
request_options : typing.Optional[RequestOptions]
|
|
793
|
+
Request-specific configuration.
|
|
794
|
+
|
|
795
|
+
Returns
|
|
796
|
+
-------
|
|
797
|
+
AsyncHttpResponse[typing.List[AppVariantResponse]]
|
|
798
|
+
Successful Response
|
|
799
|
+
"""
|
|
800
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
801
|
+
f"apps/{jsonable_encoder(app_id)}/variants",
|
|
802
|
+
method="GET",
|
|
803
|
+
request_options=request_options,
|
|
804
|
+
)
|
|
805
|
+
try:
|
|
806
|
+
if 200 <= _response.status_code < 300:
|
|
807
|
+
_data = typing.cast(
|
|
808
|
+
typing.List[AppVariantResponse],
|
|
809
|
+
parse_obj_as(
|
|
810
|
+
type_=typing.List[AppVariantResponse], # type: ignore
|
|
811
|
+
object_=_response.json(),
|
|
812
|
+
),
|
|
813
|
+
)
|
|
814
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
815
|
+
if _response.status_code == 422:
|
|
816
|
+
raise UnprocessableEntityError(
|
|
817
|
+
headers=dict(_response.headers),
|
|
818
|
+
body=typing.cast(
|
|
819
|
+
HttpValidationError,
|
|
820
|
+
parse_obj_as(
|
|
821
|
+
type_=HttpValidationError, # type: ignore
|
|
822
|
+
object_=_response.json(),
|
|
823
|
+
),
|
|
824
|
+
),
|
|
825
|
+
)
|
|
826
|
+
_response_json = _response.json()
|
|
827
|
+
except JSONDecodeError:
|
|
828
|
+
raise ApiError(
|
|
829
|
+
status_code=_response.status_code,
|
|
830
|
+
headers=dict(_response.headers),
|
|
831
|
+
body=_response.text,
|
|
832
|
+
)
|
|
833
|
+
raise ApiError(
|
|
834
|
+
status_code=_response.status_code,
|
|
835
|
+
headers=dict(_response.headers),
|
|
836
|
+
body=_response_json,
|
|
837
|
+
)
|
|
838
|
+
|
|
839
|
+
async def get_variant_by_env(
|
|
840
|
+
self,
|
|
841
|
+
*,
|
|
842
|
+
app_id: str,
|
|
843
|
+
environment: str,
|
|
844
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
845
|
+
) -> AsyncHttpResponse[AppVariantResponse]:
|
|
846
|
+
"""
|
|
847
|
+
Retrieve the app variant based on the provided app_id and environment.
|
|
848
|
+
|
|
849
|
+
Args:
|
|
850
|
+
app_id (str): The ID of the app to retrieve the variant for.
|
|
851
|
+
environment (str): The environment of the app variant to retrieve.
|
|
852
|
+
|
|
853
|
+
Raises:
|
|
854
|
+
HTTPException: If the app variant is not found (status_code=500), or if a ValueError is raised (status_code=400), or if any other exception is raised (status_code=500).
|
|
855
|
+
|
|
856
|
+
Returns:
|
|
857
|
+
AppVariantResponse: The retrieved app variant.
|
|
858
|
+
|
|
859
|
+
Parameters
|
|
860
|
+
----------
|
|
861
|
+
app_id : str
|
|
862
|
+
|
|
863
|
+
environment : str
|
|
864
|
+
|
|
865
|
+
request_options : typing.Optional[RequestOptions]
|
|
866
|
+
Request-specific configuration.
|
|
867
|
+
|
|
868
|
+
Returns
|
|
869
|
+
-------
|
|
870
|
+
AsyncHttpResponse[AppVariantResponse]
|
|
871
|
+
Successful Response
|
|
872
|
+
"""
|
|
873
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
874
|
+
"apps/get_variant_by_env",
|
|
875
|
+
method="GET",
|
|
876
|
+
params={
|
|
877
|
+
"app_id": app_id,
|
|
878
|
+
"environment": environment,
|
|
879
|
+
},
|
|
880
|
+
request_options=request_options,
|
|
881
|
+
)
|
|
882
|
+
try:
|
|
883
|
+
if 200 <= _response.status_code < 300:
|
|
884
|
+
_data = typing.cast(
|
|
885
|
+
AppVariantResponse,
|
|
886
|
+
parse_obj_as(
|
|
887
|
+
type_=AppVariantResponse, # type: ignore
|
|
888
|
+
object_=_response.json(),
|
|
889
|
+
),
|
|
890
|
+
)
|
|
891
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
892
|
+
if _response.status_code == 422:
|
|
893
|
+
raise UnprocessableEntityError(
|
|
894
|
+
headers=dict(_response.headers),
|
|
895
|
+
body=typing.cast(
|
|
896
|
+
HttpValidationError,
|
|
897
|
+
parse_obj_as(
|
|
898
|
+
type_=HttpValidationError, # type: ignore
|
|
899
|
+
object_=_response.json(),
|
|
900
|
+
),
|
|
901
|
+
),
|
|
902
|
+
)
|
|
903
|
+
_response_json = _response.json()
|
|
904
|
+
except JSONDecodeError:
|
|
905
|
+
raise ApiError(
|
|
906
|
+
status_code=_response.status_code,
|
|
907
|
+
headers=dict(_response.headers),
|
|
908
|
+
body=_response.text,
|
|
909
|
+
)
|
|
910
|
+
raise ApiError(
|
|
911
|
+
status_code=_response.status_code,
|
|
912
|
+
headers=dict(_response.headers),
|
|
913
|
+
body=_response_json,
|
|
914
|
+
)
|
|
915
|
+
|
|
916
|
+
async def list_apps(
|
|
917
|
+
self,
|
|
918
|
+
*,
|
|
919
|
+
app_name: typing.Optional[str] = None,
|
|
920
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
921
|
+
) -> AsyncHttpResponse[typing.List[App]]:
|
|
922
|
+
"""
|
|
923
|
+
Retrieve a list of apps filtered by app_name.
|
|
924
|
+
|
|
925
|
+
Args:
|
|
926
|
+
app_name (Optional[str]): The name of the app to filter by.
|
|
927
|
+
|
|
928
|
+
Returns:
|
|
929
|
+
List[App]: A list of apps filtered by app_name.
|
|
930
|
+
|
|
931
|
+
Raises:
|
|
932
|
+
HTTPException: If there was an error retrieving the list of apps.
|
|
933
|
+
|
|
934
|
+
Parameters
|
|
935
|
+
----------
|
|
936
|
+
app_name : typing.Optional[str]
|
|
937
|
+
|
|
938
|
+
request_options : typing.Optional[RequestOptions]
|
|
939
|
+
Request-specific configuration.
|
|
940
|
+
|
|
941
|
+
Returns
|
|
942
|
+
-------
|
|
943
|
+
AsyncHttpResponse[typing.List[App]]
|
|
944
|
+
Successful Response
|
|
945
|
+
"""
|
|
946
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
947
|
+
"apps",
|
|
948
|
+
method="GET",
|
|
949
|
+
params={
|
|
950
|
+
"app_name": app_name,
|
|
951
|
+
},
|
|
952
|
+
request_options=request_options,
|
|
953
|
+
)
|
|
954
|
+
try:
|
|
955
|
+
if 200 <= _response.status_code < 300:
|
|
956
|
+
_data = typing.cast(
|
|
957
|
+
typing.List[App],
|
|
958
|
+
parse_obj_as(
|
|
959
|
+
type_=typing.List[App], # type: ignore
|
|
960
|
+
object_=_response.json(),
|
|
961
|
+
),
|
|
962
|
+
)
|
|
963
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
964
|
+
if _response.status_code == 422:
|
|
965
|
+
raise UnprocessableEntityError(
|
|
966
|
+
headers=dict(_response.headers),
|
|
967
|
+
body=typing.cast(
|
|
968
|
+
HttpValidationError,
|
|
969
|
+
parse_obj_as(
|
|
970
|
+
type_=HttpValidationError, # type: ignore
|
|
971
|
+
object_=_response.json(),
|
|
972
|
+
),
|
|
973
|
+
),
|
|
974
|
+
)
|
|
975
|
+
_response_json = _response.json()
|
|
976
|
+
except JSONDecodeError:
|
|
977
|
+
raise ApiError(
|
|
978
|
+
status_code=_response.status_code,
|
|
979
|
+
headers=dict(_response.headers),
|
|
980
|
+
body=_response.text,
|
|
981
|
+
)
|
|
982
|
+
raise ApiError(
|
|
983
|
+
status_code=_response.status_code,
|
|
984
|
+
headers=dict(_response.headers),
|
|
985
|
+
body=_response_json,
|
|
986
|
+
)
|
|
987
|
+
|
|
988
|
+
async def create_app(
|
|
989
|
+
self,
|
|
990
|
+
*,
|
|
991
|
+
app_name: str,
|
|
992
|
+
template_key: typing.Optional[str] = OMIT,
|
|
993
|
+
project_id: typing.Optional[str] = OMIT,
|
|
994
|
+
workspace_id: typing.Optional[str] = OMIT,
|
|
995
|
+
organization_id: typing.Optional[str] = OMIT,
|
|
996
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
997
|
+
) -> AsyncHttpResponse[CreateAppOutput]:
|
|
998
|
+
"""
|
|
999
|
+
Create a new app for a user or organization.
|
|
1000
|
+
|
|
1001
|
+
Args:
|
|
1002
|
+
payload (CreateApp): The payload containing the app name and organization ID (optional).
|
|
1003
|
+
|
|
1004
|
+
Returns:
|
|
1005
|
+
CreateAppOutput: The output containing the newly created app's ID and name.
|
|
1006
|
+
|
|
1007
|
+
Raises:
|
|
1008
|
+
HTTPException: If there is an error creating the app or the user does not have permission to access the app.
|
|
1009
|
+
|
|
1010
|
+
Parameters
|
|
1011
|
+
----------
|
|
1012
|
+
app_name : str
|
|
1013
|
+
|
|
1014
|
+
template_key : typing.Optional[str]
|
|
1015
|
+
|
|
1016
|
+
project_id : typing.Optional[str]
|
|
1017
|
+
|
|
1018
|
+
workspace_id : typing.Optional[str]
|
|
1019
|
+
|
|
1020
|
+
organization_id : typing.Optional[str]
|
|
1021
|
+
|
|
1022
|
+
request_options : typing.Optional[RequestOptions]
|
|
1023
|
+
Request-specific configuration.
|
|
1024
|
+
|
|
1025
|
+
Returns
|
|
1026
|
+
-------
|
|
1027
|
+
AsyncHttpResponse[CreateAppOutput]
|
|
1028
|
+
Successful Response
|
|
1029
|
+
"""
|
|
1030
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1031
|
+
"apps",
|
|
1032
|
+
method="POST",
|
|
1033
|
+
json={
|
|
1034
|
+
"app_name": app_name,
|
|
1035
|
+
"template_key": template_key,
|
|
1036
|
+
"project_id": project_id,
|
|
1037
|
+
"workspace_id": workspace_id,
|
|
1038
|
+
"organization_id": organization_id,
|
|
1039
|
+
},
|
|
1040
|
+
headers={
|
|
1041
|
+
"content-type": "application/json",
|
|
1042
|
+
},
|
|
1043
|
+
request_options=request_options,
|
|
1044
|
+
omit=OMIT,
|
|
1045
|
+
)
|
|
1046
|
+
try:
|
|
1047
|
+
if 200 <= _response.status_code < 300:
|
|
1048
|
+
_data = typing.cast(
|
|
1049
|
+
CreateAppOutput,
|
|
1050
|
+
parse_obj_as(
|
|
1051
|
+
type_=CreateAppOutput, # type: ignore
|
|
1052
|
+
object_=_response.json(),
|
|
1053
|
+
),
|
|
1054
|
+
)
|
|
1055
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1056
|
+
if _response.status_code == 422:
|
|
1057
|
+
raise UnprocessableEntityError(
|
|
1058
|
+
headers=dict(_response.headers),
|
|
1059
|
+
body=typing.cast(
|
|
1060
|
+
HttpValidationError,
|
|
1061
|
+
parse_obj_as(
|
|
1062
|
+
type_=HttpValidationError, # type: ignore
|
|
1063
|
+
object_=_response.json(),
|
|
1064
|
+
),
|
|
1065
|
+
),
|
|
1066
|
+
)
|
|
1067
|
+
_response_json = _response.json()
|
|
1068
|
+
except JSONDecodeError:
|
|
1069
|
+
raise ApiError(
|
|
1070
|
+
status_code=_response.status_code,
|
|
1071
|
+
headers=dict(_response.headers),
|
|
1072
|
+
body=_response.text,
|
|
1073
|
+
)
|
|
1074
|
+
raise ApiError(
|
|
1075
|
+
status_code=_response.status_code,
|
|
1076
|
+
headers=dict(_response.headers),
|
|
1077
|
+
body=_response_json,
|
|
1078
|
+
)
|
|
1079
|
+
|
|
1080
|
+
async def remove_app(
|
|
1081
|
+
self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1082
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
1083
|
+
"""
|
|
1084
|
+
Remove app, all its variant.
|
|
1085
|
+
|
|
1086
|
+
Arguments:
|
|
1087
|
+
app -- App to remove
|
|
1088
|
+
|
|
1089
|
+
Parameters
|
|
1090
|
+
----------
|
|
1091
|
+
app_id : str
|
|
1092
|
+
|
|
1093
|
+
request_options : typing.Optional[RequestOptions]
|
|
1094
|
+
Request-specific configuration.
|
|
1095
|
+
|
|
1096
|
+
Returns
|
|
1097
|
+
-------
|
|
1098
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
1099
|
+
Successful Response
|
|
1100
|
+
"""
|
|
1101
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1102
|
+
f"apps/{jsonable_encoder(app_id)}",
|
|
1103
|
+
method="DELETE",
|
|
1104
|
+
request_options=request_options,
|
|
1105
|
+
)
|
|
1106
|
+
try:
|
|
1107
|
+
if _response is None or not _response.text.strip():
|
|
1108
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1109
|
+
if 200 <= _response.status_code < 300:
|
|
1110
|
+
_data = typing.cast(
|
|
1111
|
+
typing.Optional[typing.Any],
|
|
1112
|
+
parse_obj_as(
|
|
1113
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1114
|
+
object_=_response.json(),
|
|
1115
|
+
),
|
|
1116
|
+
)
|
|
1117
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1118
|
+
if _response.status_code == 422:
|
|
1119
|
+
raise UnprocessableEntityError(
|
|
1120
|
+
headers=dict(_response.headers),
|
|
1121
|
+
body=typing.cast(
|
|
1122
|
+
HttpValidationError,
|
|
1123
|
+
parse_obj_as(
|
|
1124
|
+
type_=HttpValidationError, # type: ignore
|
|
1125
|
+
object_=_response.json(),
|
|
1126
|
+
),
|
|
1127
|
+
),
|
|
1128
|
+
)
|
|
1129
|
+
_response_json = _response.json()
|
|
1130
|
+
except JSONDecodeError:
|
|
1131
|
+
raise ApiError(
|
|
1132
|
+
status_code=_response.status_code,
|
|
1133
|
+
headers=dict(_response.headers),
|
|
1134
|
+
body=_response.text,
|
|
1135
|
+
)
|
|
1136
|
+
raise ApiError(
|
|
1137
|
+
status_code=_response.status_code,
|
|
1138
|
+
headers=dict(_response.headers),
|
|
1139
|
+
body=_response_json,
|
|
1140
|
+
)
|
|
1141
|
+
|
|
1142
|
+
async def update_app(
|
|
1143
|
+
self,
|
|
1144
|
+
app_id: str,
|
|
1145
|
+
*,
|
|
1146
|
+
app_name: str,
|
|
1147
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1148
|
+
) -> AsyncHttpResponse[UpdateAppOutput]:
|
|
1149
|
+
"""
|
|
1150
|
+
Update an app for a user or organization.
|
|
1151
|
+
|
|
1152
|
+
Args:
|
|
1153
|
+
app_id (str): The ID of the app.
|
|
1154
|
+
payload (UpdateApp): The payload containing the app name.
|
|
1155
|
+
|
|
1156
|
+
Returns:
|
|
1157
|
+
UpdateAppOutput: The output containing the newly created app's ID and name.
|
|
1158
|
+
|
|
1159
|
+
Raises:
|
|
1160
|
+
HTTPException: If there is an error creating the app or the user does not have permission to access the app.
|
|
1161
|
+
|
|
1162
|
+
Parameters
|
|
1163
|
+
----------
|
|
1164
|
+
app_id : str
|
|
1165
|
+
|
|
1166
|
+
app_name : str
|
|
1167
|
+
|
|
1168
|
+
request_options : typing.Optional[RequestOptions]
|
|
1169
|
+
Request-specific configuration.
|
|
1170
|
+
|
|
1171
|
+
Returns
|
|
1172
|
+
-------
|
|
1173
|
+
AsyncHttpResponse[UpdateAppOutput]
|
|
1174
|
+
Successful Response
|
|
1175
|
+
"""
|
|
1176
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1177
|
+
f"apps/{jsonable_encoder(app_id)}",
|
|
1178
|
+
method="PATCH",
|
|
1179
|
+
json={
|
|
1180
|
+
"app_name": app_name,
|
|
1181
|
+
},
|
|
1182
|
+
headers={
|
|
1183
|
+
"content-type": "application/json",
|
|
1184
|
+
},
|
|
1185
|
+
request_options=request_options,
|
|
1186
|
+
omit=OMIT,
|
|
1187
|
+
)
|
|
1188
|
+
try:
|
|
1189
|
+
if 200 <= _response.status_code < 300:
|
|
1190
|
+
_data = typing.cast(
|
|
1191
|
+
UpdateAppOutput,
|
|
1192
|
+
parse_obj_as(
|
|
1193
|
+
type_=UpdateAppOutput, # type: ignore
|
|
1194
|
+
object_=_response.json(),
|
|
1195
|
+
),
|
|
1196
|
+
)
|
|
1197
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1198
|
+
if _response.status_code == 422:
|
|
1199
|
+
raise UnprocessableEntityError(
|
|
1200
|
+
headers=dict(_response.headers),
|
|
1201
|
+
body=typing.cast(
|
|
1202
|
+
HttpValidationError,
|
|
1203
|
+
parse_obj_as(
|
|
1204
|
+
type_=HttpValidationError, # type: ignore
|
|
1205
|
+
object_=_response.json(),
|
|
1206
|
+
),
|
|
1207
|
+
),
|
|
1208
|
+
)
|
|
1209
|
+
_response_json = _response.json()
|
|
1210
|
+
except JSONDecodeError:
|
|
1211
|
+
raise ApiError(
|
|
1212
|
+
status_code=_response.status_code,
|
|
1213
|
+
headers=dict(_response.headers),
|
|
1214
|
+
body=_response.text,
|
|
1215
|
+
)
|
|
1216
|
+
raise ApiError(
|
|
1217
|
+
status_code=_response.status_code,
|
|
1218
|
+
headers=dict(_response.headers),
|
|
1219
|
+
body=_response_json,
|
|
1220
|
+
)
|
|
1221
|
+
|
|
1222
|
+
async def add_variant_from_url(
|
|
1223
|
+
self,
|
|
1224
|
+
app_id: str,
|
|
1225
|
+
*,
|
|
1226
|
+
variant_name: str,
|
|
1227
|
+
url: str,
|
|
1228
|
+
commit_message: typing.Optional[str] = OMIT,
|
|
1229
|
+
base_name: typing.Optional[str] = OMIT,
|
|
1230
|
+
config_name: typing.Optional[str] = OMIT,
|
|
1231
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1232
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
1233
|
+
"""
|
|
1234
|
+
Parameters
|
|
1235
|
+
----------
|
|
1236
|
+
app_id : str
|
|
1237
|
+
|
|
1238
|
+
variant_name : str
|
|
1239
|
+
|
|
1240
|
+
url : str
|
|
1241
|
+
|
|
1242
|
+
commit_message : typing.Optional[str]
|
|
1243
|
+
|
|
1244
|
+
base_name : typing.Optional[str]
|
|
1245
|
+
|
|
1246
|
+
config_name : typing.Optional[str]
|
|
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
|
+
f"apps/{jsonable_encoder(app_id)}/variant/from-service",
|
|
1258
|
+
method="POST",
|
|
1259
|
+
json={
|
|
1260
|
+
"variant_name": variant_name,
|
|
1261
|
+
"url": url,
|
|
1262
|
+
"commit_message": commit_message,
|
|
1263
|
+
"base_name": base_name,
|
|
1264
|
+
"config_name": config_name,
|
|
1265
|
+
},
|
|
1266
|
+
headers={
|
|
1267
|
+
"content-type": "application/json",
|
|
1268
|
+
},
|
|
1269
|
+
request_options=request_options,
|
|
1270
|
+
omit=OMIT,
|
|
1271
|
+
)
|
|
1272
|
+
try:
|
|
1273
|
+
if _response is None or not _response.text.strip():
|
|
1274
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1275
|
+
if 200 <= _response.status_code < 300:
|
|
1276
|
+
_data = typing.cast(
|
|
1277
|
+
typing.Optional[typing.Any],
|
|
1278
|
+
parse_obj_as(
|
|
1279
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1280
|
+
object_=_response.json(),
|
|
1281
|
+
),
|
|
1282
|
+
)
|
|
1283
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1284
|
+
if _response.status_code == 422:
|
|
1285
|
+
raise UnprocessableEntityError(
|
|
1286
|
+
headers=dict(_response.headers),
|
|
1287
|
+
body=typing.cast(
|
|
1288
|
+
HttpValidationError,
|
|
1289
|
+
parse_obj_as(
|
|
1290
|
+
type_=HttpValidationError, # type: ignore
|
|
1291
|
+
object_=_response.json(),
|
|
1292
|
+
),
|
|
1293
|
+
),
|
|
1294
|
+
)
|
|
1295
|
+
_response_json = _response.json()
|
|
1296
|
+
except JSONDecodeError:
|
|
1297
|
+
raise ApiError(
|
|
1298
|
+
status_code=_response.status_code,
|
|
1299
|
+
headers=dict(_response.headers),
|
|
1300
|
+
body=_response.text,
|
|
1301
|
+
)
|
|
1302
|
+
raise ApiError(
|
|
1303
|
+
status_code=_response.status_code,
|
|
1304
|
+
headers=dict(_response.headers),
|
|
1305
|
+
body=_response_json,
|
|
1306
|
+
)
|
|
1307
|
+
|
|
1308
|
+
async def add_variant_from_key(
|
|
1309
|
+
self,
|
|
1310
|
+
app_id: str,
|
|
1311
|
+
*,
|
|
1312
|
+
variant_name: str,
|
|
1313
|
+
key: str,
|
|
1314
|
+
commit_message: typing.Optional[str] = OMIT,
|
|
1315
|
+
base_name: typing.Optional[str] = OMIT,
|
|
1316
|
+
config_name: typing.Optional[str] = OMIT,
|
|
1317
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1318
|
+
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
|
|
1319
|
+
"""
|
|
1320
|
+
Parameters
|
|
1321
|
+
----------
|
|
1322
|
+
app_id : str
|
|
1323
|
+
|
|
1324
|
+
variant_name : str
|
|
1325
|
+
|
|
1326
|
+
key : str
|
|
1327
|
+
|
|
1328
|
+
commit_message : typing.Optional[str]
|
|
1329
|
+
|
|
1330
|
+
base_name : typing.Optional[str]
|
|
1331
|
+
|
|
1332
|
+
config_name : typing.Optional[str]
|
|
1333
|
+
|
|
1334
|
+
request_options : typing.Optional[RequestOptions]
|
|
1335
|
+
Request-specific configuration.
|
|
1336
|
+
|
|
1337
|
+
Returns
|
|
1338
|
+
-------
|
|
1339
|
+
AsyncHttpResponse[typing.Optional[typing.Any]]
|
|
1340
|
+
Successful Response
|
|
1341
|
+
"""
|
|
1342
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1343
|
+
f"apps/{jsonable_encoder(app_id)}/variant/from-template",
|
|
1344
|
+
method="POST",
|
|
1345
|
+
json={
|
|
1346
|
+
"variant_name": variant_name,
|
|
1347
|
+
"key": key,
|
|
1348
|
+
"commit_message": commit_message,
|
|
1349
|
+
"base_name": base_name,
|
|
1350
|
+
"config_name": config_name,
|
|
1351
|
+
},
|
|
1352
|
+
headers={
|
|
1353
|
+
"content-type": "application/json",
|
|
1354
|
+
},
|
|
1355
|
+
request_options=request_options,
|
|
1356
|
+
omit=OMIT,
|
|
1357
|
+
)
|
|
1358
|
+
try:
|
|
1359
|
+
if _response is None or not _response.text.strip():
|
|
1360
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1361
|
+
if 200 <= _response.status_code < 300:
|
|
1362
|
+
_data = typing.cast(
|
|
1363
|
+
typing.Optional[typing.Any],
|
|
1364
|
+
parse_obj_as(
|
|
1365
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1366
|
+
object_=_response.json(),
|
|
1367
|
+
),
|
|
1368
|
+
)
|
|
1369
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1370
|
+
if _response.status_code == 422:
|
|
1371
|
+
raise UnprocessableEntityError(
|
|
1372
|
+
headers=dict(_response.headers),
|
|
1373
|
+
body=typing.cast(
|
|
1374
|
+
HttpValidationError,
|
|
1375
|
+
parse_obj_as(
|
|
1376
|
+
type_=HttpValidationError, # type: ignore
|
|
1377
|
+
object_=_response.json(),
|
|
1378
|
+
),
|
|
1379
|
+
),
|
|
1380
|
+
)
|
|
1381
|
+
_response_json = _response.json()
|
|
1382
|
+
except JSONDecodeError:
|
|
1383
|
+
raise ApiError(
|
|
1384
|
+
status_code=_response.status_code,
|
|
1385
|
+
headers=dict(_response.headers),
|
|
1386
|
+
body=_response.text,
|
|
1387
|
+
)
|
|
1388
|
+
raise ApiError(
|
|
1389
|
+
status_code=_response.status_code,
|
|
1390
|
+
headers=dict(_response.headers),
|
|
1391
|
+
body=_response_json,
|
|
1392
|
+
)
|
|
1393
|
+
|
|
1394
|
+
async def list_environments(
|
|
1395
|
+
self, app_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1396
|
+
) -> AsyncHttpResponse[typing.List[EnvironmentOutput]]:
|
|
1397
|
+
"""
|
|
1398
|
+
Retrieve a list of environments for a given app ID.
|
|
1399
|
+
|
|
1400
|
+
Args:
|
|
1401
|
+
app_id (str): The ID of the app to retrieve environments for.
|
|
1402
|
+
|
|
1403
|
+
Returns:
|
|
1404
|
+
List[EnvironmentOutput]: A list of environment objects.
|
|
1405
|
+
|
|
1406
|
+
Parameters
|
|
1407
|
+
----------
|
|
1408
|
+
app_id : str
|
|
1409
|
+
|
|
1410
|
+
request_options : typing.Optional[RequestOptions]
|
|
1411
|
+
Request-specific configuration.
|
|
1412
|
+
|
|
1413
|
+
Returns
|
|
1414
|
+
-------
|
|
1415
|
+
AsyncHttpResponse[typing.List[EnvironmentOutput]]
|
|
1416
|
+
Successful Response
|
|
1417
|
+
"""
|
|
1418
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1419
|
+
f"apps/{jsonable_encoder(app_id)}/environments",
|
|
1420
|
+
method="GET",
|
|
1421
|
+
request_options=request_options,
|
|
1422
|
+
)
|
|
1423
|
+
try:
|
|
1424
|
+
if 200 <= _response.status_code < 300:
|
|
1425
|
+
_data = typing.cast(
|
|
1426
|
+
typing.List[EnvironmentOutput],
|
|
1427
|
+
parse_obj_as(
|
|
1428
|
+
type_=typing.List[EnvironmentOutput], # type: ignore
|
|
1429
|
+
object_=_response.json(),
|
|
1430
|
+
),
|
|
1431
|
+
)
|
|
1432
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1433
|
+
if _response.status_code == 422:
|
|
1434
|
+
raise UnprocessableEntityError(
|
|
1435
|
+
headers=dict(_response.headers),
|
|
1436
|
+
body=typing.cast(
|
|
1437
|
+
HttpValidationError,
|
|
1438
|
+
parse_obj_as(
|
|
1439
|
+
type_=HttpValidationError, # type: ignore
|
|
1440
|
+
object_=_response.json(),
|
|
1441
|
+
),
|
|
1442
|
+
),
|
|
1443
|
+
)
|
|
1444
|
+
_response_json = _response.json()
|
|
1445
|
+
except JSONDecodeError:
|
|
1446
|
+
raise ApiError(
|
|
1447
|
+
status_code=_response.status_code,
|
|
1448
|
+
headers=dict(_response.headers),
|
|
1449
|
+
body=_response.text,
|
|
1450
|
+
)
|
|
1451
|
+
raise ApiError(
|
|
1452
|
+
status_code=_response.status_code,
|
|
1453
|
+
headers=dict(_response.headers),
|
|
1454
|
+
body=_response_json,
|
|
1455
|
+
)
|
|
1456
|
+
|
|
1457
|
+
async def environment_revisions(
|
|
1458
|
+
self,
|
|
1459
|
+
app_id: str,
|
|
1460
|
+
environment_name: typing.Optional[typing.Any],
|
|
1461
|
+
*,
|
|
1462
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1463
|
+
) -> AsyncHttpResponse[EnvironmentOutputExtended]:
|
|
1464
|
+
"""
|
|
1465
|
+
Parameters
|
|
1466
|
+
----------
|
|
1467
|
+
app_id : str
|
|
1468
|
+
|
|
1469
|
+
environment_name : typing.Optional[typing.Any]
|
|
1470
|
+
|
|
1471
|
+
request_options : typing.Optional[RequestOptions]
|
|
1472
|
+
Request-specific configuration.
|
|
1473
|
+
|
|
1474
|
+
Returns
|
|
1475
|
+
-------
|
|
1476
|
+
AsyncHttpResponse[EnvironmentOutputExtended]
|
|
1477
|
+
Successful Response
|
|
1478
|
+
"""
|
|
1479
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1480
|
+
f"apps/{jsonable_encoder(app_id)}/revisions/{jsonable_encoder(environment_name)}",
|
|
1481
|
+
method="GET",
|
|
1482
|
+
request_options=request_options,
|
|
1483
|
+
)
|
|
1484
|
+
try:
|
|
1485
|
+
if 200 <= _response.status_code < 300:
|
|
1486
|
+
_data = typing.cast(
|
|
1487
|
+
EnvironmentOutputExtended,
|
|
1488
|
+
parse_obj_as(
|
|
1489
|
+
type_=EnvironmentOutputExtended, # type: ignore
|
|
1490
|
+
object_=_response.json(),
|
|
1491
|
+
),
|
|
1492
|
+
)
|
|
1493
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1494
|
+
if _response.status_code == 422:
|
|
1495
|
+
raise UnprocessableEntityError(
|
|
1496
|
+
headers=dict(_response.headers),
|
|
1497
|
+
body=typing.cast(
|
|
1498
|
+
HttpValidationError,
|
|
1499
|
+
parse_obj_as(
|
|
1500
|
+
type_=HttpValidationError, # type: ignore
|
|
1501
|
+
object_=_response.json(),
|
|
1502
|
+
),
|
|
1503
|
+
),
|
|
1504
|
+
)
|
|
1505
|
+
_response_json = _response.json()
|
|
1506
|
+
except JSONDecodeError:
|
|
1507
|
+
raise ApiError(
|
|
1508
|
+
status_code=_response.status_code,
|
|
1509
|
+
headers=dict(_response.headers),
|
|
1510
|
+
body=_response.text,
|
|
1511
|
+
)
|
|
1512
|
+
raise ApiError(
|
|
1513
|
+
status_code=_response.status_code,
|
|
1514
|
+
headers=dict(_response.headers),
|
|
1515
|
+
body=_response_json,
|
|
1516
|
+
)
|