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.

Files changed (295) hide show
  1. agenta/__init__.py +3 -2
  2. agenta/client/Readme.md +258 -80
  3. agenta/client/__init__.py +205 -29
  4. agenta/client/backend/__init__.py +461 -0
  5. agenta/client/backend/access_control/__init__.py +2 -0
  6. agenta/client/backend/access_control/client.py +53 -73
  7. agenta/client/backend/access_control/raw_client.py +180 -0
  8. agenta/client/backend/admin/__init__.py +2 -0
  9. agenta/client/backend/admin/client.py +473 -268
  10. agenta/client/backend/admin/raw_client.py +1017 -0
  11. agenta/client/backend/api_keys/__init__.py +2 -0
  12. agenta/client/backend/api_keys/client.py +43 -276
  13. agenta/client/backend/api_keys/raw_client.py +364 -0
  14. agenta/client/backend/apps/__init__.py +2 -0
  15. agenta/client/backend/apps/client.py +132 -895
  16. agenta/client/backend/apps/raw_client.py +1516 -0
  17. agenta/client/backend/bases/__init__.py +2 -0
  18. agenta/client/backend/bases/client.py +33 -73
  19. agenta/client/backend/bases/raw_client.py +179 -0
  20. agenta/client/backend/billing/__init__.py +3 -0
  21. agenta/client/backend/billing/client.py +564 -0
  22. agenta/client/backend/billing/raw_client.py +805 -0
  23. agenta/client/backend/client.py +1268 -0
  24. agenta/client/backend/configs/__init__.py +2 -0
  25. agenta/client/backend/configs/client.py +49 -361
  26. agenta/client/backend/configs/raw_client.py +402 -0
  27. agenta/client/backend/containers/__init__.py +1 -3
  28. agenta/client/backend/containers/client.py +25 -548
  29. agenta/client/backend/containers/raw_client.py +112 -0
  30. agenta/client/backend/core/__init__.py +5 -0
  31. agenta/client/backend/core/api_error.py +12 -6
  32. agenta/client/backend/core/client_wrapper.py +4 -4
  33. agenta/client/backend/core/file.py +1 -3
  34. agenta/client/backend/core/force_multipart.py +16 -0
  35. agenta/client/backend/core/http_client.py +78 -34
  36. agenta/client/backend/core/http_response.py +55 -0
  37. agenta/client/backend/core/jsonable_encoder.py +0 -1
  38. agenta/client/backend/core/pydantic_utilities.py +88 -113
  39. agenta/client/backend/core/serialization.py +9 -3
  40. agenta/client/backend/environment.py +7 -0
  41. agenta/client/backend/environments/__init__.py +2 -0
  42. agenta/client/backend/environments/client.py +43 -79
  43. agenta/client/backend/environments/raw_client.py +193 -0
  44. agenta/client/backend/errors/__init__.py +2 -0
  45. agenta/client/backend/errors/unprocessable_entity_error.py +8 -2
  46. agenta/client/backend/evals/__init__.py +3 -0
  47. agenta/client/backend/evals/client.py +1042 -0
  48. agenta/client/backend/evals/raw_client.py +1549 -0
  49. agenta/client/backend/evaluations/__init__.py +2 -0
  50. agenta/client/backend/evaluations/client.py +106 -590
  51. agenta/client/backend/evaluations/raw_client.py +1344 -0
  52. agenta/client/backend/evaluators/__init__.py +2 -0
  53. agenta/client/backend/evaluators/client.py +99 -516
  54. agenta/client/backend/evaluators/raw_client.py +1182 -0
  55. agenta/client/backend/human_evaluations/__init__.py +2 -0
  56. agenta/client/backend/human_evaluations/client.py +120 -680
  57. agenta/client/backend/human_evaluations/raw_client.py +1577 -0
  58. agenta/client/backend/observability/__init__.py +14 -2
  59. agenta/client/backend/observability/client.py +185 -341
  60. agenta/client/backend/observability/raw_client.py +943 -0
  61. agenta/client/backend/observability/types/__init__.py +10 -2
  62. agenta/client/backend/observability/types/{format.py → fetch_trace_by_id_request_trace_id.py} +1 -1
  63. agenta/client/backend/observability/types/fetch_trace_by_id_response.py +15 -0
  64. agenta/client/backend/observability/types/query_analytics_response.py +2 -1
  65. agenta/client/backend/observability/types/query_traces_response.py +7 -3
  66. agenta/client/backend/organization/__init__.py +2 -0
  67. agenta/client/backend/organization/client.py +105 -361
  68. agenta/client/backend/organization/raw_client.py +774 -0
  69. agenta/client/backend/raw_client.py +1432 -0
  70. agenta/client/backend/scopes/__init__.py +2 -0
  71. agenta/client/backend/scopes/client.py +31 -45
  72. agenta/client/backend/scopes/raw_client.py +105 -0
  73. agenta/client/backend/testsets/__init__.py +14 -0
  74. agenta/client/backend/testsets/client.py +1098 -653
  75. agenta/client/backend/testsets/raw_client.py +2348 -0
  76. agenta/client/backend/testsets/types/__init__.py +17 -0
  77. agenta/client/backend/testsets/types/create_testset_from_file_request_file_type.py +7 -0
  78. agenta/client/backend/testsets/types/fetch_testset_to_file_request_file_type.py +7 -0
  79. agenta/client/backend/testsets/types/update_testset_from_file_request_file_type.py +7 -0
  80. agenta/client/backend/tracing/__init__.py +7 -0
  81. agenta/client/backend/tracing/client.py +782 -0
  82. agenta/client/backend/tracing/raw_client.py +1223 -0
  83. agenta/client/backend/tracing/types/__init__.py +8 -0
  84. agenta/client/backend/{types/variant_action_enum.py → tracing/types/fetch_trace_request_trace_id.py} +1 -1
  85. agenta/client/backend/tracing/types/remove_trace_request_trace_id.py +5 -0
  86. agenta/client/backend/types/__init__.py +153 -26
  87. agenta/client/backend/types/account_request.py +24 -0
  88. agenta/client/backend/types/account_response.py +5 -7
  89. agenta/client/backend/types/agenta_node_dto.py +13 -13
  90. agenta/client/backend/types/agenta_node_dto_nodes_value.py +1 -0
  91. agenta/client/backend/types/agenta_nodes_response.py +14 -8
  92. agenta/client/backend/types/agenta_root_dto.py +16 -8
  93. agenta/client/backend/types/agenta_roots_response.py +16 -8
  94. agenta/client/backend/types/agenta_tree_dto.py +16 -8
  95. agenta/client/backend/types/agenta_trees_response.py +16 -8
  96. agenta/client/backend/types/aggregated_result.py +5 -7
  97. agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -0
  98. agenta/client/backend/types/analytics_response.py +4 -6
  99. agenta/client/backend/types/annotation.py +50 -0
  100. agenta/client/backend/types/annotation_create.py +39 -0
  101. agenta/client/backend/types/annotation_edit.py +31 -0
  102. agenta/client/backend/types/annotation_kind.py +5 -0
  103. agenta/client/backend/types/{uri.py → annotation_link.py} +6 -7
  104. agenta/client/backend/types/{provider_key_dto.py → annotation_link_response.py} +6 -7
  105. agenta/client/backend/types/annotation_query.py +40 -0
  106. agenta/client/backend/types/annotation_query_request.py +20 -0
  107. agenta/client/backend/types/annotation_reference.py +21 -0
  108. agenta/client/backend/types/annotation_references.py +22 -0
  109. agenta/client/backend/types/{docker_env_vars.py → annotation_response.py} +6 -7
  110. agenta/client/backend/types/annotation_source.py +5 -0
  111. agenta/client/backend/types/annotations_response.py +24 -0
  112. agenta/client/backend/types/app.py +3 -5
  113. agenta/client/backend/types/app_variant_response.py +3 -6
  114. agenta/client/backend/types/app_variant_revision.py +5 -6
  115. agenta/client/backend/types/artifact.py +44 -0
  116. agenta/client/backend/types/base_output.py +3 -5
  117. agenta/client/backend/types/body_fetch_workflow_revision.py +21 -0
  118. agenta/client/backend/types/body_import_testset.py +3 -5
  119. agenta/client/backend/types/bucket_dto.py +4 -6
  120. agenta/client/backend/types/collect_status_response.py +3 -5
  121. agenta/client/backend/types/config_db.py +3 -5
  122. agenta/client/backend/types/config_dto.py +5 -7
  123. agenta/client/backend/types/config_response_model.py +5 -7
  124. agenta/client/backend/types/correct_answer.py +3 -5
  125. agenta/client/backend/types/create_app_output.py +3 -5
  126. agenta/client/backend/types/custom_model_settings_dto.py +3 -5
  127. agenta/client/backend/types/custom_provider_dto.py +6 -9
  128. agenta/client/backend/types/custom_provider_kind.py +5 -5
  129. agenta/client/backend/types/custom_provider_settings_dto.py +3 -5
  130. agenta/client/backend/types/data.py +2 -1
  131. agenta/client/backend/types/delete_evaluation.py +3 -5
  132. agenta/client/backend/types/environment_output.py +3 -5
  133. agenta/client/backend/types/environment_output_extended.py +4 -6
  134. agenta/client/backend/types/environment_revision.py +5 -5
  135. agenta/client/backend/types/error.py +3 -5
  136. agenta/client/backend/types/evaluation.py +6 -8
  137. agenta/client/backend/types/evaluation_scenario.py +5 -7
  138. agenta/client/backend/types/evaluation_scenario_input.py +3 -5
  139. agenta/client/backend/types/evaluation_scenario_output.py +4 -6
  140. agenta/client/backend/types/evaluation_scenario_result.py +4 -6
  141. agenta/client/backend/types/evaluator.py +31 -12
  142. agenta/client/backend/types/evaluator_config.py +3 -5
  143. agenta/client/backend/types/evaluator_flags.py +21 -0
  144. agenta/client/backend/types/evaluator_mapping_output_interface.py +3 -5
  145. agenta/client/backend/types/evaluator_output_interface.py +3 -5
  146. agenta/client/backend/types/evaluator_query.py +32 -0
  147. agenta/client/backend/types/evaluator_query_request.py +30 -0
  148. agenta/client/backend/types/evaluator_request.py +20 -0
  149. agenta/client/backend/types/evaluator_response.py +21 -0
  150. agenta/client/backend/types/evaluators_response.py +21 -0
  151. agenta/client/backend/types/exception_dto.py +3 -5
  152. agenta/client/backend/types/{o_tel_spans_response.py → extended_o_tel_tracing_response.py} +5 -7
  153. agenta/client/backend/types/focus.py +5 -0
  154. agenta/client/backend/types/format.py +5 -0
  155. agenta/client/backend/types/full_json_input.py +34 -0
  156. agenta/client/backend/types/full_json_output.py +29 -0
  157. agenta/client/backend/types/get_config_response.py +3 -5
  158. agenta/client/backend/types/{header_dto.py → header.py} +4 -6
  159. agenta/client/backend/types/http_validation_error.py +4 -6
  160. agenta/client/backend/types/human_evaluation.py +3 -5
  161. agenta/client/backend/types/human_evaluation_scenario.py +4 -6
  162. agenta/client/backend/types/human_evaluation_scenario_input.py +3 -5
  163. agenta/client/backend/types/human_evaluation_scenario_output.py +3 -5
  164. agenta/client/backend/types/invite_request.py +4 -6
  165. agenta/client/backend/types/legacy_analytics_response.py +4 -6
  166. agenta/client/backend/types/legacy_data_point.py +3 -5
  167. agenta/client/backend/types/legacy_evaluator.py +26 -0
  168. agenta/client/backend/types/legacy_scope_request.py +4 -6
  169. agenta/client/backend/types/legacy_scopes_response.py +3 -5
  170. agenta/client/backend/types/legacy_subscription_request.py +19 -0
  171. agenta/client/backend/types/legacy_user_request.py +5 -7
  172. agenta/client/backend/types/legacy_user_response.py +3 -5
  173. agenta/client/backend/types/lifecycle_dto.py +3 -5
  174. agenta/client/backend/types/link_dto.py +4 -6
  175. agenta/client/backend/types/list_api_keys_response.py +3 -5
  176. agenta/client/backend/types/llm_run_rate_limit.py +3 -5
  177. agenta/client/backend/types/meta_request.py +30 -0
  178. agenta/client/backend/types/metrics_dto.py +3 -5
  179. agenta/client/backend/types/new_testset.py +3 -5
  180. agenta/client/backend/types/node_dto.py +4 -6
  181. agenta/client/backend/types/o_tel_context_dto.py +3 -5
  182. agenta/client/backend/types/o_tel_event.py +35 -0
  183. agenta/client/backend/types/o_tel_event_dto.py +3 -5
  184. agenta/client/backend/types/o_tel_extra_dto.py +4 -6
  185. agenta/client/backend/types/o_tel_flat_span.py +56 -0
  186. agenta/client/backend/types/o_tel_flat_span_input_end_time.py +6 -0
  187. agenta/client/backend/types/o_tel_flat_span_input_start_time.py +6 -0
  188. agenta/client/backend/types/o_tel_flat_span_output_end_time.py +6 -0
  189. agenta/client/backend/types/o_tel_flat_span_output_start_time.py +6 -0
  190. agenta/client/backend/types/o_tel_link.py +34 -0
  191. agenta/client/backend/types/o_tel_link_dto.py +4 -6
  192. agenta/client/backend/types/o_tel_links_response.py +22 -0
  193. agenta/client/backend/types/o_tel_span.py +58 -0
  194. agenta/client/backend/types/o_tel_span_dto.py +8 -10
  195. agenta/client/backend/types/o_tel_span_input_end_time.py +6 -0
  196. agenta/client/backend/types/o_tel_span_input_spans_value.py +7 -0
  197. agenta/client/backend/types/o_tel_span_input_start_time.py +6 -0
  198. agenta/client/backend/types/o_tel_span_output_end_time.py +6 -0
  199. agenta/client/backend/types/o_tel_span_output_spans_value.py +30 -0
  200. agenta/client/backend/types/o_tel_span_output_start_time.py +6 -0
  201. agenta/client/backend/types/o_tel_spans_tree.py +22 -0
  202. agenta/client/backend/types/o_tel_spans_tree_input_spans_value.py +7 -0
  203. agenta/client/backend/types/o_tel_spans_tree_output_spans_value.py +5 -0
  204. agenta/client/backend/types/o_tel_status_code.py +1 -1
  205. agenta/client/backend/types/o_tel_tracing_data_response.py +22 -0
  206. agenta/client/backend/types/o_tel_tracing_request.py +22 -0
  207. agenta/client/backend/types/o_tel_tracing_response.py +27 -0
  208. agenta/client/backend/types/organization.py +3 -5
  209. agenta/client/backend/types/organization_details.py +3 -5
  210. agenta/client/backend/types/organization_membership_request.py +5 -7
  211. agenta/client/backend/types/organization_output.py +3 -5
  212. agenta/client/backend/types/organization_request.py +3 -5
  213. agenta/client/backend/types/parent_dto.py +3 -5
  214. agenta/client/backend/types/permission.py +11 -0
  215. agenta/client/backend/types/plan.py +14 -0
  216. agenta/client/backend/types/project_membership_request.py +5 -7
  217. agenta/client/backend/types/project_request.py +4 -6
  218. agenta/client/backend/types/project_scope.py +5 -7
  219. agenta/client/backend/types/projects_response.py +3 -5
  220. agenta/client/backend/types/recursive_types.py +23 -0
  221. agenta/client/backend/types/reference.py +18 -5
  222. agenta/client/backend/types/reference_dto.py +4 -5
  223. agenta/client/backend/types/reference_request_model.py +4 -5
  224. agenta/client/backend/types/result.py +4 -6
  225. agenta/client/backend/types/root_dto.py +3 -5
  226. agenta/client/backend/types/scopes_response_model.py +4 -6
  227. agenta/client/backend/types/secret_dto.py +5 -7
  228. agenta/client/backend/types/secret_response_dto.py +11 -11
  229. agenta/client/backend/types/simple_evaluation_output.py +4 -6
  230. agenta/client/backend/types/span_dto.py +18 -14
  231. agenta/client/backend/types/span_dto_nodes_value.py +1 -1
  232. agenta/client/backend/types/standard_provider_dto.py +5 -7
  233. agenta/client/backend/types/standard_provider_settings_dto.py +3 -5
  234. agenta/client/backend/types/status_dto.py +4 -6
  235. agenta/client/backend/types/tags_request.py +30 -0
  236. agenta/client/backend/types/test_set_output_response.py +5 -7
  237. agenta/client/backend/types/test_set_simple_response.py +3 -5
  238. agenta/client/backend/types/testcase_response.py +33 -0
  239. agenta/client/backend/types/testset.py +46 -0
  240. agenta/client/backend/types/testset_request.py +20 -0
  241. agenta/client/backend/types/testset_response.py +21 -0
  242. agenta/client/backend/types/testsets_response.py +21 -0
  243. agenta/client/backend/types/time_dto.py +3 -5
  244. agenta/client/backend/types/timestamp.py +6 -0
  245. agenta/client/backend/types/tree_dto.py +4 -6
  246. agenta/client/backend/types/update_app_output.py +3 -5
  247. agenta/client/backend/types/user_request.py +3 -5
  248. agenta/client/backend/types/validation_error.py +4 -6
  249. agenta/client/backend/types/workflow_artifact.py +45 -0
  250. agenta/client/backend/types/workflow_data.py +20 -0
  251. agenta/client/backend/types/workflow_flags.py +21 -0
  252. agenta/client/backend/types/workflow_request.py +20 -0
  253. agenta/client/backend/types/workflow_response.py +21 -0
  254. agenta/client/backend/types/workflow_revision.py +57 -0
  255. agenta/client/backend/types/workflow_revision_request.py +20 -0
  256. agenta/client/backend/types/workflow_revision_response.py +21 -0
  257. agenta/client/backend/types/workflow_revisions_response.py +21 -0
  258. agenta/client/backend/types/workflow_variant.py +48 -0
  259. agenta/client/backend/types/workflow_variant_request.py +20 -0
  260. agenta/client/backend/types/workflow_variant_response.py +21 -0
  261. agenta/client/backend/types/workflow_variants_response.py +21 -0
  262. agenta/client/backend/types/workflows_response.py +21 -0
  263. agenta/client/backend/types/workspace.py +3 -5
  264. agenta/client/backend/types/workspace_member_response.py +4 -6
  265. agenta/client/backend/types/workspace_membership_request.py +5 -7
  266. agenta/client/backend/types/workspace_permission.py +5 -7
  267. agenta/client/backend/types/workspace_request.py +4 -6
  268. agenta/client/backend/types/workspace_response.py +4 -6
  269. agenta/client/backend/variants/__init__.py +2 -0
  270. agenta/client/backend/variants/client.py +306 -1651
  271. agenta/client/backend/variants/raw_client.py +2482 -0
  272. agenta/client/backend/variants/types/__init__.py +2 -0
  273. agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +1 -0
  274. agenta/client/backend/vault/__init__.py +2 -0
  275. agenta/client/backend/vault/client.py +69 -323
  276. agenta/client/backend/vault/raw_client.py +616 -0
  277. agenta/client/backend/workflows/__init__.py +3 -0
  278. agenta/client/backend/workflows/client.py +2398 -0
  279. agenta/client/backend/workflows/raw_client.py +3639 -0
  280. agenta/client/backend/workspace/__init__.py +2 -0
  281. agenta/client/backend/workspace/client.py +46 -147
  282. agenta/client/backend/workspace/raw_client.py +376 -0
  283. agenta/client/types.py +4 -0
  284. agenta/sdk/types.py +28 -1
  285. {agenta-0.48.9.dist-info → agenta-0.48.10.dist-info}/METADATA +1 -1
  286. agenta-0.48.10.dist-info/RECORD +362 -0
  287. agenta/client/backend/containers/types/__init__.py +0 -5
  288. agenta/client/backend/containers/types/container_templates_response.py +0 -6
  289. agenta/client/backend/types/image.py +0 -25
  290. agenta/client/backend/types/provider_kind.py +0 -21
  291. agenta/client/backend/types/template.py +0 -23
  292. agenta/client/backend/types/template_image_info.py +0 -29
  293. agenta/client/backend/types/variant_action.py +0 -22
  294. agenta-0.48.9.dist-info/RECORD +0 -255
  295. {agenta-0.48.9.dist-info → agenta-0.48.10.dist-info}/WHEEL +0 -0
@@ -0,0 +1,2482 @@
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.app_variant_response import AppVariantResponse
15
+ from ..types.app_variant_revision import AppVariantRevision
16
+ from ..types.config_dto import ConfigDto
17
+ from ..types.config_response_model import ConfigResponseModel
18
+ from ..types.http_validation_error import HttpValidationError
19
+ from ..types.reference_dto import ReferenceDto
20
+ from ..types.reference_request_model import ReferenceRequestModel
21
+ from .types.add_variant_from_base_and_config_response import (
22
+ AddVariantFromBaseAndConfigResponse,
23
+ )
24
+
25
+ # this is used as the default value for optional parameters
26
+ OMIT = typing.cast(typing.Any, ...)
27
+
28
+
29
+ class RawVariantsClient:
30
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
31
+ self._client_wrapper = client_wrapper
32
+
33
+ def add_variant_from_base_and_config(
34
+ self,
35
+ *,
36
+ base_id: str,
37
+ new_variant_name: str,
38
+ new_config_name: str,
39
+ parameters: typing.Dict[str, typing.Optional[typing.Any]],
40
+ commit_message: typing.Optional[str] = OMIT,
41
+ request_options: typing.Optional[RequestOptions] = None,
42
+ ) -> HttpResponse[AddVariantFromBaseAndConfigResponse]:
43
+ """
44
+ Add a new variant based on an existing one.
45
+ Same as POST /config
46
+
47
+ Args:
48
+ payload (AddVariantFromBasePayload): Payload containing base variant ID, new variant name, and parameters.
49
+
50
+ Raises:
51
+ HTTPException: Raised if the variant could not be added or accessed.
52
+
53
+ Returns:
54
+ Union[AppVariantResponse, Any]: New variant details or exception.
55
+
56
+ Parameters
57
+ ----------
58
+ base_id : str
59
+
60
+ new_variant_name : str
61
+
62
+ new_config_name : str
63
+
64
+ parameters : typing.Dict[str, typing.Optional[typing.Any]]
65
+
66
+ commit_message : typing.Optional[str]
67
+
68
+ request_options : typing.Optional[RequestOptions]
69
+ Request-specific configuration.
70
+
71
+ Returns
72
+ -------
73
+ HttpResponse[AddVariantFromBaseAndConfigResponse]
74
+ Successful Response
75
+ """
76
+ _response = self._client_wrapper.httpx_client.request(
77
+ "variants/from-base",
78
+ method="POST",
79
+ json={
80
+ "base_id": base_id,
81
+ "new_variant_name": new_variant_name,
82
+ "new_config_name": new_config_name,
83
+ "parameters": parameters,
84
+ "commit_message": commit_message,
85
+ },
86
+ headers={
87
+ "content-type": "application/json",
88
+ },
89
+ request_options=request_options,
90
+ omit=OMIT,
91
+ )
92
+ try:
93
+ if 200 <= _response.status_code < 300:
94
+ _data = typing.cast(
95
+ AddVariantFromBaseAndConfigResponse,
96
+ parse_obj_as(
97
+ type_=AddVariantFromBaseAndConfigResponse, # type: ignore
98
+ object_=_response.json(),
99
+ ),
100
+ )
101
+ return HttpResponse(response=_response, data=_data)
102
+ if _response.status_code == 422:
103
+ raise UnprocessableEntityError(
104
+ headers=dict(_response.headers),
105
+ body=typing.cast(
106
+ HttpValidationError,
107
+ parse_obj_as(
108
+ type_=HttpValidationError, # type: ignore
109
+ object_=_response.json(),
110
+ ),
111
+ ),
112
+ )
113
+ _response_json = _response.json()
114
+ except JSONDecodeError:
115
+ raise ApiError(
116
+ status_code=_response.status_code,
117
+ headers=dict(_response.headers),
118
+ body=_response.text,
119
+ )
120
+ raise ApiError(
121
+ status_code=_response.status_code,
122
+ headers=dict(_response.headers),
123
+ body=_response_json,
124
+ )
125
+
126
+ def get_variant(
127
+ self,
128
+ variant_id: str,
129
+ *,
130
+ request_options: typing.Optional[RequestOptions] = None,
131
+ ) -> HttpResponse[AppVariantResponse]:
132
+ """
133
+ Parameters
134
+ ----------
135
+ variant_id : str
136
+
137
+ request_options : typing.Optional[RequestOptions]
138
+ Request-specific configuration.
139
+
140
+ Returns
141
+ -------
142
+ HttpResponse[AppVariantResponse]
143
+ Successful Response
144
+ """
145
+ _response = self._client_wrapper.httpx_client.request(
146
+ f"variants/{jsonable_encoder(variant_id)}",
147
+ method="GET",
148
+ request_options=request_options,
149
+ )
150
+ try:
151
+ if 200 <= _response.status_code < 300:
152
+ _data = typing.cast(
153
+ AppVariantResponse,
154
+ parse_obj_as(
155
+ type_=AppVariantResponse, # type: ignore
156
+ object_=_response.json(),
157
+ ),
158
+ )
159
+ return HttpResponse(response=_response, data=_data)
160
+ if _response.status_code == 422:
161
+ raise UnprocessableEntityError(
162
+ headers=dict(_response.headers),
163
+ body=typing.cast(
164
+ HttpValidationError,
165
+ parse_obj_as(
166
+ type_=HttpValidationError, # type: ignore
167
+ object_=_response.json(),
168
+ ),
169
+ ),
170
+ )
171
+ _response_json = _response.json()
172
+ except JSONDecodeError:
173
+ raise ApiError(
174
+ status_code=_response.status_code,
175
+ headers=dict(_response.headers),
176
+ body=_response.text,
177
+ )
178
+ raise ApiError(
179
+ status_code=_response.status_code,
180
+ headers=dict(_response.headers),
181
+ body=_response_json,
182
+ )
183
+
184
+ def mark_variant_as_hidden(
185
+ self,
186
+ variant_id: str,
187
+ *,
188
+ request_options: typing.Optional[RequestOptions] = None,
189
+ ) -> HttpResponse[typing.Optional[typing.Any]]:
190
+ """
191
+ Mark a variant as hidden from the UI.
192
+
193
+ Arguments:
194
+ app_variant -- AppVariant to remove
195
+
196
+ Raises:
197
+ HTTPException: If there is a problem removing the app variant
198
+
199
+ Parameters
200
+ ----------
201
+ variant_id : str
202
+
203
+ request_options : typing.Optional[RequestOptions]
204
+ Request-specific configuration.
205
+
206
+ Returns
207
+ -------
208
+ HttpResponse[typing.Optional[typing.Any]]
209
+ Successful Response
210
+ """
211
+ _response = self._client_wrapper.httpx_client.request(
212
+ f"variants/{jsonable_encoder(variant_id)}",
213
+ method="DELETE",
214
+ request_options=request_options,
215
+ )
216
+ try:
217
+ if _response is None or not _response.text.strip():
218
+ return HttpResponse(response=_response, data=None)
219
+ if 200 <= _response.status_code < 300:
220
+ _data = typing.cast(
221
+ typing.Optional[typing.Any],
222
+ parse_obj_as(
223
+ type_=typing.Optional[typing.Any], # type: ignore
224
+ object_=_response.json(),
225
+ ),
226
+ )
227
+ return HttpResponse(response=_response, data=_data)
228
+ if _response.status_code == 422:
229
+ raise UnprocessableEntityError(
230
+ headers=dict(_response.headers),
231
+ body=typing.cast(
232
+ HttpValidationError,
233
+ parse_obj_as(
234
+ type_=HttpValidationError, # type: ignore
235
+ object_=_response.json(),
236
+ ),
237
+ ),
238
+ )
239
+ _response_json = _response.json()
240
+ except JSONDecodeError:
241
+ raise ApiError(
242
+ status_code=_response.status_code,
243
+ headers=dict(_response.headers),
244
+ body=_response.text,
245
+ )
246
+ raise ApiError(
247
+ status_code=_response.status_code,
248
+ headers=dict(_response.headers),
249
+ body=_response_json,
250
+ )
251
+
252
+ def update_variant_parameters(
253
+ self,
254
+ variant_id: str,
255
+ *,
256
+ parameters: typing.Dict[str, typing.Optional[typing.Any]],
257
+ commit_message: typing.Optional[str] = OMIT,
258
+ request_options: typing.Optional[RequestOptions] = None,
259
+ ) -> HttpResponse[typing.Optional[typing.Any]]:
260
+ """
261
+ Updates the parameters for an app variant.
262
+
263
+ Args:
264
+ variant_id (str): The ID of the app variant to update.
265
+ payload (UpdateVariantParameterPayload): The payload containing the updated parameters.
266
+
267
+ Raises:
268
+ HTTPException: If there is an error while trying to update the app variant.
269
+
270
+ Returns:
271
+ JSONResponse: A JSON response containing the updated app variant parameters.
272
+
273
+ Parameters
274
+ ----------
275
+ variant_id : str
276
+
277
+ parameters : typing.Dict[str, typing.Optional[typing.Any]]
278
+
279
+ commit_message : typing.Optional[str]
280
+
281
+ request_options : typing.Optional[RequestOptions]
282
+ Request-specific configuration.
283
+
284
+ Returns
285
+ -------
286
+ HttpResponse[typing.Optional[typing.Any]]
287
+ Successful Response
288
+ """
289
+ _response = self._client_wrapper.httpx_client.request(
290
+ f"variants/{jsonable_encoder(variant_id)}/parameters",
291
+ method="PUT",
292
+ json={
293
+ "parameters": parameters,
294
+ "commit_message": commit_message,
295
+ },
296
+ headers={
297
+ "content-type": "application/json",
298
+ },
299
+ request_options=request_options,
300
+ omit=OMIT,
301
+ )
302
+ try:
303
+ if _response is None or not _response.text.strip():
304
+ return HttpResponse(response=_response, data=None)
305
+ if 200 <= _response.status_code < 300:
306
+ _data = typing.cast(
307
+ typing.Optional[typing.Any],
308
+ parse_obj_as(
309
+ type_=typing.Optional[typing.Any], # type: ignore
310
+ object_=_response.json(),
311
+ ),
312
+ )
313
+ return HttpResponse(response=_response, data=_data)
314
+ if _response.status_code == 422:
315
+ raise UnprocessableEntityError(
316
+ headers=dict(_response.headers),
317
+ body=typing.cast(
318
+ HttpValidationError,
319
+ parse_obj_as(
320
+ type_=HttpValidationError, # type: ignore
321
+ object_=_response.json(),
322
+ ),
323
+ ),
324
+ )
325
+ _response_json = _response.json()
326
+ except JSONDecodeError:
327
+ raise ApiError(
328
+ status_code=_response.status_code,
329
+ headers=dict(_response.headers),
330
+ body=_response.text,
331
+ )
332
+ raise ApiError(
333
+ status_code=_response.status_code,
334
+ headers=dict(_response.headers),
335
+ body=_response_json,
336
+ )
337
+
338
+ def update_variant_url(
339
+ self,
340
+ variant_id: str,
341
+ *,
342
+ url: str,
343
+ update_variant_url_payload_variant_id: str,
344
+ commit_message: typing.Optional[str] = OMIT,
345
+ request_options: typing.Optional[RequestOptions] = None,
346
+ ) -> HttpResponse[typing.Optional[typing.Any]]:
347
+ """
348
+ Updates the URL used in an app variant.
349
+
350
+ Args:
351
+ variant_id (str): The ID of the app variant to update.
352
+ url (str): The URL to update.
353
+
354
+ Raises:
355
+ HTTPException: If an error occurs while trying to update the app variant.
356
+
357
+ Returns:
358
+ JSONResponse: A JSON response indicating whether the update was successful or not.
359
+
360
+ Parameters
361
+ ----------
362
+ variant_id : str
363
+
364
+ url : str
365
+
366
+ update_variant_url_payload_variant_id : str
367
+
368
+ commit_message : typing.Optional[str]
369
+
370
+ request_options : typing.Optional[RequestOptions]
371
+ Request-specific configuration.
372
+
373
+ Returns
374
+ -------
375
+ HttpResponse[typing.Optional[typing.Any]]
376
+ Successful Response
377
+ """
378
+ _response = self._client_wrapper.httpx_client.request(
379
+ f"variants/{jsonable_encoder(variant_id)}/service",
380
+ method="PUT",
381
+ json={
382
+ "url": url,
383
+ "variant_id": update_variant_url_payload_variant_id,
384
+ "commit_message": commit_message,
385
+ },
386
+ headers={
387
+ "content-type": "application/json",
388
+ },
389
+ request_options=request_options,
390
+ omit=OMIT,
391
+ )
392
+ try:
393
+ if _response is None or not _response.text.strip():
394
+ return HttpResponse(response=_response, data=None)
395
+ if 200 <= _response.status_code < 300:
396
+ _data = typing.cast(
397
+ typing.Optional[typing.Any],
398
+ parse_obj_as(
399
+ type_=typing.Optional[typing.Any], # type: ignore
400
+ object_=_response.json(),
401
+ ),
402
+ )
403
+ return HttpResponse(response=_response, data=_data)
404
+ if _response.status_code == 422:
405
+ raise UnprocessableEntityError(
406
+ headers=dict(_response.headers),
407
+ body=typing.cast(
408
+ HttpValidationError,
409
+ parse_obj_as(
410
+ type_=HttpValidationError, # type: ignore
411
+ object_=_response.json(),
412
+ ),
413
+ ),
414
+ )
415
+ _response_json = _response.json()
416
+ except JSONDecodeError:
417
+ raise ApiError(
418
+ status_code=_response.status_code,
419
+ headers=dict(_response.headers),
420
+ body=_response.text,
421
+ )
422
+ raise ApiError(
423
+ status_code=_response.status_code,
424
+ headers=dict(_response.headers),
425
+ body=_response_json,
426
+ )
427
+
428
+ def get_variant_revisions(
429
+ self,
430
+ variant_id: str,
431
+ *,
432
+ request_options: typing.Optional[RequestOptions] = None,
433
+ ) -> HttpResponse[typing.List[AppVariantRevision]]:
434
+ """
435
+ Parameters
436
+ ----------
437
+ variant_id : str
438
+
439
+ request_options : typing.Optional[RequestOptions]
440
+ Request-specific configuration.
441
+
442
+ Returns
443
+ -------
444
+ HttpResponse[typing.List[AppVariantRevision]]
445
+ Successful Response
446
+ """
447
+ _response = self._client_wrapper.httpx_client.request(
448
+ f"variants/{jsonable_encoder(variant_id)}/revisions",
449
+ method="GET",
450
+ request_options=request_options,
451
+ )
452
+ try:
453
+ if 200 <= _response.status_code < 300:
454
+ _data = typing.cast(
455
+ typing.List[AppVariantRevision],
456
+ parse_obj_as(
457
+ type_=typing.List[AppVariantRevision], # type: ignore
458
+ object_=_response.json(),
459
+ ),
460
+ )
461
+ return HttpResponse(response=_response, data=_data)
462
+ if _response.status_code == 422:
463
+ raise UnprocessableEntityError(
464
+ headers=dict(_response.headers),
465
+ body=typing.cast(
466
+ HttpValidationError,
467
+ parse_obj_as(
468
+ type_=HttpValidationError, # type: ignore
469
+ object_=_response.json(),
470
+ ),
471
+ ),
472
+ )
473
+ _response_json = _response.json()
474
+ except JSONDecodeError:
475
+ raise ApiError(
476
+ status_code=_response.status_code,
477
+ headers=dict(_response.headers),
478
+ body=_response.text,
479
+ )
480
+ raise ApiError(
481
+ status_code=_response.status_code,
482
+ headers=dict(_response.headers),
483
+ body=_response_json,
484
+ )
485
+
486
+ def get_variant_revision(
487
+ self,
488
+ variant_id: str,
489
+ revision_number: int,
490
+ *,
491
+ request_options: typing.Optional[RequestOptions] = None,
492
+ ) -> HttpResponse[AppVariantRevision]:
493
+ """
494
+ Parameters
495
+ ----------
496
+ variant_id : str
497
+
498
+ revision_number : int
499
+
500
+ request_options : typing.Optional[RequestOptions]
501
+ Request-specific configuration.
502
+
503
+ Returns
504
+ -------
505
+ HttpResponse[AppVariantRevision]
506
+ Successful Response
507
+ """
508
+ _response = self._client_wrapper.httpx_client.request(
509
+ f"variants/{jsonable_encoder(variant_id)}/revisions/{jsonable_encoder(revision_number)}",
510
+ method="GET",
511
+ request_options=request_options,
512
+ )
513
+ try:
514
+ if 200 <= _response.status_code < 300:
515
+ _data = typing.cast(
516
+ AppVariantRevision,
517
+ parse_obj_as(
518
+ type_=AppVariantRevision, # type: ignore
519
+ object_=_response.json(),
520
+ ),
521
+ )
522
+ return HttpResponse(response=_response, data=_data)
523
+ if _response.status_code == 422:
524
+ raise UnprocessableEntityError(
525
+ headers=dict(_response.headers),
526
+ body=typing.cast(
527
+ HttpValidationError,
528
+ parse_obj_as(
529
+ type_=HttpValidationError, # type: ignore
530
+ object_=_response.json(),
531
+ ),
532
+ ),
533
+ )
534
+ _response_json = _response.json()
535
+ except JSONDecodeError:
536
+ raise ApiError(
537
+ status_code=_response.status_code,
538
+ headers=dict(_response.headers),
539
+ body=_response.text,
540
+ )
541
+ raise ApiError(
542
+ status_code=_response.status_code,
543
+ headers=dict(_response.headers),
544
+ body=_response_json,
545
+ )
546
+
547
+ def mark_variant_revision_as_hidden(
548
+ self,
549
+ variant_id: str,
550
+ revision_id: str,
551
+ *,
552
+ request_options: typing.Optional[RequestOptions] = None,
553
+ ) -> HttpResponse[typing.Optional[typing.Any]]:
554
+ """
555
+ Mark a variant revision as hidden from the UI.
556
+
557
+ Arguments:
558
+ app_variant -- AppVariant to remove
559
+ revision_id -- Revision ID to remove
560
+
561
+ Raises:
562
+ HTTPException: If there is a problem removing the app variant
563
+
564
+ Parameters
565
+ ----------
566
+ variant_id : str
567
+
568
+ revision_id : str
569
+
570
+ request_options : typing.Optional[RequestOptions]
571
+ Request-specific configuration.
572
+
573
+ Returns
574
+ -------
575
+ HttpResponse[typing.Optional[typing.Any]]
576
+ Successful Response
577
+ """
578
+ _response = self._client_wrapper.httpx_client.request(
579
+ f"variants/{jsonable_encoder(variant_id)}/revisions/{jsonable_encoder(revision_id)}",
580
+ method="DELETE",
581
+ request_options=request_options,
582
+ )
583
+ try:
584
+ if _response is None or not _response.text.strip():
585
+ return HttpResponse(response=_response, data=None)
586
+ if 200 <= _response.status_code < 300:
587
+ _data = typing.cast(
588
+ typing.Optional[typing.Any],
589
+ parse_obj_as(
590
+ type_=typing.Optional[typing.Any], # type: ignore
591
+ object_=_response.json(),
592
+ ),
593
+ )
594
+ return HttpResponse(response=_response, data=_data)
595
+ if _response.status_code == 422:
596
+ raise UnprocessableEntityError(
597
+ headers=dict(_response.headers),
598
+ body=typing.cast(
599
+ HttpValidationError,
600
+ parse_obj_as(
601
+ type_=HttpValidationError, # type: ignore
602
+ object_=_response.json(),
603
+ ),
604
+ ),
605
+ )
606
+ _response_json = _response.json()
607
+ except JSONDecodeError:
608
+ raise ApiError(
609
+ status_code=_response.status_code,
610
+ headers=dict(_response.headers),
611
+ body=_response.text,
612
+ )
613
+ raise ApiError(
614
+ status_code=_response.status_code,
615
+ headers=dict(_response.headers),
616
+ body=_response_json,
617
+ )
618
+
619
+ def configs_add(
620
+ self,
621
+ *,
622
+ variant_ref: ReferenceRequestModel,
623
+ application_ref: ReferenceRequestModel,
624
+ request_options: typing.Optional[RequestOptions] = None,
625
+ ) -> HttpResponse[ConfigResponseModel]:
626
+ """
627
+ Parameters
628
+ ----------
629
+ variant_ref : ReferenceRequestModel
630
+
631
+ application_ref : ReferenceRequestModel
632
+
633
+ request_options : typing.Optional[RequestOptions]
634
+ Request-specific configuration.
635
+
636
+ Returns
637
+ -------
638
+ HttpResponse[ConfigResponseModel]
639
+ Successful Response
640
+ """
641
+ _response = self._client_wrapper.httpx_client.request(
642
+ "variants/configs/add",
643
+ method="POST",
644
+ json={
645
+ "variant_ref": convert_and_respect_annotation_metadata(
646
+ object_=variant_ref,
647
+ annotation=ReferenceRequestModel,
648
+ direction="write",
649
+ ),
650
+ "application_ref": convert_and_respect_annotation_metadata(
651
+ object_=application_ref,
652
+ annotation=ReferenceRequestModel,
653
+ direction="write",
654
+ ),
655
+ },
656
+ headers={
657
+ "content-type": "application/json",
658
+ },
659
+ request_options=request_options,
660
+ omit=OMIT,
661
+ )
662
+ try:
663
+ if 200 <= _response.status_code < 300:
664
+ _data = typing.cast(
665
+ ConfigResponseModel,
666
+ parse_obj_as(
667
+ type_=ConfigResponseModel, # type: ignore
668
+ object_=_response.json(),
669
+ ),
670
+ )
671
+ return HttpResponse(response=_response, data=_data)
672
+ if _response.status_code == 422:
673
+ raise UnprocessableEntityError(
674
+ headers=dict(_response.headers),
675
+ body=typing.cast(
676
+ HttpValidationError,
677
+ parse_obj_as(
678
+ type_=HttpValidationError, # type: ignore
679
+ object_=_response.json(),
680
+ ),
681
+ ),
682
+ )
683
+ _response_json = _response.json()
684
+ except JSONDecodeError:
685
+ raise ApiError(
686
+ status_code=_response.status_code,
687
+ headers=dict(_response.headers),
688
+ body=_response.text,
689
+ )
690
+ raise ApiError(
691
+ status_code=_response.status_code,
692
+ headers=dict(_response.headers),
693
+ body=_response_json,
694
+ )
695
+
696
+ def configs_fetch(
697
+ self,
698
+ *,
699
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
700
+ environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
701
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
702
+ request_options: typing.Optional[RequestOptions] = None,
703
+ ) -> HttpResponse[ConfigResponseModel]:
704
+ """
705
+ Fetch configuration for a variant or environment.
706
+
707
+ Either variant_ref OR environment_ref must be provided (if neither is provided,
708
+ a default environment_ref with slug="production" will be used).
709
+
710
+ For each reference object (variant_ref, environment_ref, application_ref):
711
+ - Provide either 'slug' or 'id' field
712
+ - 'version' is optional and can be set to null
713
+ - If 'id' is provided, it will be used directly to fetch the resource
714
+ - Otherwise, 'slug' will be used along with application_ref
715
+
716
+ Returns:
717
+ ConfigResponseModel: The configuration for the requested variant or environment.
718
+
719
+ Raises:
720
+ HTTPException: If the configuration is not found.
721
+
722
+ Parameters
723
+ ----------
724
+ variant_ref : typing.Optional[ReferenceRequestModel]
725
+
726
+ environment_ref : typing.Optional[ReferenceRequestModel]
727
+
728
+ application_ref : typing.Optional[ReferenceRequestModel]
729
+
730
+ request_options : typing.Optional[RequestOptions]
731
+ Request-specific configuration.
732
+
733
+ Returns
734
+ -------
735
+ HttpResponse[ConfigResponseModel]
736
+ Successful Response
737
+ """
738
+ _response = self._client_wrapper.httpx_client.request(
739
+ "variants/configs/fetch",
740
+ method="POST",
741
+ json={
742
+ "variant_ref": convert_and_respect_annotation_metadata(
743
+ object_=variant_ref,
744
+ annotation=ReferenceRequestModel,
745
+ direction="write",
746
+ ),
747
+ "environment_ref": convert_and_respect_annotation_metadata(
748
+ object_=environment_ref,
749
+ annotation=ReferenceRequestModel,
750
+ direction="write",
751
+ ),
752
+ "application_ref": convert_and_respect_annotation_metadata(
753
+ object_=application_ref,
754
+ annotation=ReferenceRequestModel,
755
+ direction="write",
756
+ ),
757
+ },
758
+ headers={
759
+ "content-type": "application/json",
760
+ },
761
+ request_options=request_options,
762
+ omit=OMIT,
763
+ )
764
+ try:
765
+ if 200 <= _response.status_code < 300:
766
+ _data = typing.cast(
767
+ ConfigResponseModel,
768
+ parse_obj_as(
769
+ type_=ConfigResponseModel, # type: ignore
770
+ object_=_response.json(),
771
+ ),
772
+ )
773
+ return HttpResponse(response=_response, data=_data)
774
+ if _response.status_code == 422:
775
+ raise UnprocessableEntityError(
776
+ headers=dict(_response.headers),
777
+ body=typing.cast(
778
+ HttpValidationError,
779
+ parse_obj_as(
780
+ type_=HttpValidationError, # type: ignore
781
+ object_=_response.json(),
782
+ ),
783
+ ),
784
+ )
785
+ _response_json = _response.json()
786
+ except JSONDecodeError:
787
+ raise ApiError(
788
+ status_code=_response.status_code,
789
+ headers=dict(_response.headers),
790
+ body=_response.text,
791
+ )
792
+ raise ApiError(
793
+ status_code=_response.status_code,
794
+ headers=dict(_response.headers),
795
+ body=_response_json,
796
+ )
797
+
798
+ def configs_fork(
799
+ self,
800
+ *,
801
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
802
+ environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
803
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
804
+ request_options: typing.Optional[RequestOptions] = None,
805
+ ) -> HttpResponse[ConfigResponseModel]:
806
+ """
807
+ Parameters
808
+ ----------
809
+ variant_ref : typing.Optional[ReferenceRequestModel]
810
+
811
+ environment_ref : typing.Optional[ReferenceRequestModel]
812
+
813
+ application_ref : typing.Optional[ReferenceRequestModel]
814
+
815
+ request_options : typing.Optional[RequestOptions]
816
+ Request-specific configuration.
817
+
818
+ Returns
819
+ -------
820
+ HttpResponse[ConfigResponseModel]
821
+ Successful Response
822
+ """
823
+ _response = self._client_wrapper.httpx_client.request(
824
+ "variants/configs/fork",
825
+ method="POST",
826
+ json={
827
+ "variant_ref": convert_and_respect_annotation_metadata(
828
+ object_=variant_ref,
829
+ annotation=ReferenceRequestModel,
830
+ direction="write",
831
+ ),
832
+ "environment_ref": convert_and_respect_annotation_metadata(
833
+ object_=environment_ref,
834
+ annotation=ReferenceRequestModel,
835
+ direction="write",
836
+ ),
837
+ "application_ref": convert_and_respect_annotation_metadata(
838
+ object_=application_ref,
839
+ annotation=ReferenceRequestModel,
840
+ direction="write",
841
+ ),
842
+ },
843
+ headers={
844
+ "content-type": "application/json",
845
+ },
846
+ request_options=request_options,
847
+ omit=OMIT,
848
+ )
849
+ try:
850
+ if 200 <= _response.status_code < 300:
851
+ _data = typing.cast(
852
+ ConfigResponseModel,
853
+ parse_obj_as(
854
+ type_=ConfigResponseModel, # type: ignore
855
+ object_=_response.json(),
856
+ ),
857
+ )
858
+ return HttpResponse(response=_response, data=_data)
859
+ if _response.status_code == 422:
860
+ raise UnprocessableEntityError(
861
+ headers=dict(_response.headers),
862
+ body=typing.cast(
863
+ HttpValidationError,
864
+ parse_obj_as(
865
+ type_=HttpValidationError, # type: ignore
866
+ object_=_response.json(),
867
+ ),
868
+ ),
869
+ )
870
+ _response_json = _response.json()
871
+ except JSONDecodeError:
872
+ raise ApiError(
873
+ status_code=_response.status_code,
874
+ headers=dict(_response.headers),
875
+ body=_response.text,
876
+ )
877
+ raise ApiError(
878
+ status_code=_response.status_code,
879
+ headers=dict(_response.headers),
880
+ body=_response_json,
881
+ )
882
+
883
+ def configs_commit(
884
+ self,
885
+ *,
886
+ config: ConfigDto,
887
+ request_options: typing.Optional[RequestOptions] = None,
888
+ ) -> HttpResponse[ConfigResponseModel]:
889
+ """
890
+ Parameters
891
+ ----------
892
+ config : ConfigDto
893
+
894
+ request_options : typing.Optional[RequestOptions]
895
+ Request-specific configuration.
896
+
897
+ Returns
898
+ -------
899
+ HttpResponse[ConfigResponseModel]
900
+ Successful Response
901
+ """
902
+ _response = self._client_wrapper.httpx_client.request(
903
+ "variants/configs/commit",
904
+ method="POST",
905
+ json={
906
+ "config": convert_and_respect_annotation_metadata(
907
+ object_=config, annotation=ConfigDto, direction="write"
908
+ ),
909
+ },
910
+ headers={
911
+ "content-type": "application/json",
912
+ },
913
+ request_options=request_options,
914
+ omit=OMIT,
915
+ )
916
+ try:
917
+ if 200 <= _response.status_code < 300:
918
+ _data = typing.cast(
919
+ ConfigResponseModel,
920
+ parse_obj_as(
921
+ type_=ConfigResponseModel, # type: ignore
922
+ object_=_response.json(),
923
+ ),
924
+ )
925
+ return HttpResponse(response=_response, data=_data)
926
+ if _response.status_code == 422:
927
+ raise UnprocessableEntityError(
928
+ headers=dict(_response.headers),
929
+ body=typing.cast(
930
+ HttpValidationError,
931
+ parse_obj_as(
932
+ type_=HttpValidationError, # type: ignore
933
+ object_=_response.json(),
934
+ ),
935
+ ),
936
+ )
937
+ _response_json = _response.json()
938
+ except JSONDecodeError:
939
+ raise ApiError(
940
+ status_code=_response.status_code,
941
+ headers=dict(_response.headers),
942
+ body=_response.text,
943
+ )
944
+ raise ApiError(
945
+ status_code=_response.status_code,
946
+ headers=dict(_response.headers),
947
+ body=_response_json,
948
+ )
949
+
950
+ def configs_deploy(
951
+ self,
952
+ *,
953
+ variant_ref: ReferenceRequestModel,
954
+ environment_ref: ReferenceRequestModel,
955
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
956
+ request_options: typing.Optional[RequestOptions] = None,
957
+ ) -> HttpResponse[ConfigResponseModel]:
958
+ """
959
+ Parameters
960
+ ----------
961
+ variant_ref : ReferenceRequestModel
962
+
963
+ environment_ref : ReferenceRequestModel
964
+
965
+ application_ref : typing.Optional[ReferenceRequestModel]
966
+
967
+ request_options : typing.Optional[RequestOptions]
968
+ Request-specific configuration.
969
+
970
+ Returns
971
+ -------
972
+ HttpResponse[ConfigResponseModel]
973
+ Successful Response
974
+ """
975
+ _response = self._client_wrapper.httpx_client.request(
976
+ "variants/configs/deploy",
977
+ method="POST",
978
+ json={
979
+ "variant_ref": convert_and_respect_annotation_metadata(
980
+ object_=variant_ref,
981
+ annotation=ReferenceRequestModel,
982
+ direction="write",
983
+ ),
984
+ "environment_ref": convert_and_respect_annotation_metadata(
985
+ object_=environment_ref,
986
+ annotation=ReferenceRequestModel,
987
+ direction="write",
988
+ ),
989
+ "application_ref": convert_and_respect_annotation_metadata(
990
+ object_=application_ref,
991
+ annotation=ReferenceRequestModel,
992
+ direction="write",
993
+ ),
994
+ },
995
+ headers={
996
+ "content-type": "application/json",
997
+ },
998
+ request_options=request_options,
999
+ omit=OMIT,
1000
+ )
1001
+ try:
1002
+ if 200 <= _response.status_code < 300:
1003
+ _data = typing.cast(
1004
+ ConfigResponseModel,
1005
+ parse_obj_as(
1006
+ type_=ConfigResponseModel, # type: ignore
1007
+ object_=_response.json(),
1008
+ ),
1009
+ )
1010
+ return HttpResponse(response=_response, data=_data)
1011
+ if _response.status_code == 422:
1012
+ raise UnprocessableEntityError(
1013
+ headers=dict(_response.headers),
1014
+ body=typing.cast(
1015
+ HttpValidationError,
1016
+ parse_obj_as(
1017
+ type_=HttpValidationError, # type: ignore
1018
+ object_=_response.json(),
1019
+ ),
1020
+ ),
1021
+ )
1022
+ _response_json = _response.json()
1023
+ except JSONDecodeError:
1024
+ raise ApiError(
1025
+ status_code=_response.status_code,
1026
+ headers=dict(_response.headers),
1027
+ body=_response.text,
1028
+ )
1029
+ raise ApiError(
1030
+ status_code=_response.status_code,
1031
+ headers=dict(_response.headers),
1032
+ body=_response_json,
1033
+ )
1034
+
1035
+ def configs_delete(
1036
+ self,
1037
+ *,
1038
+ variant_ref: ReferenceRequestModel,
1039
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1040
+ request_options: typing.Optional[RequestOptions] = None,
1041
+ ) -> HttpResponse[int]:
1042
+ """
1043
+ Parameters
1044
+ ----------
1045
+ variant_ref : ReferenceRequestModel
1046
+
1047
+ application_ref : typing.Optional[ReferenceRequestModel]
1048
+
1049
+ request_options : typing.Optional[RequestOptions]
1050
+ Request-specific configuration.
1051
+
1052
+ Returns
1053
+ -------
1054
+ HttpResponse[int]
1055
+ Successful Response
1056
+ """
1057
+ _response = self._client_wrapper.httpx_client.request(
1058
+ "variants/configs/delete",
1059
+ method="POST",
1060
+ json={
1061
+ "variant_ref": convert_and_respect_annotation_metadata(
1062
+ object_=variant_ref,
1063
+ annotation=ReferenceRequestModel,
1064
+ direction="write",
1065
+ ),
1066
+ "application_ref": convert_and_respect_annotation_metadata(
1067
+ object_=application_ref,
1068
+ annotation=ReferenceRequestModel,
1069
+ direction="write",
1070
+ ),
1071
+ },
1072
+ headers={
1073
+ "content-type": "application/json",
1074
+ },
1075
+ request_options=request_options,
1076
+ omit=OMIT,
1077
+ )
1078
+ try:
1079
+ if 200 <= _response.status_code < 300:
1080
+ _data = typing.cast(
1081
+ int,
1082
+ parse_obj_as(
1083
+ type_=int, # type: ignore
1084
+ object_=_response.json(),
1085
+ ),
1086
+ )
1087
+ return HttpResponse(response=_response, data=_data)
1088
+ if _response.status_code == 422:
1089
+ raise UnprocessableEntityError(
1090
+ headers=dict(_response.headers),
1091
+ body=typing.cast(
1092
+ HttpValidationError,
1093
+ parse_obj_as(
1094
+ type_=HttpValidationError, # type: ignore
1095
+ object_=_response.json(),
1096
+ ),
1097
+ ),
1098
+ )
1099
+ _response_json = _response.json()
1100
+ except JSONDecodeError:
1101
+ raise ApiError(
1102
+ status_code=_response.status_code,
1103
+ headers=dict(_response.headers),
1104
+ body=_response.text,
1105
+ )
1106
+ raise ApiError(
1107
+ status_code=_response.status_code,
1108
+ headers=dict(_response.headers),
1109
+ body=_response_json,
1110
+ )
1111
+
1112
+ def configs_list(
1113
+ self,
1114
+ *,
1115
+ application_ref: ReferenceDto,
1116
+ request_options: typing.Optional[RequestOptions] = None,
1117
+ ) -> HttpResponse[typing.List[ConfigResponseModel]]:
1118
+ """
1119
+ Parameters
1120
+ ----------
1121
+ application_ref : ReferenceDto
1122
+
1123
+ request_options : typing.Optional[RequestOptions]
1124
+ Request-specific configuration.
1125
+
1126
+ Returns
1127
+ -------
1128
+ HttpResponse[typing.List[ConfigResponseModel]]
1129
+ Successful Response
1130
+ """
1131
+ _response = self._client_wrapper.httpx_client.request(
1132
+ "variants/configs/list",
1133
+ method="POST",
1134
+ json={
1135
+ "application_ref": convert_and_respect_annotation_metadata(
1136
+ object_=application_ref, annotation=ReferenceDto, direction="write"
1137
+ ),
1138
+ },
1139
+ headers={
1140
+ "content-type": "application/json",
1141
+ },
1142
+ request_options=request_options,
1143
+ omit=OMIT,
1144
+ )
1145
+ try:
1146
+ if 200 <= _response.status_code < 300:
1147
+ _data = typing.cast(
1148
+ typing.List[ConfigResponseModel],
1149
+ parse_obj_as(
1150
+ type_=typing.List[ConfigResponseModel], # type: ignore
1151
+ object_=_response.json(),
1152
+ ),
1153
+ )
1154
+ return HttpResponse(response=_response, data=_data)
1155
+ if _response.status_code == 422:
1156
+ raise UnprocessableEntityError(
1157
+ headers=dict(_response.headers),
1158
+ body=typing.cast(
1159
+ HttpValidationError,
1160
+ parse_obj_as(
1161
+ type_=HttpValidationError, # type: ignore
1162
+ object_=_response.json(),
1163
+ ),
1164
+ ),
1165
+ )
1166
+ _response_json = _response.json()
1167
+ except JSONDecodeError:
1168
+ raise ApiError(
1169
+ status_code=_response.status_code,
1170
+ headers=dict(_response.headers),
1171
+ body=_response.text,
1172
+ )
1173
+ raise ApiError(
1174
+ status_code=_response.status_code,
1175
+ headers=dict(_response.headers),
1176
+ body=_response_json,
1177
+ )
1178
+
1179
+ def configs_history(
1180
+ self,
1181
+ *,
1182
+ variant_ref: ReferenceRequestModel,
1183
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1184
+ request_options: typing.Optional[RequestOptions] = None,
1185
+ ) -> HttpResponse[typing.List[ConfigResponseModel]]:
1186
+ """
1187
+ Parameters
1188
+ ----------
1189
+ variant_ref : ReferenceRequestModel
1190
+
1191
+ application_ref : typing.Optional[ReferenceRequestModel]
1192
+
1193
+ request_options : typing.Optional[RequestOptions]
1194
+ Request-specific configuration.
1195
+
1196
+ Returns
1197
+ -------
1198
+ HttpResponse[typing.List[ConfigResponseModel]]
1199
+ Successful Response
1200
+ """
1201
+ _response = self._client_wrapper.httpx_client.request(
1202
+ "variants/configs/history",
1203
+ method="POST",
1204
+ json={
1205
+ "variant_ref": convert_and_respect_annotation_metadata(
1206
+ object_=variant_ref,
1207
+ annotation=ReferenceRequestModel,
1208
+ direction="write",
1209
+ ),
1210
+ "application_ref": convert_and_respect_annotation_metadata(
1211
+ object_=application_ref,
1212
+ annotation=ReferenceRequestModel,
1213
+ direction="write",
1214
+ ),
1215
+ },
1216
+ headers={
1217
+ "content-type": "application/json",
1218
+ },
1219
+ request_options=request_options,
1220
+ omit=OMIT,
1221
+ )
1222
+ try:
1223
+ if 200 <= _response.status_code < 300:
1224
+ _data = typing.cast(
1225
+ typing.List[ConfigResponseModel],
1226
+ parse_obj_as(
1227
+ type_=typing.List[ConfigResponseModel], # type: ignore
1228
+ object_=_response.json(),
1229
+ ),
1230
+ )
1231
+ return HttpResponse(response=_response, data=_data)
1232
+ if _response.status_code == 422:
1233
+ raise UnprocessableEntityError(
1234
+ headers=dict(_response.headers),
1235
+ body=typing.cast(
1236
+ HttpValidationError,
1237
+ parse_obj_as(
1238
+ type_=HttpValidationError, # type: ignore
1239
+ object_=_response.json(),
1240
+ ),
1241
+ ),
1242
+ )
1243
+ _response_json = _response.json()
1244
+ except JSONDecodeError:
1245
+ raise ApiError(
1246
+ status_code=_response.status_code,
1247
+ headers=dict(_response.headers),
1248
+ body=_response.text,
1249
+ )
1250
+ raise ApiError(
1251
+ status_code=_response.status_code,
1252
+ headers=dict(_response.headers),
1253
+ body=_response_json,
1254
+ )
1255
+
1256
+
1257
+ class AsyncRawVariantsClient:
1258
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
1259
+ self._client_wrapper = client_wrapper
1260
+
1261
+ async def add_variant_from_base_and_config(
1262
+ self,
1263
+ *,
1264
+ base_id: str,
1265
+ new_variant_name: str,
1266
+ new_config_name: str,
1267
+ parameters: typing.Dict[str, typing.Optional[typing.Any]],
1268
+ commit_message: typing.Optional[str] = OMIT,
1269
+ request_options: typing.Optional[RequestOptions] = None,
1270
+ ) -> AsyncHttpResponse[AddVariantFromBaseAndConfigResponse]:
1271
+ """
1272
+ Add a new variant based on an existing one.
1273
+ Same as POST /config
1274
+
1275
+ Args:
1276
+ payload (AddVariantFromBasePayload): Payload containing base variant ID, new variant name, and parameters.
1277
+
1278
+ Raises:
1279
+ HTTPException: Raised if the variant could not be added or accessed.
1280
+
1281
+ Returns:
1282
+ Union[AppVariantResponse, Any]: New variant details or exception.
1283
+
1284
+ Parameters
1285
+ ----------
1286
+ base_id : str
1287
+
1288
+ new_variant_name : str
1289
+
1290
+ new_config_name : str
1291
+
1292
+ parameters : typing.Dict[str, typing.Optional[typing.Any]]
1293
+
1294
+ commit_message : typing.Optional[str]
1295
+
1296
+ request_options : typing.Optional[RequestOptions]
1297
+ Request-specific configuration.
1298
+
1299
+ Returns
1300
+ -------
1301
+ AsyncHttpResponse[AddVariantFromBaseAndConfigResponse]
1302
+ Successful Response
1303
+ """
1304
+ _response = await self._client_wrapper.httpx_client.request(
1305
+ "variants/from-base",
1306
+ method="POST",
1307
+ json={
1308
+ "base_id": base_id,
1309
+ "new_variant_name": new_variant_name,
1310
+ "new_config_name": new_config_name,
1311
+ "parameters": parameters,
1312
+ "commit_message": commit_message,
1313
+ },
1314
+ headers={
1315
+ "content-type": "application/json",
1316
+ },
1317
+ request_options=request_options,
1318
+ omit=OMIT,
1319
+ )
1320
+ try:
1321
+ if 200 <= _response.status_code < 300:
1322
+ _data = typing.cast(
1323
+ AddVariantFromBaseAndConfigResponse,
1324
+ parse_obj_as(
1325
+ type_=AddVariantFromBaseAndConfigResponse, # type: ignore
1326
+ object_=_response.json(),
1327
+ ),
1328
+ )
1329
+ return AsyncHttpResponse(response=_response, data=_data)
1330
+ if _response.status_code == 422:
1331
+ raise UnprocessableEntityError(
1332
+ headers=dict(_response.headers),
1333
+ body=typing.cast(
1334
+ HttpValidationError,
1335
+ parse_obj_as(
1336
+ type_=HttpValidationError, # type: ignore
1337
+ object_=_response.json(),
1338
+ ),
1339
+ ),
1340
+ )
1341
+ _response_json = _response.json()
1342
+ except JSONDecodeError:
1343
+ raise ApiError(
1344
+ status_code=_response.status_code,
1345
+ headers=dict(_response.headers),
1346
+ body=_response.text,
1347
+ )
1348
+ raise ApiError(
1349
+ status_code=_response.status_code,
1350
+ headers=dict(_response.headers),
1351
+ body=_response_json,
1352
+ )
1353
+
1354
+ async def get_variant(
1355
+ self,
1356
+ variant_id: str,
1357
+ *,
1358
+ request_options: typing.Optional[RequestOptions] = None,
1359
+ ) -> AsyncHttpResponse[AppVariantResponse]:
1360
+ """
1361
+ Parameters
1362
+ ----------
1363
+ variant_id : str
1364
+
1365
+ request_options : typing.Optional[RequestOptions]
1366
+ Request-specific configuration.
1367
+
1368
+ Returns
1369
+ -------
1370
+ AsyncHttpResponse[AppVariantResponse]
1371
+ Successful Response
1372
+ """
1373
+ _response = await self._client_wrapper.httpx_client.request(
1374
+ f"variants/{jsonable_encoder(variant_id)}",
1375
+ method="GET",
1376
+ request_options=request_options,
1377
+ )
1378
+ try:
1379
+ if 200 <= _response.status_code < 300:
1380
+ _data = typing.cast(
1381
+ AppVariantResponse,
1382
+ parse_obj_as(
1383
+ type_=AppVariantResponse, # type: ignore
1384
+ object_=_response.json(),
1385
+ ),
1386
+ )
1387
+ return AsyncHttpResponse(response=_response, data=_data)
1388
+ if _response.status_code == 422:
1389
+ raise UnprocessableEntityError(
1390
+ headers=dict(_response.headers),
1391
+ body=typing.cast(
1392
+ HttpValidationError,
1393
+ parse_obj_as(
1394
+ type_=HttpValidationError, # type: ignore
1395
+ object_=_response.json(),
1396
+ ),
1397
+ ),
1398
+ )
1399
+ _response_json = _response.json()
1400
+ except JSONDecodeError:
1401
+ raise ApiError(
1402
+ status_code=_response.status_code,
1403
+ headers=dict(_response.headers),
1404
+ body=_response.text,
1405
+ )
1406
+ raise ApiError(
1407
+ status_code=_response.status_code,
1408
+ headers=dict(_response.headers),
1409
+ body=_response_json,
1410
+ )
1411
+
1412
+ async def mark_variant_as_hidden(
1413
+ self,
1414
+ variant_id: str,
1415
+ *,
1416
+ request_options: typing.Optional[RequestOptions] = None,
1417
+ ) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
1418
+ """
1419
+ Mark a variant as hidden from the UI.
1420
+
1421
+ Arguments:
1422
+ app_variant -- AppVariant to remove
1423
+
1424
+ Raises:
1425
+ HTTPException: If there is a problem removing the app variant
1426
+
1427
+ Parameters
1428
+ ----------
1429
+ variant_id : str
1430
+
1431
+ request_options : typing.Optional[RequestOptions]
1432
+ Request-specific configuration.
1433
+
1434
+ Returns
1435
+ -------
1436
+ AsyncHttpResponse[typing.Optional[typing.Any]]
1437
+ Successful Response
1438
+ """
1439
+ _response = await self._client_wrapper.httpx_client.request(
1440
+ f"variants/{jsonable_encoder(variant_id)}",
1441
+ method="DELETE",
1442
+ request_options=request_options,
1443
+ )
1444
+ try:
1445
+ if _response is None or not _response.text.strip():
1446
+ return AsyncHttpResponse(response=_response, data=None)
1447
+ if 200 <= _response.status_code < 300:
1448
+ _data = typing.cast(
1449
+ typing.Optional[typing.Any],
1450
+ parse_obj_as(
1451
+ type_=typing.Optional[typing.Any], # type: ignore
1452
+ object_=_response.json(),
1453
+ ),
1454
+ )
1455
+ return AsyncHttpResponse(response=_response, data=_data)
1456
+ if _response.status_code == 422:
1457
+ raise UnprocessableEntityError(
1458
+ headers=dict(_response.headers),
1459
+ body=typing.cast(
1460
+ HttpValidationError,
1461
+ parse_obj_as(
1462
+ type_=HttpValidationError, # type: ignore
1463
+ object_=_response.json(),
1464
+ ),
1465
+ ),
1466
+ )
1467
+ _response_json = _response.json()
1468
+ except JSONDecodeError:
1469
+ raise ApiError(
1470
+ status_code=_response.status_code,
1471
+ headers=dict(_response.headers),
1472
+ body=_response.text,
1473
+ )
1474
+ raise ApiError(
1475
+ status_code=_response.status_code,
1476
+ headers=dict(_response.headers),
1477
+ body=_response_json,
1478
+ )
1479
+
1480
+ async def update_variant_parameters(
1481
+ self,
1482
+ variant_id: str,
1483
+ *,
1484
+ parameters: typing.Dict[str, typing.Optional[typing.Any]],
1485
+ commit_message: typing.Optional[str] = OMIT,
1486
+ request_options: typing.Optional[RequestOptions] = None,
1487
+ ) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
1488
+ """
1489
+ Updates the parameters for an app variant.
1490
+
1491
+ Args:
1492
+ variant_id (str): The ID of the app variant to update.
1493
+ payload (UpdateVariantParameterPayload): The payload containing the updated parameters.
1494
+
1495
+ Raises:
1496
+ HTTPException: If there is an error while trying to update the app variant.
1497
+
1498
+ Returns:
1499
+ JSONResponse: A JSON response containing the updated app variant parameters.
1500
+
1501
+ Parameters
1502
+ ----------
1503
+ variant_id : str
1504
+
1505
+ parameters : typing.Dict[str, typing.Optional[typing.Any]]
1506
+
1507
+ commit_message : typing.Optional[str]
1508
+
1509
+ request_options : typing.Optional[RequestOptions]
1510
+ Request-specific configuration.
1511
+
1512
+ Returns
1513
+ -------
1514
+ AsyncHttpResponse[typing.Optional[typing.Any]]
1515
+ Successful Response
1516
+ """
1517
+ _response = await self._client_wrapper.httpx_client.request(
1518
+ f"variants/{jsonable_encoder(variant_id)}/parameters",
1519
+ method="PUT",
1520
+ json={
1521
+ "parameters": parameters,
1522
+ "commit_message": commit_message,
1523
+ },
1524
+ headers={
1525
+ "content-type": "application/json",
1526
+ },
1527
+ request_options=request_options,
1528
+ omit=OMIT,
1529
+ )
1530
+ try:
1531
+ if _response is None or not _response.text.strip():
1532
+ return AsyncHttpResponse(response=_response, data=None)
1533
+ if 200 <= _response.status_code < 300:
1534
+ _data = typing.cast(
1535
+ typing.Optional[typing.Any],
1536
+ parse_obj_as(
1537
+ type_=typing.Optional[typing.Any], # type: ignore
1538
+ object_=_response.json(),
1539
+ ),
1540
+ )
1541
+ return AsyncHttpResponse(response=_response, data=_data)
1542
+ if _response.status_code == 422:
1543
+ raise UnprocessableEntityError(
1544
+ headers=dict(_response.headers),
1545
+ body=typing.cast(
1546
+ HttpValidationError,
1547
+ parse_obj_as(
1548
+ type_=HttpValidationError, # type: ignore
1549
+ object_=_response.json(),
1550
+ ),
1551
+ ),
1552
+ )
1553
+ _response_json = _response.json()
1554
+ except JSONDecodeError:
1555
+ raise ApiError(
1556
+ status_code=_response.status_code,
1557
+ headers=dict(_response.headers),
1558
+ body=_response.text,
1559
+ )
1560
+ raise ApiError(
1561
+ status_code=_response.status_code,
1562
+ headers=dict(_response.headers),
1563
+ body=_response_json,
1564
+ )
1565
+
1566
+ async def update_variant_url(
1567
+ self,
1568
+ variant_id: str,
1569
+ *,
1570
+ url: str,
1571
+ update_variant_url_payload_variant_id: str,
1572
+ commit_message: typing.Optional[str] = OMIT,
1573
+ request_options: typing.Optional[RequestOptions] = None,
1574
+ ) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
1575
+ """
1576
+ Updates the URL used in an app variant.
1577
+
1578
+ Args:
1579
+ variant_id (str): The ID of the app variant to update.
1580
+ url (str): The URL to update.
1581
+
1582
+ Raises:
1583
+ HTTPException: If an error occurs while trying to update the app variant.
1584
+
1585
+ Returns:
1586
+ JSONResponse: A JSON response indicating whether the update was successful or not.
1587
+
1588
+ Parameters
1589
+ ----------
1590
+ variant_id : str
1591
+
1592
+ url : str
1593
+
1594
+ update_variant_url_payload_variant_id : str
1595
+
1596
+ commit_message : typing.Optional[str]
1597
+
1598
+ request_options : typing.Optional[RequestOptions]
1599
+ Request-specific configuration.
1600
+
1601
+ Returns
1602
+ -------
1603
+ AsyncHttpResponse[typing.Optional[typing.Any]]
1604
+ Successful Response
1605
+ """
1606
+ _response = await self._client_wrapper.httpx_client.request(
1607
+ f"variants/{jsonable_encoder(variant_id)}/service",
1608
+ method="PUT",
1609
+ json={
1610
+ "url": url,
1611
+ "variant_id": update_variant_url_payload_variant_id,
1612
+ "commit_message": commit_message,
1613
+ },
1614
+ headers={
1615
+ "content-type": "application/json",
1616
+ },
1617
+ request_options=request_options,
1618
+ omit=OMIT,
1619
+ )
1620
+ try:
1621
+ if _response is None or not _response.text.strip():
1622
+ return AsyncHttpResponse(response=_response, data=None)
1623
+ if 200 <= _response.status_code < 300:
1624
+ _data = typing.cast(
1625
+ typing.Optional[typing.Any],
1626
+ parse_obj_as(
1627
+ type_=typing.Optional[typing.Any], # type: ignore
1628
+ object_=_response.json(),
1629
+ ),
1630
+ )
1631
+ return AsyncHttpResponse(response=_response, data=_data)
1632
+ if _response.status_code == 422:
1633
+ raise UnprocessableEntityError(
1634
+ headers=dict(_response.headers),
1635
+ body=typing.cast(
1636
+ HttpValidationError,
1637
+ parse_obj_as(
1638
+ type_=HttpValidationError, # type: ignore
1639
+ object_=_response.json(),
1640
+ ),
1641
+ ),
1642
+ )
1643
+ _response_json = _response.json()
1644
+ except JSONDecodeError:
1645
+ raise ApiError(
1646
+ status_code=_response.status_code,
1647
+ headers=dict(_response.headers),
1648
+ body=_response.text,
1649
+ )
1650
+ raise ApiError(
1651
+ status_code=_response.status_code,
1652
+ headers=dict(_response.headers),
1653
+ body=_response_json,
1654
+ )
1655
+
1656
+ async def get_variant_revisions(
1657
+ self,
1658
+ variant_id: str,
1659
+ *,
1660
+ request_options: typing.Optional[RequestOptions] = None,
1661
+ ) -> AsyncHttpResponse[typing.List[AppVariantRevision]]:
1662
+ """
1663
+ Parameters
1664
+ ----------
1665
+ variant_id : str
1666
+
1667
+ request_options : typing.Optional[RequestOptions]
1668
+ Request-specific configuration.
1669
+
1670
+ Returns
1671
+ -------
1672
+ AsyncHttpResponse[typing.List[AppVariantRevision]]
1673
+ Successful Response
1674
+ """
1675
+ _response = await self._client_wrapper.httpx_client.request(
1676
+ f"variants/{jsonable_encoder(variant_id)}/revisions",
1677
+ method="GET",
1678
+ request_options=request_options,
1679
+ )
1680
+ try:
1681
+ if 200 <= _response.status_code < 300:
1682
+ _data = typing.cast(
1683
+ typing.List[AppVariantRevision],
1684
+ parse_obj_as(
1685
+ type_=typing.List[AppVariantRevision], # type: ignore
1686
+ object_=_response.json(),
1687
+ ),
1688
+ )
1689
+ return AsyncHttpResponse(response=_response, data=_data)
1690
+ if _response.status_code == 422:
1691
+ raise UnprocessableEntityError(
1692
+ headers=dict(_response.headers),
1693
+ body=typing.cast(
1694
+ HttpValidationError,
1695
+ parse_obj_as(
1696
+ type_=HttpValidationError, # type: ignore
1697
+ object_=_response.json(),
1698
+ ),
1699
+ ),
1700
+ )
1701
+ _response_json = _response.json()
1702
+ except JSONDecodeError:
1703
+ raise ApiError(
1704
+ status_code=_response.status_code,
1705
+ headers=dict(_response.headers),
1706
+ body=_response.text,
1707
+ )
1708
+ raise ApiError(
1709
+ status_code=_response.status_code,
1710
+ headers=dict(_response.headers),
1711
+ body=_response_json,
1712
+ )
1713
+
1714
+ async def get_variant_revision(
1715
+ self,
1716
+ variant_id: str,
1717
+ revision_number: int,
1718
+ *,
1719
+ request_options: typing.Optional[RequestOptions] = None,
1720
+ ) -> AsyncHttpResponse[AppVariantRevision]:
1721
+ """
1722
+ Parameters
1723
+ ----------
1724
+ variant_id : str
1725
+
1726
+ revision_number : int
1727
+
1728
+ request_options : typing.Optional[RequestOptions]
1729
+ Request-specific configuration.
1730
+
1731
+ Returns
1732
+ -------
1733
+ AsyncHttpResponse[AppVariantRevision]
1734
+ Successful Response
1735
+ """
1736
+ _response = await self._client_wrapper.httpx_client.request(
1737
+ f"variants/{jsonable_encoder(variant_id)}/revisions/{jsonable_encoder(revision_number)}",
1738
+ method="GET",
1739
+ request_options=request_options,
1740
+ )
1741
+ try:
1742
+ if 200 <= _response.status_code < 300:
1743
+ _data = typing.cast(
1744
+ AppVariantRevision,
1745
+ parse_obj_as(
1746
+ type_=AppVariantRevision, # type: ignore
1747
+ object_=_response.json(),
1748
+ ),
1749
+ )
1750
+ return AsyncHttpResponse(response=_response, data=_data)
1751
+ if _response.status_code == 422:
1752
+ raise UnprocessableEntityError(
1753
+ headers=dict(_response.headers),
1754
+ body=typing.cast(
1755
+ HttpValidationError,
1756
+ parse_obj_as(
1757
+ type_=HttpValidationError, # type: ignore
1758
+ object_=_response.json(),
1759
+ ),
1760
+ ),
1761
+ )
1762
+ _response_json = _response.json()
1763
+ except JSONDecodeError:
1764
+ raise ApiError(
1765
+ status_code=_response.status_code,
1766
+ headers=dict(_response.headers),
1767
+ body=_response.text,
1768
+ )
1769
+ raise ApiError(
1770
+ status_code=_response.status_code,
1771
+ headers=dict(_response.headers),
1772
+ body=_response_json,
1773
+ )
1774
+
1775
+ async def mark_variant_revision_as_hidden(
1776
+ self,
1777
+ variant_id: str,
1778
+ revision_id: str,
1779
+ *,
1780
+ request_options: typing.Optional[RequestOptions] = None,
1781
+ ) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
1782
+ """
1783
+ Mark a variant revision as hidden from the UI.
1784
+
1785
+ Arguments:
1786
+ app_variant -- AppVariant to remove
1787
+ revision_id -- Revision ID to remove
1788
+
1789
+ Raises:
1790
+ HTTPException: If there is a problem removing the app variant
1791
+
1792
+ Parameters
1793
+ ----------
1794
+ variant_id : str
1795
+
1796
+ revision_id : str
1797
+
1798
+ request_options : typing.Optional[RequestOptions]
1799
+ Request-specific configuration.
1800
+
1801
+ Returns
1802
+ -------
1803
+ AsyncHttpResponse[typing.Optional[typing.Any]]
1804
+ Successful Response
1805
+ """
1806
+ _response = await self._client_wrapper.httpx_client.request(
1807
+ f"variants/{jsonable_encoder(variant_id)}/revisions/{jsonable_encoder(revision_id)}",
1808
+ method="DELETE",
1809
+ request_options=request_options,
1810
+ )
1811
+ try:
1812
+ if _response is None or not _response.text.strip():
1813
+ return AsyncHttpResponse(response=_response, data=None)
1814
+ if 200 <= _response.status_code < 300:
1815
+ _data = typing.cast(
1816
+ typing.Optional[typing.Any],
1817
+ parse_obj_as(
1818
+ type_=typing.Optional[typing.Any], # type: ignore
1819
+ object_=_response.json(),
1820
+ ),
1821
+ )
1822
+ return AsyncHttpResponse(response=_response, data=_data)
1823
+ if _response.status_code == 422:
1824
+ raise UnprocessableEntityError(
1825
+ headers=dict(_response.headers),
1826
+ body=typing.cast(
1827
+ HttpValidationError,
1828
+ parse_obj_as(
1829
+ type_=HttpValidationError, # type: ignore
1830
+ object_=_response.json(),
1831
+ ),
1832
+ ),
1833
+ )
1834
+ _response_json = _response.json()
1835
+ except JSONDecodeError:
1836
+ raise ApiError(
1837
+ status_code=_response.status_code,
1838
+ headers=dict(_response.headers),
1839
+ body=_response.text,
1840
+ )
1841
+ raise ApiError(
1842
+ status_code=_response.status_code,
1843
+ headers=dict(_response.headers),
1844
+ body=_response_json,
1845
+ )
1846
+
1847
+ async def configs_add(
1848
+ self,
1849
+ *,
1850
+ variant_ref: ReferenceRequestModel,
1851
+ application_ref: ReferenceRequestModel,
1852
+ request_options: typing.Optional[RequestOptions] = None,
1853
+ ) -> AsyncHttpResponse[ConfigResponseModel]:
1854
+ """
1855
+ Parameters
1856
+ ----------
1857
+ variant_ref : ReferenceRequestModel
1858
+
1859
+ application_ref : ReferenceRequestModel
1860
+
1861
+ request_options : typing.Optional[RequestOptions]
1862
+ Request-specific configuration.
1863
+
1864
+ Returns
1865
+ -------
1866
+ AsyncHttpResponse[ConfigResponseModel]
1867
+ Successful Response
1868
+ """
1869
+ _response = await self._client_wrapper.httpx_client.request(
1870
+ "variants/configs/add",
1871
+ method="POST",
1872
+ json={
1873
+ "variant_ref": convert_and_respect_annotation_metadata(
1874
+ object_=variant_ref,
1875
+ annotation=ReferenceRequestModel,
1876
+ direction="write",
1877
+ ),
1878
+ "application_ref": convert_and_respect_annotation_metadata(
1879
+ object_=application_ref,
1880
+ annotation=ReferenceRequestModel,
1881
+ direction="write",
1882
+ ),
1883
+ },
1884
+ headers={
1885
+ "content-type": "application/json",
1886
+ },
1887
+ request_options=request_options,
1888
+ omit=OMIT,
1889
+ )
1890
+ try:
1891
+ if 200 <= _response.status_code < 300:
1892
+ _data = typing.cast(
1893
+ ConfigResponseModel,
1894
+ parse_obj_as(
1895
+ type_=ConfigResponseModel, # type: ignore
1896
+ object_=_response.json(),
1897
+ ),
1898
+ )
1899
+ return AsyncHttpResponse(response=_response, data=_data)
1900
+ if _response.status_code == 422:
1901
+ raise UnprocessableEntityError(
1902
+ headers=dict(_response.headers),
1903
+ body=typing.cast(
1904
+ HttpValidationError,
1905
+ parse_obj_as(
1906
+ type_=HttpValidationError, # type: ignore
1907
+ object_=_response.json(),
1908
+ ),
1909
+ ),
1910
+ )
1911
+ _response_json = _response.json()
1912
+ except JSONDecodeError:
1913
+ raise ApiError(
1914
+ status_code=_response.status_code,
1915
+ headers=dict(_response.headers),
1916
+ body=_response.text,
1917
+ )
1918
+ raise ApiError(
1919
+ status_code=_response.status_code,
1920
+ headers=dict(_response.headers),
1921
+ body=_response_json,
1922
+ )
1923
+
1924
+ async def configs_fetch(
1925
+ self,
1926
+ *,
1927
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1928
+ environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1929
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
1930
+ request_options: typing.Optional[RequestOptions] = None,
1931
+ ) -> AsyncHttpResponse[ConfigResponseModel]:
1932
+ """
1933
+ Fetch configuration for a variant or environment.
1934
+
1935
+ Either variant_ref OR environment_ref must be provided (if neither is provided,
1936
+ a default environment_ref with slug="production" will be used).
1937
+
1938
+ For each reference object (variant_ref, environment_ref, application_ref):
1939
+ - Provide either 'slug' or 'id' field
1940
+ - 'version' is optional and can be set to null
1941
+ - If 'id' is provided, it will be used directly to fetch the resource
1942
+ - Otherwise, 'slug' will be used along with application_ref
1943
+
1944
+ Returns:
1945
+ ConfigResponseModel: The configuration for the requested variant or environment.
1946
+
1947
+ Raises:
1948
+ HTTPException: If the configuration is not found.
1949
+
1950
+ Parameters
1951
+ ----------
1952
+ variant_ref : typing.Optional[ReferenceRequestModel]
1953
+
1954
+ environment_ref : typing.Optional[ReferenceRequestModel]
1955
+
1956
+ application_ref : typing.Optional[ReferenceRequestModel]
1957
+
1958
+ request_options : typing.Optional[RequestOptions]
1959
+ Request-specific configuration.
1960
+
1961
+ Returns
1962
+ -------
1963
+ AsyncHttpResponse[ConfigResponseModel]
1964
+ Successful Response
1965
+ """
1966
+ _response = await self._client_wrapper.httpx_client.request(
1967
+ "variants/configs/fetch",
1968
+ method="POST",
1969
+ json={
1970
+ "variant_ref": convert_and_respect_annotation_metadata(
1971
+ object_=variant_ref,
1972
+ annotation=ReferenceRequestModel,
1973
+ direction="write",
1974
+ ),
1975
+ "environment_ref": convert_and_respect_annotation_metadata(
1976
+ object_=environment_ref,
1977
+ annotation=ReferenceRequestModel,
1978
+ direction="write",
1979
+ ),
1980
+ "application_ref": convert_and_respect_annotation_metadata(
1981
+ object_=application_ref,
1982
+ annotation=ReferenceRequestModel,
1983
+ direction="write",
1984
+ ),
1985
+ },
1986
+ headers={
1987
+ "content-type": "application/json",
1988
+ },
1989
+ request_options=request_options,
1990
+ omit=OMIT,
1991
+ )
1992
+ try:
1993
+ if 200 <= _response.status_code < 300:
1994
+ _data = typing.cast(
1995
+ ConfigResponseModel,
1996
+ parse_obj_as(
1997
+ type_=ConfigResponseModel, # type: ignore
1998
+ object_=_response.json(),
1999
+ ),
2000
+ )
2001
+ return AsyncHttpResponse(response=_response, data=_data)
2002
+ if _response.status_code == 422:
2003
+ raise UnprocessableEntityError(
2004
+ headers=dict(_response.headers),
2005
+ body=typing.cast(
2006
+ HttpValidationError,
2007
+ parse_obj_as(
2008
+ type_=HttpValidationError, # type: ignore
2009
+ object_=_response.json(),
2010
+ ),
2011
+ ),
2012
+ )
2013
+ _response_json = _response.json()
2014
+ except JSONDecodeError:
2015
+ raise ApiError(
2016
+ status_code=_response.status_code,
2017
+ headers=dict(_response.headers),
2018
+ body=_response.text,
2019
+ )
2020
+ raise ApiError(
2021
+ status_code=_response.status_code,
2022
+ headers=dict(_response.headers),
2023
+ body=_response_json,
2024
+ )
2025
+
2026
+ async def configs_fork(
2027
+ self,
2028
+ *,
2029
+ variant_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2030
+ environment_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2031
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2032
+ request_options: typing.Optional[RequestOptions] = None,
2033
+ ) -> AsyncHttpResponse[ConfigResponseModel]:
2034
+ """
2035
+ Parameters
2036
+ ----------
2037
+ variant_ref : typing.Optional[ReferenceRequestModel]
2038
+
2039
+ environment_ref : typing.Optional[ReferenceRequestModel]
2040
+
2041
+ application_ref : typing.Optional[ReferenceRequestModel]
2042
+
2043
+ request_options : typing.Optional[RequestOptions]
2044
+ Request-specific configuration.
2045
+
2046
+ Returns
2047
+ -------
2048
+ AsyncHttpResponse[ConfigResponseModel]
2049
+ Successful Response
2050
+ """
2051
+ _response = await self._client_wrapper.httpx_client.request(
2052
+ "variants/configs/fork",
2053
+ method="POST",
2054
+ json={
2055
+ "variant_ref": convert_and_respect_annotation_metadata(
2056
+ object_=variant_ref,
2057
+ annotation=ReferenceRequestModel,
2058
+ direction="write",
2059
+ ),
2060
+ "environment_ref": convert_and_respect_annotation_metadata(
2061
+ object_=environment_ref,
2062
+ annotation=ReferenceRequestModel,
2063
+ direction="write",
2064
+ ),
2065
+ "application_ref": convert_and_respect_annotation_metadata(
2066
+ object_=application_ref,
2067
+ annotation=ReferenceRequestModel,
2068
+ direction="write",
2069
+ ),
2070
+ },
2071
+ headers={
2072
+ "content-type": "application/json",
2073
+ },
2074
+ request_options=request_options,
2075
+ omit=OMIT,
2076
+ )
2077
+ try:
2078
+ if 200 <= _response.status_code < 300:
2079
+ _data = typing.cast(
2080
+ ConfigResponseModel,
2081
+ parse_obj_as(
2082
+ type_=ConfigResponseModel, # type: ignore
2083
+ object_=_response.json(),
2084
+ ),
2085
+ )
2086
+ return AsyncHttpResponse(response=_response, data=_data)
2087
+ if _response.status_code == 422:
2088
+ raise UnprocessableEntityError(
2089
+ headers=dict(_response.headers),
2090
+ body=typing.cast(
2091
+ HttpValidationError,
2092
+ parse_obj_as(
2093
+ type_=HttpValidationError, # type: ignore
2094
+ object_=_response.json(),
2095
+ ),
2096
+ ),
2097
+ )
2098
+ _response_json = _response.json()
2099
+ except JSONDecodeError:
2100
+ raise ApiError(
2101
+ status_code=_response.status_code,
2102
+ headers=dict(_response.headers),
2103
+ body=_response.text,
2104
+ )
2105
+ raise ApiError(
2106
+ status_code=_response.status_code,
2107
+ headers=dict(_response.headers),
2108
+ body=_response_json,
2109
+ )
2110
+
2111
+ async def configs_commit(
2112
+ self,
2113
+ *,
2114
+ config: ConfigDto,
2115
+ request_options: typing.Optional[RequestOptions] = None,
2116
+ ) -> AsyncHttpResponse[ConfigResponseModel]:
2117
+ """
2118
+ Parameters
2119
+ ----------
2120
+ config : ConfigDto
2121
+
2122
+ request_options : typing.Optional[RequestOptions]
2123
+ Request-specific configuration.
2124
+
2125
+ Returns
2126
+ -------
2127
+ AsyncHttpResponse[ConfigResponseModel]
2128
+ Successful Response
2129
+ """
2130
+ _response = await self._client_wrapper.httpx_client.request(
2131
+ "variants/configs/commit",
2132
+ method="POST",
2133
+ json={
2134
+ "config": convert_and_respect_annotation_metadata(
2135
+ object_=config, annotation=ConfigDto, direction="write"
2136
+ ),
2137
+ },
2138
+ headers={
2139
+ "content-type": "application/json",
2140
+ },
2141
+ request_options=request_options,
2142
+ omit=OMIT,
2143
+ )
2144
+ try:
2145
+ if 200 <= _response.status_code < 300:
2146
+ _data = typing.cast(
2147
+ ConfigResponseModel,
2148
+ parse_obj_as(
2149
+ type_=ConfigResponseModel, # type: ignore
2150
+ object_=_response.json(),
2151
+ ),
2152
+ )
2153
+ return AsyncHttpResponse(response=_response, data=_data)
2154
+ if _response.status_code == 422:
2155
+ raise UnprocessableEntityError(
2156
+ headers=dict(_response.headers),
2157
+ body=typing.cast(
2158
+ HttpValidationError,
2159
+ parse_obj_as(
2160
+ type_=HttpValidationError, # type: ignore
2161
+ object_=_response.json(),
2162
+ ),
2163
+ ),
2164
+ )
2165
+ _response_json = _response.json()
2166
+ except JSONDecodeError:
2167
+ raise ApiError(
2168
+ status_code=_response.status_code,
2169
+ headers=dict(_response.headers),
2170
+ body=_response.text,
2171
+ )
2172
+ raise ApiError(
2173
+ status_code=_response.status_code,
2174
+ headers=dict(_response.headers),
2175
+ body=_response_json,
2176
+ )
2177
+
2178
+ async def configs_deploy(
2179
+ self,
2180
+ *,
2181
+ variant_ref: ReferenceRequestModel,
2182
+ environment_ref: ReferenceRequestModel,
2183
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2184
+ request_options: typing.Optional[RequestOptions] = None,
2185
+ ) -> AsyncHttpResponse[ConfigResponseModel]:
2186
+ """
2187
+ Parameters
2188
+ ----------
2189
+ variant_ref : ReferenceRequestModel
2190
+
2191
+ environment_ref : ReferenceRequestModel
2192
+
2193
+ application_ref : typing.Optional[ReferenceRequestModel]
2194
+
2195
+ request_options : typing.Optional[RequestOptions]
2196
+ Request-specific configuration.
2197
+
2198
+ Returns
2199
+ -------
2200
+ AsyncHttpResponse[ConfigResponseModel]
2201
+ Successful Response
2202
+ """
2203
+ _response = await self._client_wrapper.httpx_client.request(
2204
+ "variants/configs/deploy",
2205
+ method="POST",
2206
+ json={
2207
+ "variant_ref": convert_and_respect_annotation_metadata(
2208
+ object_=variant_ref,
2209
+ annotation=ReferenceRequestModel,
2210
+ direction="write",
2211
+ ),
2212
+ "environment_ref": convert_and_respect_annotation_metadata(
2213
+ object_=environment_ref,
2214
+ annotation=ReferenceRequestModel,
2215
+ direction="write",
2216
+ ),
2217
+ "application_ref": convert_and_respect_annotation_metadata(
2218
+ object_=application_ref,
2219
+ annotation=ReferenceRequestModel,
2220
+ direction="write",
2221
+ ),
2222
+ },
2223
+ headers={
2224
+ "content-type": "application/json",
2225
+ },
2226
+ request_options=request_options,
2227
+ omit=OMIT,
2228
+ )
2229
+ try:
2230
+ if 200 <= _response.status_code < 300:
2231
+ _data = typing.cast(
2232
+ ConfigResponseModel,
2233
+ parse_obj_as(
2234
+ type_=ConfigResponseModel, # type: ignore
2235
+ object_=_response.json(),
2236
+ ),
2237
+ )
2238
+ return AsyncHttpResponse(response=_response, data=_data)
2239
+ if _response.status_code == 422:
2240
+ raise UnprocessableEntityError(
2241
+ headers=dict(_response.headers),
2242
+ body=typing.cast(
2243
+ HttpValidationError,
2244
+ parse_obj_as(
2245
+ type_=HttpValidationError, # type: ignore
2246
+ object_=_response.json(),
2247
+ ),
2248
+ ),
2249
+ )
2250
+ _response_json = _response.json()
2251
+ except JSONDecodeError:
2252
+ raise ApiError(
2253
+ status_code=_response.status_code,
2254
+ headers=dict(_response.headers),
2255
+ body=_response.text,
2256
+ )
2257
+ raise ApiError(
2258
+ status_code=_response.status_code,
2259
+ headers=dict(_response.headers),
2260
+ body=_response_json,
2261
+ )
2262
+
2263
+ async def configs_delete(
2264
+ self,
2265
+ *,
2266
+ variant_ref: ReferenceRequestModel,
2267
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2268
+ request_options: typing.Optional[RequestOptions] = None,
2269
+ ) -> AsyncHttpResponse[int]:
2270
+ """
2271
+ Parameters
2272
+ ----------
2273
+ variant_ref : ReferenceRequestModel
2274
+
2275
+ application_ref : typing.Optional[ReferenceRequestModel]
2276
+
2277
+ request_options : typing.Optional[RequestOptions]
2278
+ Request-specific configuration.
2279
+
2280
+ Returns
2281
+ -------
2282
+ AsyncHttpResponse[int]
2283
+ Successful Response
2284
+ """
2285
+ _response = await self._client_wrapper.httpx_client.request(
2286
+ "variants/configs/delete",
2287
+ method="POST",
2288
+ json={
2289
+ "variant_ref": convert_and_respect_annotation_metadata(
2290
+ object_=variant_ref,
2291
+ annotation=ReferenceRequestModel,
2292
+ direction="write",
2293
+ ),
2294
+ "application_ref": convert_and_respect_annotation_metadata(
2295
+ object_=application_ref,
2296
+ annotation=ReferenceRequestModel,
2297
+ direction="write",
2298
+ ),
2299
+ },
2300
+ headers={
2301
+ "content-type": "application/json",
2302
+ },
2303
+ request_options=request_options,
2304
+ omit=OMIT,
2305
+ )
2306
+ try:
2307
+ if 200 <= _response.status_code < 300:
2308
+ _data = typing.cast(
2309
+ int,
2310
+ parse_obj_as(
2311
+ type_=int, # type: ignore
2312
+ object_=_response.json(),
2313
+ ),
2314
+ )
2315
+ return AsyncHttpResponse(response=_response, data=_data)
2316
+ if _response.status_code == 422:
2317
+ raise UnprocessableEntityError(
2318
+ headers=dict(_response.headers),
2319
+ body=typing.cast(
2320
+ HttpValidationError,
2321
+ parse_obj_as(
2322
+ type_=HttpValidationError, # type: ignore
2323
+ object_=_response.json(),
2324
+ ),
2325
+ ),
2326
+ )
2327
+ _response_json = _response.json()
2328
+ except JSONDecodeError:
2329
+ raise ApiError(
2330
+ status_code=_response.status_code,
2331
+ headers=dict(_response.headers),
2332
+ body=_response.text,
2333
+ )
2334
+ raise ApiError(
2335
+ status_code=_response.status_code,
2336
+ headers=dict(_response.headers),
2337
+ body=_response_json,
2338
+ )
2339
+
2340
+ async def configs_list(
2341
+ self,
2342
+ *,
2343
+ application_ref: ReferenceDto,
2344
+ request_options: typing.Optional[RequestOptions] = None,
2345
+ ) -> AsyncHttpResponse[typing.List[ConfigResponseModel]]:
2346
+ """
2347
+ Parameters
2348
+ ----------
2349
+ application_ref : ReferenceDto
2350
+
2351
+ request_options : typing.Optional[RequestOptions]
2352
+ Request-specific configuration.
2353
+
2354
+ Returns
2355
+ -------
2356
+ AsyncHttpResponse[typing.List[ConfigResponseModel]]
2357
+ Successful Response
2358
+ """
2359
+ _response = await self._client_wrapper.httpx_client.request(
2360
+ "variants/configs/list",
2361
+ method="POST",
2362
+ json={
2363
+ "application_ref": convert_and_respect_annotation_metadata(
2364
+ object_=application_ref, annotation=ReferenceDto, direction="write"
2365
+ ),
2366
+ },
2367
+ headers={
2368
+ "content-type": "application/json",
2369
+ },
2370
+ request_options=request_options,
2371
+ omit=OMIT,
2372
+ )
2373
+ try:
2374
+ if 200 <= _response.status_code < 300:
2375
+ _data = typing.cast(
2376
+ typing.List[ConfigResponseModel],
2377
+ parse_obj_as(
2378
+ type_=typing.List[ConfigResponseModel], # type: ignore
2379
+ object_=_response.json(),
2380
+ ),
2381
+ )
2382
+ return AsyncHttpResponse(response=_response, data=_data)
2383
+ if _response.status_code == 422:
2384
+ raise UnprocessableEntityError(
2385
+ headers=dict(_response.headers),
2386
+ body=typing.cast(
2387
+ HttpValidationError,
2388
+ parse_obj_as(
2389
+ type_=HttpValidationError, # type: ignore
2390
+ object_=_response.json(),
2391
+ ),
2392
+ ),
2393
+ )
2394
+ _response_json = _response.json()
2395
+ except JSONDecodeError:
2396
+ raise ApiError(
2397
+ status_code=_response.status_code,
2398
+ headers=dict(_response.headers),
2399
+ body=_response.text,
2400
+ )
2401
+ raise ApiError(
2402
+ status_code=_response.status_code,
2403
+ headers=dict(_response.headers),
2404
+ body=_response_json,
2405
+ )
2406
+
2407
+ async def configs_history(
2408
+ self,
2409
+ *,
2410
+ variant_ref: ReferenceRequestModel,
2411
+ application_ref: typing.Optional[ReferenceRequestModel] = OMIT,
2412
+ request_options: typing.Optional[RequestOptions] = None,
2413
+ ) -> AsyncHttpResponse[typing.List[ConfigResponseModel]]:
2414
+ """
2415
+ Parameters
2416
+ ----------
2417
+ variant_ref : ReferenceRequestModel
2418
+
2419
+ application_ref : typing.Optional[ReferenceRequestModel]
2420
+
2421
+ request_options : typing.Optional[RequestOptions]
2422
+ Request-specific configuration.
2423
+
2424
+ Returns
2425
+ -------
2426
+ AsyncHttpResponse[typing.List[ConfigResponseModel]]
2427
+ Successful Response
2428
+ """
2429
+ _response = await self._client_wrapper.httpx_client.request(
2430
+ "variants/configs/history",
2431
+ method="POST",
2432
+ json={
2433
+ "variant_ref": convert_and_respect_annotation_metadata(
2434
+ object_=variant_ref,
2435
+ annotation=ReferenceRequestModel,
2436
+ direction="write",
2437
+ ),
2438
+ "application_ref": convert_and_respect_annotation_metadata(
2439
+ object_=application_ref,
2440
+ annotation=ReferenceRequestModel,
2441
+ direction="write",
2442
+ ),
2443
+ },
2444
+ headers={
2445
+ "content-type": "application/json",
2446
+ },
2447
+ request_options=request_options,
2448
+ omit=OMIT,
2449
+ )
2450
+ try:
2451
+ if 200 <= _response.status_code < 300:
2452
+ _data = typing.cast(
2453
+ typing.List[ConfigResponseModel],
2454
+ parse_obj_as(
2455
+ type_=typing.List[ConfigResponseModel], # type: ignore
2456
+ object_=_response.json(),
2457
+ ),
2458
+ )
2459
+ return AsyncHttpResponse(response=_response, data=_data)
2460
+ if _response.status_code == 422:
2461
+ raise UnprocessableEntityError(
2462
+ headers=dict(_response.headers),
2463
+ body=typing.cast(
2464
+ HttpValidationError,
2465
+ parse_obj_as(
2466
+ type_=HttpValidationError, # type: ignore
2467
+ object_=_response.json(),
2468
+ ),
2469
+ ),
2470
+ )
2471
+ _response_json = _response.json()
2472
+ except JSONDecodeError:
2473
+ raise ApiError(
2474
+ status_code=_response.status_code,
2475
+ headers=dict(_response.headers),
2476
+ body=_response.text,
2477
+ )
2478
+ raise ApiError(
2479
+ status_code=_response.status_code,
2480
+ headers=dict(_response.headers),
2481
+ body=_response_json,
2482
+ )