agenta 0.24.1a0__py3-none-any.whl → 0.24.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of agenta might be problematic. Click here for more details.
- agenta/cli/variant_commands.py +15 -10
- agenta/client/Readme.md +72 -64
- agenta/client/api.py +1 -1
- agenta/client/backend/__init__.py +14 -9
- agenta/client/backend/apps/client.py +1669 -0
- agenta/client/backend/bases/client.py +190 -0
- agenta/client/backend/client.py +2102 -868
- agenta/client/backend/configs/client.py +598 -0
- agenta/client/backend/containers/client.py +638 -0
- agenta/client/backend/{resources/containers → containers}/types/container_templates_response.py +1 -2
- agenta/client/backend/core/__init__.py +29 -0
- agenta/client/backend/core/client_wrapper.py +42 -9
- agenta/client/backend/core/datetime_utils.py +1 -1
- agenta/client/backend/core/file.py +43 -0
- agenta/client/backend/core/http_client.py +553 -0
- agenta/client/backend/core/jsonable_encoder.py +33 -39
- agenta/client/backend/core/pydantic_utilities.py +212 -0
- agenta/client/backend/core/query_encoder.py +60 -0
- agenta/client/backend/core/remove_none_from_dict.py +2 -2
- agenta/client/backend/core/request_options.py +32 -0
- agenta/client/backend/core/serialization.py +179 -0
- agenta/client/backend/environments/client.py +190 -0
- agenta/client/backend/evaluations/client.py +1462 -0
- agenta/client/backend/evaluators/client.py +911 -0
- agenta/client/backend/observability/client.py +1271 -0
- agenta/client/backend/testsets/client.py +1132 -0
- agenta/client/backend/types/__init__.py +8 -6
- agenta/client/backend/types/aggregated_result.py +14 -29
- agenta/client/backend/types/aggregated_result_evaluator_config.py +1 -2
- agenta/client/backend/types/app.py +13 -28
- agenta/client/backend/types/app_variant_response.py +21 -37
- agenta/client/backend/types/app_variant_revision.py +17 -32
- agenta/client/backend/types/base_output.py +13 -28
- agenta/client/backend/types/body_import_testset.py +16 -31
- agenta/client/backend/types/config_db.py +16 -31
- agenta/client/backend/types/correct_answer.py +22 -0
- agenta/client/backend/types/create_app_output.py +13 -28
- agenta/client/backend/types/create_span.py +33 -50
- agenta/client/backend/types/create_trace_response.py +16 -31
- agenta/client/backend/types/docker_env_vars.py +13 -28
- agenta/client/backend/types/environment_output.py +21 -36
- agenta/client/backend/types/environment_output_extended.py +21 -36
- agenta/client/backend/types/environment_revision.py +18 -33
- agenta/client/backend/types/error.py +16 -31
- agenta/client/backend/types/evaluation.py +20 -34
- agenta/client/backend/types/evaluation_scenario.py +18 -33
- agenta/client/backend/types/evaluation_scenario_input.py +16 -31
- agenta/client/backend/types/evaluation_scenario_output.py +18 -33
- agenta/client/backend/types/evaluation_scenario_result.py +14 -29
- agenta/client/backend/types/evaluation_scenario_score_update.py +13 -28
- agenta/client/backend/types/evaluation_status_enum.py +11 -33
- agenta/client/backend/types/evaluation_type.py +3 -21
- agenta/client/backend/types/evaluator.py +18 -32
- agenta/client/backend/types/evaluator_config.py +20 -33
- agenta/client/backend/types/get_config_response.py +16 -31
- agenta/client/backend/types/http_validation_error.py +14 -29
- agenta/client/backend/types/human_evaluation.py +17 -32
- agenta/client/backend/types/human_evaluation_scenario.py +21 -37
- agenta/client/backend/types/human_evaluation_scenario_input.py +13 -28
- agenta/client/backend/types/human_evaluation_scenario_output.py +13 -28
- agenta/client/backend/types/human_evaluation_scenario_update.py +26 -41
- agenta/client/backend/types/human_evaluation_update.py +14 -29
- agenta/client/backend/types/image.py +18 -33
- agenta/client/backend/types/invite_request.py +13 -28
- agenta/client/backend/types/list_api_keys_response.py +18 -33
- agenta/client/backend/types/llm_run_rate_limit.py +13 -28
- agenta/client/backend/types/llm_tokens.py +16 -31
- agenta/client/backend/types/lm_providers_enum.py +21 -0
- agenta/client/backend/types/new_human_evaluation.py +13 -28
- agenta/client/backend/types/new_testset.py +16 -31
- agenta/client/backend/types/organization.py +22 -36
- agenta/client/backend/types/organization_output.py +13 -28
- agenta/client/backend/types/outputs.py +5 -0
- agenta/client/backend/types/permission.py +36 -137
- agenta/client/backend/types/result.py +17 -32
- agenta/client/backend/types/simple_evaluation_output.py +13 -28
- agenta/client/backend/types/span.py +23 -38
- agenta/client/backend/types/span_detail.py +26 -40
- agenta/client/backend/types/span_status_code.py +1 -25
- agenta/client/backend/types/span_variant.py +16 -31
- agenta/client/backend/types/template.py +14 -29
- agenta/client/backend/types/template_image_info.py +21 -35
- agenta/client/backend/types/test_set_output_response.py +16 -32
- agenta/client/backend/types/test_set_simple_response.py +13 -28
- agenta/client/backend/types/trace_detail.py +26 -40
- agenta/client/backend/types/update_app_output.py +22 -0
- agenta/client/backend/types/uri.py +13 -28
- agenta/client/backend/types/validation_error.py +13 -28
- agenta/client/backend/types/variant_action.py +14 -29
- agenta/client/backend/types/variant_action_enum.py +1 -19
- agenta/client/backend/types/with_pagination.py +14 -30
- agenta/client/backend/types/workspace_member_response.py +14 -29
- agenta/client/backend/types/workspace_permission.py +18 -33
- agenta/client/backend/types/workspace_response.py +20 -35
- agenta/client/backend/types/workspace_role.py +11 -37
- agenta/client/backend/types/workspace_role_response.py +17 -32
- agenta/client/backend/variants/client.py +1447 -0
- agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +8 -0
- agenta/sdk/decorators/llm_entrypoint.py +8 -13
- agenta/sdk/tracing/llm_tracing.py +10 -12
- {agenta-0.24.1a0.dist-info → agenta-0.24.2.dist-info}/METADATA +1 -1
- agenta-0.24.2.dist-info/RECORD +175 -0
- agenta/client/backend/resources/__init__.py +0 -31
- agenta/client/backend/resources/apps/client.py +0 -977
- agenta/client/backend/resources/bases/client.py +0 -127
- agenta/client/backend/resources/configs/client.py +0 -377
- agenta/client/backend/resources/containers/client.py +0 -383
- agenta/client/backend/resources/environments/client.py +0 -131
- agenta/client/backend/resources/evaluations/client.py +0 -1008
- agenta/client/backend/resources/evaluators/client.py +0 -594
- agenta/client/backend/resources/observability/client.py +0 -1187
- agenta/client/backend/resources/testsets/client.py +0 -689
- agenta/client/backend/resources/variants/client.py +0 -796
- agenta/client/backend/resources/variants/types/add_variant_from_base_and_config_response.py +0 -7
- agenta/client/backend/types/evaluation_webhook.py +0 -36
- agenta/client/backend/types/feedback.py +0 -40
- agenta/client/backend/types/span_kind.py +0 -49
- agenta-0.24.1a0.dist-info/RECORD +0 -169
- /agenta/client/backend/{resources/apps → apps}/__init__.py +0 -0
- /agenta/client/backend/{resources/bases → bases}/__init__.py +0 -0
- /agenta/client/backend/{resources/configs → configs}/__init__.py +0 -0
- /agenta/client/backend/{resources/containers → containers}/__init__.py +0 -0
- /agenta/client/backend/{resources/containers → containers}/types/__init__.py +0 -0
- /agenta/client/backend/{resources/environments → environments}/__init__.py +0 -0
- /agenta/client/backend/{resources/evaluations → evaluations}/__init__.py +0 -0
- /agenta/client/backend/{resources/evaluators → evaluators}/__init__.py +0 -0
- /agenta/client/backend/{resources/observability → observability}/__init__.py +0 -0
- /agenta/client/backend/{resources/testsets → testsets}/__init__.py +0 -0
- /agenta/client/backend/{resources/variants → variants}/__init__.py +0 -0
- /agenta/client/backend/{resources/variants → variants}/types/__init__.py +0 -0
- {agenta-0.24.1a0.dist-info → agenta-0.24.2.dist-info}/WHEEL +0 -0
- {agenta-0.24.1a0.dist-info → agenta-0.24.2.dist-info}/entry_points.txt +0 -0
agenta/client/backend/client.py
CHANGED
|
@@ -1,64 +1,101 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
import datetime as dt
|
|
4
3
|
import typing
|
|
5
|
-
import urllib.parse
|
|
6
|
-
from json.decoder import JSONDecodeError
|
|
7
|
-
|
|
8
4
|
import httpx
|
|
9
|
-
|
|
5
|
+
from .core.client_wrapper import SyncClientWrapper
|
|
6
|
+
from .observability.client import ObservabilityClient
|
|
7
|
+
from .apps.client import AppsClient
|
|
8
|
+
from .variants.client import VariantsClient
|
|
9
|
+
from .evaluations.client import EvaluationsClient
|
|
10
|
+
from .evaluators.client import EvaluatorsClient
|
|
11
|
+
from .testsets.client import TestsetsClient
|
|
12
|
+
from .containers.client import ContainersClient
|
|
13
|
+
from .environments.client import EnvironmentsClient
|
|
14
|
+
from .bases.client import BasesClient
|
|
15
|
+
from .configs.client import ConfigsClient
|
|
16
|
+
from .core.request_options import RequestOptions
|
|
17
|
+
from .types.list_api_keys_response import ListApiKeysResponse
|
|
18
|
+
from .core.pydantic_utilities import parse_obj_as
|
|
19
|
+
from json.decoder import JSONDecodeError
|
|
10
20
|
from .core.api_error import ApiError
|
|
11
|
-
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
12
|
-
from .core.jsonable_encoder import jsonable_encoder
|
|
13
|
-
from .core.remove_none_from_dict import remove_none_from_dict
|
|
14
21
|
from .errors.unprocessable_entity_error import UnprocessableEntityError
|
|
15
|
-
from .resources.apps.client import AppsClient, AsyncAppsClient
|
|
16
|
-
from .resources.bases.client import AsyncBasesClient, BasesClient
|
|
17
|
-
from .resources.configs.client import AsyncConfigsClient, ConfigsClient
|
|
18
|
-
from .resources.containers.client import AsyncContainersClient, ContainersClient
|
|
19
|
-
from .resources.environments.client import AsyncEnvironmentsClient, EnvironmentsClient
|
|
20
|
-
from .resources.evaluations.client import AsyncEvaluationsClient, EvaluationsClient
|
|
21
|
-
from .resources.evaluators.client import AsyncEvaluatorsClient, EvaluatorsClient
|
|
22
|
-
from .resources.observability.client import (
|
|
23
|
-
AsyncObservabilityClient,
|
|
24
|
-
ObservabilityClient,
|
|
25
|
-
)
|
|
26
|
-
from .resources.testsets.client import AsyncTestsetsClient, TestsetsClient
|
|
27
|
-
from .resources.variants.client import AsyncVariantsClient, VariantsClient
|
|
28
22
|
from .types.http_validation_error import HttpValidationError
|
|
29
|
-
from .
|
|
30
|
-
from .types.list_api_keys_response import ListApiKeysResponse
|
|
23
|
+
from .core.jsonable_encoder import jsonable_encoder
|
|
31
24
|
from .types.organization import Organization
|
|
32
25
|
from .types.organization_output import OrganizationOutput
|
|
33
|
-
from .types.
|
|
26
|
+
from .types.invite_request import InviteRequest
|
|
34
27
|
from .types.workspace_response import WorkspaceResponse
|
|
35
|
-
|
|
28
|
+
import datetime as dt
|
|
36
29
|
from .types.workspace_role_response import WorkspaceRoleResponse
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
from .types.permission import Permission
|
|
31
|
+
from .core.client_wrapper import AsyncClientWrapper
|
|
32
|
+
from .observability.client import AsyncObservabilityClient
|
|
33
|
+
from .apps.client import AsyncAppsClient
|
|
34
|
+
from .variants.client import AsyncVariantsClient
|
|
35
|
+
from .evaluations.client import AsyncEvaluationsClient
|
|
36
|
+
from .evaluators.client import AsyncEvaluatorsClient
|
|
37
|
+
from .testsets.client import AsyncTestsetsClient
|
|
38
|
+
from .containers.client import AsyncContainersClient
|
|
39
|
+
from .environments.client import AsyncEnvironmentsClient
|
|
40
|
+
from .bases.client import AsyncBasesClient
|
|
41
|
+
from .configs.client import AsyncConfigsClient
|
|
42
42
|
|
|
43
43
|
# this is used as the default value for optional parameters
|
|
44
44
|
OMIT = typing.cast(typing.Any, ...)
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
class AgentaApi:
|
|
48
|
+
"""
|
|
49
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
|
50
|
+
|
|
51
|
+
Parameters
|
|
52
|
+
----------
|
|
53
|
+
base_url : str
|
|
54
|
+
The base url to use for requests from the client.
|
|
55
|
+
|
|
56
|
+
api_key : str
|
|
57
|
+
timeout : typing.Optional[float]
|
|
58
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
59
|
+
|
|
60
|
+
follow_redirects : typing.Optional[bool]
|
|
61
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
62
|
+
|
|
63
|
+
httpx_client : typing.Optional[httpx.Client]
|
|
64
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
|
65
|
+
|
|
66
|
+
Examples
|
|
67
|
+
--------
|
|
68
|
+
from agenta import AgentaApi
|
|
69
|
+
|
|
70
|
+
client = AgentaApi(
|
|
71
|
+
api_key="YOUR_API_KEY",
|
|
72
|
+
base_url="https://yourhost.com/path/to/api",
|
|
73
|
+
)
|
|
74
|
+
"""
|
|
75
|
+
|
|
48
76
|
def __init__(
|
|
49
77
|
self,
|
|
50
78
|
*,
|
|
51
79
|
base_url: str,
|
|
52
80
|
api_key: str,
|
|
53
|
-
timeout: typing.Optional[float] =
|
|
81
|
+
timeout: typing.Optional[float] = None,
|
|
82
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
54
83
|
httpx_client: typing.Optional[httpx.Client] = None,
|
|
55
84
|
):
|
|
85
|
+
_defaulted_timeout = (
|
|
86
|
+
timeout if timeout is not None else 60 if httpx_client is None else None
|
|
87
|
+
)
|
|
56
88
|
self._client_wrapper = SyncClientWrapper(
|
|
57
89
|
base_url=base_url,
|
|
58
90
|
api_key=api_key,
|
|
59
|
-
httpx_client=
|
|
60
|
-
|
|
61
|
-
|
|
91
|
+
httpx_client=httpx_client
|
|
92
|
+
if httpx_client is not None
|
|
93
|
+
else httpx.Client(
|
|
94
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
95
|
+
)
|
|
96
|
+
if follow_redirects is not None
|
|
97
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
98
|
+
timeout=_defaulted_timeout,
|
|
62
99
|
)
|
|
63
100
|
self.observability = ObservabilityClient(client_wrapper=self._client_wrapper)
|
|
64
101
|
self.apps = AppsClient(client_wrapper=self._client_wrapper)
|
|
@@ -71,7 +108,9 @@ class AgentaApi:
|
|
|
71
108
|
self.bases = BasesClient(client_wrapper=self._client_wrapper)
|
|
72
109
|
self.configs = ConfigsClient(client_wrapper=self._client_wrapper)
|
|
73
110
|
|
|
74
|
-
def list_api_keys(
|
|
111
|
+
def list_api_keys(
|
|
112
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
113
|
+
) -> typing.List[ListApiKeysResponse]:
|
|
75
114
|
"""
|
|
76
115
|
List all API keys associated with the authenticated user.
|
|
77
116
|
|
|
@@ -81,8 +120,19 @@ class AgentaApi:
|
|
|
81
120
|
Returns:
|
|
82
121
|
List[ListAPIKeysResponse]: A list of API Keys associated with the user.
|
|
83
122
|
|
|
84
|
-
|
|
85
|
-
|
|
123
|
+
Parameters
|
|
124
|
+
----------
|
|
125
|
+
request_options : typing.Optional[RequestOptions]
|
|
126
|
+
Request-specific configuration.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
typing.List[ListApiKeysResponse]
|
|
131
|
+
Successful Response
|
|
132
|
+
|
|
133
|
+
Examples
|
|
134
|
+
--------
|
|
135
|
+
from agenta import AgentaApi
|
|
86
136
|
|
|
87
137
|
client = AgentaApi(
|
|
88
138
|
api_key="YOUR_API_KEY",
|
|
@@ -91,20 +141,30 @@ class AgentaApi:
|
|
|
91
141
|
client.list_api_keys()
|
|
92
142
|
"""
|
|
93
143
|
_response = self._client_wrapper.httpx_client.request(
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
timeout=60,
|
|
144
|
+
"keys",
|
|
145
|
+
method="GET",
|
|
146
|
+
request_options=request_options,
|
|
98
147
|
)
|
|
99
|
-
if 200 <= _response.status_code < 300:
|
|
100
|
-
return pydantic.parse_obj_as(typing.List[ListApiKeysResponse], _response.json()) # type: ignore
|
|
101
148
|
try:
|
|
149
|
+
if 200 <= _response.status_code < 300:
|
|
150
|
+
return typing.cast(
|
|
151
|
+
typing.List[ListApiKeysResponse],
|
|
152
|
+
parse_obj_as(
|
|
153
|
+
type_=typing.List[ListApiKeysResponse], # type: ignore
|
|
154
|
+
object_=_response.json(),
|
|
155
|
+
),
|
|
156
|
+
)
|
|
102
157
|
_response_json = _response.json()
|
|
103
158
|
except JSONDecodeError:
|
|
104
159
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
105
160
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
106
161
|
|
|
107
|
-
def create_api_key(
|
|
162
|
+
def create_api_key(
|
|
163
|
+
self,
|
|
164
|
+
*,
|
|
165
|
+
workspace_id: str,
|
|
166
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
167
|
+
) -> str:
|
|
108
168
|
"""
|
|
109
169
|
Creates an API key for a user.
|
|
110
170
|
|
|
@@ -114,10 +174,21 @@ class AgentaApi:
|
|
|
114
174
|
Returns:
|
|
115
175
|
str: The created API key.
|
|
116
176
|
|
|
117
|
-
Parameters
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
177
|
+
Parameters
|
|
178
|
+
----------
|
|
179
|
+
workspace_id : str
|
|
180
|
+
|
|
181
|
+
request_options : typing.Optional[RequestOptions]
|
|
182
|
+
Request-specific configuration.
|
|
183
|
+
|
|
184
|
+
Returns
|
|
185
|
+
-------
|
|
186
|
+
str
|
|
187
|
+
Successful Response
|
|
188
|
+
|
|
189
|
+
Examples
|
|
190
|
+
--------
|
|
191
|
+
from agenta import AgentaApi
|
|
121
192
|
|
|
122
193
|
client = AgentaApi(
|
|
123
194
|
api_key="YOUR_API_KEY",
|
|
@@ -128,23 +199,43 @@ class AgentaApi:
|
|
|
128
199
|
)
|
|
129
200
|
"""
|
|
130
201
|
_response = self._client_wrapper.httpx_client.request(
|
|
131
|
-
"
|
|
132
|
-
|
|
133
|
-
params=
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return pydantic.parse_obj_as(str, _response.json()) # type: ignore
|
|
139
|
-
if _response.status_code == 422:
|
|
140
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
202
|
+
"keys",
|
|
203
|
+
method="POST",
|
|
204
|
+
params={
|
|
205
|
+
"workspace_id": workspace_id,
|
|
206
|
+
},
|
|
207
|
+
request_options=request_options,
|
|
208
|
+
)
|
|
141
209
|
try:
|
|
210
|
+
if 200 <= _response.status_code < 300:
|
|
211
|
+
return typing.cast(
|
|
212
|
+
str,
|
|
213
|
+
parse_obj_as(
|
|
214
|
+
type_=str, # type: ignore
|
|
215
|
+
object_=_response.json(),
|
|
216
|
+
),
|
|
217
|
+
)
|
|
218
|
+
if _response.status_code == 422:
|
|
219
|
+
raise UnprocessableEntityError(
|
|
220
|
+
typing.cast(
|
|
221
|
+
HttpValidationError,
|
|
222
|
+
parse_obj_as(
|
|
223
|
+
type_=HttpValidationError, # type: ignore
|
|
224
|
+
object_=_response.json(),
|
|
225
|
+
),
|
|
226
|
+
)
|
|
227
|
+
)
|
|
142
228
|
_response_json = _response.json()
|
|
143
229
|
except JSONDecodeError:
|
|
144
230
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
145
231
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
146
232
|
|
|
147
|
-
def delete_api_key(
|
|
233
|
+
def delete_api_key(
|
|
234
|
+
self,
|
|
235
|
+
key_prefix: str,
|
|
236
|
+
*,
|
|
237
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
238
|
+
) -> typing.Dict[str, typing.Optional[typing.Any]]:
|
|
148
239
|
"""
|
|
149
240
|
Delete an API key with the given key prefix for the authenticated user.
|
|
150
241
|
|
|
@@ -158,10 +249,21 @@ class AgentaApi:
|
|
|
158
249
|
Raises:
|
|
159
250
|
HTTPException: If the API key is not found or does not belong to the user.
|
|
160
251
|
|
|
161
|
-
Parameters
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
252
|
+
Parameters
|
|
253
|
+
----------
|
|
254
|
+
key_prefix : str
|
|
255
|
+
|
|
256
|
+
request_options : typing.Optional[RequestOptions]
|
|
257
|
+
Request-specific configuration.
|
|
258
|
+
|
|
259
|
+
Returns
|
|
260
|
+
-------
|
|
261
|
+
typing.Dict[str, typing.Optional[typing.Any]]
|
|
262
|
+
Successful Response
|
|
263
|
+
|
|
264
|
+
Examples
|
|
265
|
+
--------
|
|
266
|
+
from agenta import AgentaApi
|
|
165
267
|
|
|
166
268
|
client = AgentaApi(
|
|
167
269
|
api_key="YOUR_API_KEY",
|
|
@@ -172,33 +274,60 @@ class AgentaApi:
|
|
|
172
274
|
)
|
|
173
275
|
"""
|
|
174
276
|
_response = self._client_wrapper.httpx_client.request(
|
|
175
|
-
"
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
headers=self._client_wrapper.get_headers(),
|
|
180
|
-
timeout=60,
|
|
181
|
-
)
|
|
182
|
-
if 200 <= _response.status_code < 300:
|
|
183
|
-
return pydantic.parse_obj_as(typing.Dict[str, typing.Any], _response.json()) # type: ignore
|
|
184
|
-
if _response.status_code == 422:
|
|
185
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
277
|
+
f"keys/{jsonable_encoder(key_prefix)}",
|
|
278
|
+
method="DELETE",
|
|
279
|
+
request_options=request_options,
|
|
280
|
+
)
|
|
186
281
|
try:
|
|
282
|
+
if 200 <= _response.status_code < 300:
|
|
283
|
+
return typing.cast(
|
|
284
|
+
typing.Dict[str, typing.Optional[typing.Any]],
|
|
285
|
+
parse_obj_as(
|
|
286
|
+
type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
|
|
287
|
+
object_=_response.json(),
|
|
288
|
+
),
|
|
289
|
+
)
|
|
290
|
+
if _response.status_code == 422:
|
|
291
|
+
raise UnprocessableEntityError(
|
|
292
|
+
typing.cast(
|
|
293
|
+
HttpValidationError,
|
|
294
|
+
parse_obj_as(
|
|
295
|
+
type_=HttpValidationError, # type: ignore
|
|
296
|
+
object_=_response.json(),
|
|
297
|
+
),
|
|
298
|
+
)
|
|
299
|
+
)
|
|
187
300
|
_response_json = _response.json()
|
|
188
301
|
except JSONDecodeError:
|
|
189
302
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
190
303
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
191
304
|
|
|
192
|
-
def validate_api_key(
|
|
305
|
+
def validate_api_key(
|
|
306
|
+
self,
|
|
307
|
+
key_prefix: str,
|
|
308
|
+
*,
|
|
309
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
310
|
+
) -> bool:
|
|
193
311
|
"""
|
|
194
312
|
This Function is called by the CLI and is used to validate an API key provided by a user in agenta init setup.
|
|
195
313
|
Returns:
|
|
196
314
|
bool: True. If the request reaches this point, the API key is valid.
|
|
197
315
|
|
|
198
|
-
Parameters
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
316
|
+
Parameters
|
|
317
|
+
----------
|
|
318
|
+
key_prefix : str
|
|
319
|
+
|
|
320
|
+
request_options : typing.Optional[RequestOptions]
|
|
321
|
+
Request-specific configuration.
|
|
322
|
+
|
|
323
|
+
Returns
|
|
324
|
+
-------
|
|
325
|
+
bool
|
|
326
|
+
Successful Response
|
|
327
|
+
|
|
328
|
+
Examples
|
|
329
|
+
--------
|
|
330
|
+
from agenta import AgentaApi
|
|
202
331
|
|
|
203
332
|
client = AgentaApi(
|
|
204
333
|
api_key="YOUR_API_KEY",
|
|
@@ -209,24 +338,37 @@ class AgentaApi:
|
|
|
209
338
|
)
|
|
210
339
|
"""
|
|
211
340
|
_response = self._client_wrapper.httpx_client.request(
|
|
212
|
-
"
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
headers=self._client_wrapper.get_headers(),
|
|
217
|
-
timeout=60,
|
|
218
|
-
)
|
|
219
|
-
if 200 <= _response.status_code < 300:
|
|
220
|
-
return pydantic.parse_obj_as(bool, _response.json()) # type: ignore
|
|
221
|
-
if _response.status_code == 422:
|
|
222
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
341
|
+
f"keys/{jsonable_encoder(key_prefix)}/validate",
|
|
342
|
+
method="GET",
|
|
343
|
+
request_options=request_options,
|
|
344
|
+
)
|
|
223
345
|
try:
|
|
346
|
+
if 200 <= _response.status_code < 300:
|
|
347
|
+
return typing.cast(
|
|
348
|
+
bool,
|
|
349
|
+
parse_obj_as(
|
|
350
|
+
type_=bool, # type: ignore
|
|
351
|
+
object_=_response.json(),
|
|
352
|
+
),
|
|
353
|
+
)
|
|
354
|
+
if _response.status_code == 422:
|
|
355
|
+
raise UnprocessableEntityError(
|
|
356
|
+
typing.cast(
|
|
357
|
+
HttpValidationError,
|
|
358
|
+
parse_obj_as(
|
|
359
|
+
type_=HttpValidationError, # type: ignore
|
|
360
|
+
object_=_response.json(),
|
|
361
|
+
),
|
|
362
|
+
)
|
|
363
|
+
)
|
|
224
364
|
_response_json = _response.json()
|
|
225
365
|
except JSONDecodeError:
|
|
226
366
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
227
367
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
228
368
|
|
|
229
|
-
def list_organizations(
|
|
369
|
+
def list_organizations(
|
|
370
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
371
|
+
) -> typing.List[Organization]:
|
|
230
372
|
"""
|
|
231
373
|
Returns a list of organizations associated with the user's session.
|
|
232
374
|
|
|
@@ -239,8 +381,19 @@ class AgentaApi:
|
|
|
239
381
|
Raises:
|
|
240
382
|
HTTPException: If there is an error retrieving the organizations from the database.
|
|
241
383
|
|
|
242
|
-
|
|
243
|
-
|
|
384
|
+
Parameters
|
|
385
|
+
----------
|
|
386
|
+
request_options : typing.Optional[RequestOptions]
|
|
387
|
+
Request-specific configuration.
|
|
388
|
+
|
|
389
|
+
Returns
|
|
390
|
+
-------
|
|
391
|
+
typing.List[Organization]
|
|
392
|
+
Successful Response
|
|
393
|
+
|
|
394
|
+
Examples
|
|
395
|
+
--------
|
|
396
|
+
from agenta import AgentaApi
|
|
244
397
|
|
|
245
398
|
client = AgentaApi(
|
|
246
399
|
api_key="YOUR_API_KEY",
|
|
@@ -249,16 +402,19 @@ class AgentaApi:
|
|
|
249
402
|
client.list_organizations()
|
|
250
403
|
"""
|
|
251
404
|
_response = self._client_wrapper.httpx_client.request(
|
|
252
|
-
"
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
headers=self._client_wrapper.get_headers(),
|
|
257
|
-
timeout=60,
|
|
258
|
-
)
|
|
259
|
-
if 200 <= _response.status_code < 300:
|
|
260
|
-
return pydantic.parse_obj_as(typing.List[Organization], _response.json()) # type: ignore
|
|
405
|
+
"organizations",
|
|
406
|
+
method="GET",
|
|
407
|
+
request_options=request_options,
|
|
408
|
+
)
|
|
261
409
|
try:
|
|
410
|
+
if 200 <= _response.status_code < 300:
|
|
411
|
+
return typing.cast(
|
|
412
|
+
typing.List[Organization],
|
|
413
|
+
parse_obj_as(
|
|
414
|
+
type_=typing.List[Organization], # type: ignore
|
|
415
|
+
object_=_response.json(),
|
|
416
|
+
),
|
|
417
|
+
)
|
|
262
418
|
_response_json = _response.json()
|
|
263
419
|
except JSONDecodeError:
|
|
264
420
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -268,21 +424,33 @@ class AgentaApi:
|
|
|
268
424
|
self,
|
|
269
425
|
*,
|
|
270
426
|
name: str,
|
|
427
|
+
owner: str,
|
|
271
428
|
description: typing.Optional[str] = OMIT,
|
|
272
429
|
type: typing.Optional[str] = OMIT,
|
|
273
|
-
|
|
274
|
-
) -> typing.Any:
|
|
430
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
431
|
+
) -> typing.Optional[typing.Any]:
|
|
275
432
|
"""
|
|
276
|
-
Parameters
|
|
277
|
-
|
|
433
|
+
Parameters
|
|
434
|
+
----------
|
|
435
|
+
name : str
|
|
436
|
+
|
|
437
|
+
owner : str
|
|
438
|
+
|
|
439
|
+
description : typing.Optional[str]
|
|
440
|
+
|
|
441
|
+
type : typing.Optional[str]
|
|
278
442
|
|
|
279
|
-
|
|
443
|
+
request_options : typing.Optional[RequestOptions]
|
|
444
|
+
Request-specific configuration.
|
|
280
445
|
|
|
281
|
-
|
|
446
|
+
Returns
|
|
447
|
+
-------
|
|
448
|
+
typing.Optional[typing.Any]
|
|
449
|
+
Successful Response
|
|
282
450
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
from agenta
|
|
451
|
+
Examples
|
|
452
|
+
--------
|
|
453
|
+
from agenta import AgentaApi
|
|
286
454
|
|
|
287
455
|
client = AgentaApi(
|
|
288
456
|
api_key="YOUR_API_KEY",
|
|
@@ -290,37 +458,62 @@ class AgentaApi:
|
|
|
290
458
|
)
|
|
291
459
|
client.create_organization(
|
|
292
460
|
name="name",
|
|
461
|
+
owner="owner",
|
|
293
462
|
)
|
|
294
463
|
"""
|
|
295
|
-
_request: typing.Dict[str, typing.Any] = {"name": name}
|
|
296
|
-
if description is not OMIT:
|
|
297
|
-
_request["description"] = description
|
|
298
|
-
if type is not OMIT:
|
|
299
|
-
_request["type"] = type
|
|
300
|
-
if owner is not OMIT:
|
|
301
|
-
_request["owner"] = owner
|
|
302
464
|
_response = self._client_wrapper.httpx_client.request(
|
|
303
|
-
"
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
465
|
+
"organizations",
|
|
466
|
+
method="POST",
|
|
467
|
+
json={
|
|
468
|
+
"name": name,
|
|
469
|
+
"owner": owner,
|
|
470
|
+
"description": description,
|
|
471
|
+
"type": type,
|
|
472
|
+
},
|
|
473
|
+
request_options=request_options,
|
|
474
|
+
omit=OMIT,
|
|
475
|
+
)
|
|
315
476
|
try:
|
|
477
|
+
if 200 <= _response.status_code < 300:
|
|
478
|
+
return typing.cast(
|
|
479
|
+
typing.Optional[typing.Any],
|
|
480
|
+
parse_obj_as(
|
|
481
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
482
|
+
object_=_response.json(),
|
|
483
|
+
),
|
|
484
|
+
)
|
|
485
|
+
if _response.status_code == 422:
|
|
486
|
+
raise UnprocessableEntityError(
|
|
487
|
+
typing.cast(
|
|
488
|
+
HttpValidationError,
|
|
489
|
+
parse_obj_as(
|
|
490
|
+
type_=HttpValidationError, # type: ignore
|
|
491
|
+
object_=_response.json(),
|
|
492
|
+
),
|
|
493
|
+
)
|
|
494
|
+
)
|
|
316
495
|
_response_json = _response.json()
|
|
317
496
|
except JSONDecodeError:
|
|
318
497
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
319
498
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
320
499
|
|
|
321
|
-
def get_own_org(
|
|
500
|
+
def get_own_org(
|
|
501
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
502
|
+
) -> OrganizationOutput:
|
|
322
503
|
"""
|
|
323
|
-
|
|
504
|
+
Parameters
|
|
505
|
+
----------
|
|
506
|
+
request_options : typing.Optional[RequestOptions]
|
|
507
|
+
Request-specific configuration.
|
|
508
|
+
|
|
509
|
+
Returns
|
|
510
|
+
-------
|
|
511
|
+
OrganizationOutput
|
|
512
|
+
Successful Response
|
|
513
|
+
|
|
514
|
+
Examples
|
|
515
|
+
--------
|
|
516
|
+
from agenta import AgentaApi
|
|
324
517
|
|
|
325
518
|
client = AgentaApi(
|
|
326
519
|
api_key="YOUR_API_KEY",
|
|
@@ -329,22 +522,27 @@ class AgentaApi:
|
|
|
329
522
|
client.get_own_org()
|
|
330
523
|
"""
|
|
331
524
|
_response = self._client_wrapper.httpx_client.request(
|
|
332
|
-
"
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
headers=self._client_wrapper.get_headers(),
|
|
337
|
-
timeout=60,
|
|
338
|
-
)
|
|
339
|
-
if 200 <= _response.status_code < 300:
|
|
340
|
-
return pydantic.parse_obj_as(OrganizationOutput, _response.json()) # type: ignore
|
|
525
|
+
"organizations/own",
|
|
526
|
+
method="GET",
|
|
527
|
+
request_options=request_options,
|
|
528
|
+
)
|
|
341
529
|
try:
|
|
530
|
+
if 200 <= _response.status_code < 300:
|
|
531
|
+
return typing.cast(
|
|
532
|
+
OrganizationOutput,
|
|
533
|
+
parse_obj_as(
|
|
534
|
+
type_=OrganizationOutput, # type: ignore
|
|
535
|
+
object_=_response.json(),
|
|
536
|
+
),
|
|
537
|
+
)
|
|
342
538
|
_response_json = _response.json()
|
|
343
539
|
except JSONDecodeError:
|
|
344
540
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
345
541
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
346
542
|
|
|
347
|
-
def fetch_organization_details(
|
|
543
|
+
def fetch_organization_details(
|
|
544
|
+
self, org_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
545
|
+
) -> typing.Optional[typing.Any]:
|
|
348
546
|
"""
|
|
349
547
|
Get an organization's details.
|
|
350
548
|
|
|
@@ -355,10 +553,21 @@ class AgentaApi:
|
|
|
355
553
|
Returns:
|
|
356
554
|
OrganizationDB Instance
|
|
357
555
|
|
|
358
|
-
Parameters
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
556
|
+
Parameters
|
|
557
|
+
----------
|
|
558
|
+
org_id : str
|
|
559
|
+
|
|
560
|
+
request_options : typing.Optional[RequestOptions]
|
|
561
|
+
Request-specific configuration.
|
|
562
|
+
|
|
563
|
+
Returns
|
|
564
|
+
-------
|
|
565
|
+
typing.Optional[typing.Any]
|
|
566
|
+
Successful Response
|
|
567
|
+
|
|
568
|
+
Examples
|
|
569
|
+
--------
|
|
570
|
+
from agenta import AgentaApi
|
|
362
571
|
|
|
363
572
|
client = AgentaApi(
|
|
364
573
|
api_key="YOUR_API_KEY",
|
|
@@ -369,18 +578,29 @@ class AgentaApi:
|
|
|
369
578
|
)
|
|
370
579
|
"""
|
|
371
580
|
_response = self._client_wrapper.httpx_client.request(
|
|
372
|
-
"
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
headers=self._client_wrapper.get_headers(),
|
|
377
|
-
timeout=60,
|
|
378
|
-
)
|
|
379
|
-
if 200 <= _response.status_code < 300:
|
|
380
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
381
|
-
if _response.status_code == 422:
|
|
382
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
581
|
+
f"organizations/{jsonable_encoder(org_id)}",
|
|
582
|
+
method="GET",
|
|
583
|
+
request_options=request_options,
|
|
584
|
+
)
|
|
383
585
|
try:
|
|
586
|
+
if 200 <= _response.status_code < 300:
|
|
587
|
+
return 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
|
+
if _response.status_code == 422:
|
|
595
|
+
raise UnprocessableEntityError(
|
|
596
|
+
typing.cast(
|
|
597
|
+
HttpValidationError,
|
|
598
|
+
parse_obj_as(
|
|
599
|
+
type_=HttpValidationError, # type: ignore
|
|
600
|
+
object_=_response.json(),
|
|
601
|
+
),
|
|
602
|
+
)
|
|
603
|
+
)
|
|
384
604
|
_response_json = _response.json()
|
|
385
605
|
except JSONDecodeError:
|
|
386
606
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -392,19 +612,31 @@ class AgentaApi:
|
|
|
392
612
|
*,
|
|
393
613
|
name: typing.Optional[str] = OMIT,
|
|
394
614
|
description: typing.Optional[str] = OMIT,
|
|
395
|
-
updated_at: typing.Optional[
|
|
396
|
-
|
|
615
|
+
updated_at: typing.Optional[str] = OMIT,
|
|
616
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
617
|
+
) -> typing.Optional[typing.Any]:
|
|
397
618
|
"""
|
|
398
|
-
Parameters
|
|
399
|
-
|
|
619
|
+
Parameters
|
|
620
|
+
----------
|
|
621
|
+
org_id : str
|
|
400
622
|
|
|
401
|
-
|
|
623
|
+
name : typing.Optional[str]
|
|
402
624
|
|
|
403
|
-
|
|
625
|
+
description : typing.Optional[str]
|
|
404
626
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
627
|
+
updated_at : typing.Optional[str]
|
|
628
|
+
|
|
629
|
+
request_options : typing.Optional[RequestOptions]
|
|
630
|
+
Request-specific configuration.
|
|
631
|
+
|
|
632
|
+
Returns
|
|
633
|
+
-------
|
|
634
|
+
typing.Optional[typing.Any]
|
|
635
|
+
Successful Response
|
|
636
|
+
|
|
637
|
+
Examples
|
|
638
|
+
--------
|
|
639
|
+
from agenta import AgentaApi
|
|
408
640
|
|
|
409
641
|
client = AgentaApi(
|
|
410
642
|
api_key="YOUR_API_KEY",
|
|
@@ -414,45 +646,69 @@ class AgentaApi:
|
|
|
414
646
|
org_id="org_id",
|
|
415
647
|
)
|
|
416
648
|
"""
|
|
417
|
-
_request: typing.Dict[str, typing.Any] = {}
|
|
418
|
-
if name is not OMIT:
|
|
419
|
-
_request["name"] = name
|
|
420
|
-
if description is not OMIT:
|
|
421
|
-
_request["description"] = description
|
|
422
|
-
if updated_at is not OMIT:
|
|
423
|
-
_request["updated_at"] = updated_at
|
|
424
649
|
_response = self._client_wrapper.httpx_client.request(
|
|
425
|
-
"
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
if _response.status_code == 422:
|
|
436
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
650
|
+
f"organizations/{jsonable_encoder(org_id)}",
|
|
651
|
+
method="PUT",
|
|
652
|
+
json={
|
|
653
|
+
"name": name,
|
|
654
|
+
"description": description,
|
|
655
|
+
"updated_at": updated_at,
|
|
656
|
+
},
|
|
657
|
+
request_options=request_options,
|
|
658
|
+
omit=OMIT,
|
|
659
|
+
)
|
|
437
660
|
try:
|
|
661
|
+
if 200 <= _response.status_code < 300:
|
|
662
|
+
return typing.cast(
|
|
663
|
+
typing.Optional[typing.Any],
|
|
664
|
+
parse_obj_as(
|
|
665
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
666
|
+
object_=_response.json(),
|
|
667
|
+
),
|
|
668
|
+
)
|
|
669
|
+
if _response.status_code == 422:
|
|
670
|
+
raise UnprocessableEntityError(
|
|
671
|
+
typing.cast(
|
|
672
|
+
HttpValidationError,
|
|
673
|
+
parse_obj_as(
|
|
674
|
+
type_=HttpValidationError, # type: ignore
|
|
675
|
+
object_=_response.json(),
|
|
676
|
+
),
|
|
677
|
+
)
|
|
678
|
+
)
|
|
438
679
|
_response_json = _response.json()
|
|
439
680
|
except JSONDecodeError:
|
|
440
681
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
441
682
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
442
683
|
|
|
443
684
|
def invite_user_to_workspace(
|
|
444
|
-
self,
|
|
445
|
-
|
|
685
|
+
self,
|
|
686
|
+
org_id: str,
|
|
687
|
+
workspace_id: str,
|
|
688
|
+
*,
|
|
689
|
+
request: typing.Sequence[InviteRequest],
|
|
690
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
691
|
+
) -> typing.Optional[typing.Any]:
|
|
446
692
|
"""
|
|
447
|
-
Parameters
|
|
448
|
-
|
|
693
|
+
Parameters
|
|
694
|
+
----------
|
|
695
|
+
org_id : str
|
|
696
|
+
|
|
697
|
+
workspace_id : str
|
|
449
698
|
|
|
450
|
-
|
|
699
|
+
request : typing.Sequence[InviteRequest]
|
|
451
700
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
701
|
+
request_options : typing.Optional[RequestOptions]
|
|
702
|
+
Request-specific configuration.
|
|
703
|
+
|
|
704
|
+
Returns
|
|
705
|
+
-------
|
|
706
|
+
typing.Optional[typing.Any]
|
|
707
|
+
Successful Response
|
|
708
|
+
|
|
709
|
+
Examples
|
|
710
|
+
--------
|
|
711
|
+
from agenta import AgentaApi, InviteRequest
|
|
456
712
|
|
|
457
713
|
client = AgentaApi(
|
|
458
714
|
api_key="YOUR_API_KEY",
|
|
@@ -470,28 +726,44 @@ class AgentaApi:
|
|
|
470
726
|
)
|
|
471
727
|
"""
|
|
472
728
|
_response = self._client_wrapper.httpx_client.request(
|
|
473
|
-
"
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
headers=self._client_wrapper.get_headers(),
|
|
480
|
-
timeout=60,
|
|
481
|
-
)
|
|
482
|
-
if 200 <= _response.status_code < 300:
|
|
483
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
484
|
-
if _response.status_code == 422:
|
|
485
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
729
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite",
|
|
730
|
+
method="POST",
|
|
731
|
+
json=request,
|
|
732
|
+
request_options=request_options,
|
|
733
|
+
omit=OMIT,
|
|
734
|
+
)
|
|
486
735
|
try:
|
|
736
|
+
if 200 <= _response.status_code < 300:
|
|
737
|
+
return typing.cast(
|
|
738
|
+
typing.Optional[typing.Any],
|
|
739
|
+
parse_obj_as(
|
|
740
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
741
|
+
object_=_response.json(),
|
|
742
|
+
),
|
|
743
|
+
)
|
|
744
|
+
if _response.status_code == 422:
|
|
745
|
+
raise UnprocessableEntityError(
|
|
746
|
+
typing.cast(
|
|
747
|
+
HttpValidationError,
|
|
748
|
+
parse_obj_as(
|
|
749
|
+
type_=HttpValidationError, # type: ignore
|
|
750
|
+
object_=_response.json(),
|
|
751
|
+
),
|
|
752
|
+
)
|
|
753
|
+
)
|
|
487
754
|
_response_json = _response.json()
|
|
488
755
|
except JSONDecodeError:
|
|
489
756
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
490
757
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
491
758
|
|
|
492
759
|
def resend_invitation(
|
|
493
|
-
self,
|
|
494
|
-
|
|
760
|
+
self,
|
|
761
|
+
org_id: str,
|
|
762
|
+
workspace_id: str,
|
|
763
|
+
*,
|
|
764
|
+
email: str,
|
|
765
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
766
|
+
) -> typing.Optional[typing.Any]:
|
|
495
767
|
"""
|
|
496
768
|
Resend an invitation to a user to an Organization.
|
|
497
769
|
|
|
@@ -503,14 +775,25 @@ class AgentaApi:
|
|
|
503
775
|
Returns:
|
|
504
776
|
JSONResponse: Resent invitation to user; status_code: 200
|
|
505
777
|
|
|
506
|
-
Parameters
|
|
507
|
-
|
|
778
|
+
Parameters
|
|
779
|
+
----------
|
|
780
|
+
org_id : str
|
|
781
|
+
|
|
782
|
+
workspace_id : str
|
|
508
783
|
|
|
509
|
-
|
|
784
|
+
email : str
|
|
510
785
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
786
|
+
request_options : typing.Optional[RequestOptions]
|
|
787
|
+
Request-specific configuration.
|
|
788
|
+
|
|
789
|
+
Returns
|
|
790
|
+
-------
|
|
791
|
+
typing.Optional[typing.Any]
|
|
792
|
+
Successful Response
|
|
793
|
+
|
|
794
|
+
Examples
|
|
795
|
+
--------
|
|
796
|
+
from agenta import AgentaApi
|
|
514
797
|
|
|
515
798
|
client = AgentaApi(
|
|
516
799
|
api_key="YOUR_API_KEY",
|
|
@@ -523,28 +806,46 @@ class AgentaApi:
|
|
|
523
806
|
)
|
|
524
807
|
"""
|
|
525
808
|
_response = self._client_wrapper.httpx_client.request(
|
|
526
|
-
"
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
)
|
|
535
|
-
if 200 <= _response.status_code < 300:
|
|
536
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
537
|
-
if _response.status_code == 422:
|
|
538
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
809
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite/resend",
|
|
810
|
+
method="POST",
|
|
811
|
+
json={
|
|
812
|
+
"email": email,
|
|
813
|
+
},
|
|
814
|
+
request_options=request_options,
|
|
815
|
+
omit=OMIT,
|
|
816
|
+
)
|
|
539
817
|
try:
|
|
818
|
+
if 200 <= _response.status_code < 300:
|
|
819
|
+
return typing.cast(
|
|
820
|
+
typing.Optional[typing.Any],
|
|
821
|
+
parse_obj_as(
|
|
822
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
823
|
+
object_=_response.json(),
|
|
824
|
+
),
|
|
825
|
+
)
|
|
826
|
+
if _response.status_code == 422:
|
|
827
|
+
raise UnprocessableEntityError(
|
|
828
|
+
typing.cast(
|
|
829
|
+
HttpValidationError,
|
|
830
|
+
parse_obj_as(
|
|
831
|
+
type_=HttpValidationError, # type: ignore
|
|
832
|
+
object_=_response.json(),
|
|
833
|
+
),
|
|
834
|
+
)
|
|
835
|
+
)
|
|
540
836
|
_response_json = _response.json()
|
|
541
837
|
except JSONDecodeError:
|
|
542
838
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
543
839
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
544
840
|
|
|
545
841
|
def accept_invitation(
|
|
546
|
-
self,
|
|
547
|
-
|
|
842
|
+
self,
|
|
843
|
+
org_id: str,
|
|
844
|
+
workspace_id: str,
|
|
845
|
+
*,
|
|
846
|
+
token: str,
|
|
847
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
848
|
+
) -> typing.Optional[typing.Any]:
|
|
548
849
|
"""
|
|
549
850
|
Accept an invitation to a workspace.
|
|
550
851
|
|
|
@@ -556,14 +857,25 @@ class AgentaApi:
|
|
|
556
857
|
Returns:
|
|
557
858
|
JSONResponse: Accepted invitation to workspace; status_code: 200
|
|
558
859
|
|
|
559
|
-
Parameters
|
|
560
|
-
|
|
860
|
+
Parameters
|
|
861
|
+
----------
|
|
862
|
+
org_id : str
|
|
863
|
+
|
|
864
|
+
workspace_id : str
|
|
865
|
+
|
|
866
|
+
token : str
|
|
561
867
|
|
|
562
|
-
|
|
868
|
+
request_options : typing.Optional[RequestOptions]
|
|
869
|
+
Request-specific configuration.
|
|
563
870
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
871
|
+
Returns
|
|
872
|
+
-------
|
|
873
|
+
typing.Optional[typing.Any]
|
|
874
|
+
Successful Response
|
|
875
|
+
|
|
876
|
+
Examples
|
|
877
|
+
--------
|
|
878
|
+
from agenta import AgentaApi
|
|
567
879
|
|
|
568
880
|
client = AgentaApi(
|
|
569
881
|
api_key="YOUR_API_KEY",
|
|
@@ -576,20 +888,33 @@ class AgentaApi:
|
|
|
576
888
|
)
|
|
577
889
|
"""
|
|
578
890
|
_response = self._client_wrapper.httpx_client.request(
|
|
579
|
-
"
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
)
|
|
588
|
-
if 200 <= _response.status_code < 300:
|
|
589
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
590
|
-
if _response.status_code == 422:
|
|
591
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
891
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite/accept",
|
|
892
|
+
method="POST",
|
|
893
|
+
json={
|
|
894
|
+
"token": token,
|
|
895
|
+
},
|
|
896
|
+
request_options=request_options,
|
|
897
|
+
omit=OMIT,
|
|
898
|
+
)
|
|
592
899
|
try:
|
|
900
|
+
if 200 <= _response.status_code < 300:
|
|
901
|
+
return typing.cast(
|
|
902
|
+
typing.Optional[typing.Any],
|
|
903
|
+
parse_obj_as(
|
|
904
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
905
|
+
object_=_response.json(),
|
|
906
|
+
),
|
|
907
|
+
)
|
|
908
|
+
if _response.status_code == 422:
|
|
909
|
+
raise UnprocessableEntityError(
|
|
910
|
+
typing.cast(
|
|
911
|
+
HttpValidationError,
|
|
912
|
+
parse_obj_as(
|
|
913
|
+
type_=HttpValidationError, # type: ignore
|
|
914
|
+
object_=_response.json(),
|
|
915
|
+
),
|
|
916
|
+
)
|
|
917
|
+
)
|
|
593
918
|
_response_json = _response.json()
|
|
594
919
|
except JSONDecodeError:
|
|
595
920
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -602,18 +927,30 @@ class AgentaApi:
|
|
|
602
927
|
name: str,
|
|
603
928
|
description: typing.Optional[str] = OMIT,
|
|
604
929
|
type: typing.Optional[str] = OMIT,
|
|
930
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
605
931
|
) -> WorkspaceResponse:
|
|
606
932
|
"""
|
|
607
|
-
Parameters
|
|
608
|
-
|
|
933
|
+
Parameters
|
|
934
|
+
----------
|
|
935
|
+
org_id : str
|
|
936
|
+
|
|
937
|
+
name : str
|
|
938
|
+
|
|
939
|
+
description : typing.Optional[str]
|
|
940
|
+
|
|
941
|
+
type : typing.Optional[str]
|
|
609
942
|
|
|
610
|
-
|
|
943
|
+
request_options : typing.Optional[RequestOptions]
|
|
944
|
+
Request-specific configuration.
|
|
611
945
|
|
|
612
|
-
|
|
946
|
+
Returns
|
|
947
|
+
-------
|
|
948
|
+
WorkspaceResponse
|
|
949
|
+
Successful Response
|
|
613
950
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
from agenta
|
|
951
|
+
Examples
|
|
952
|
+
--------
|
|
953
|
+
from agenta import AgentaApi
|
|
617
954
|
|
|
618
955
|
client = AgentaApi(
|
|
619
956
|
api_key="YOUR_API_KEY",
|
|
@@ -624,26 +961,36 @@ class AgentaApi:
|
|
|
624
961
|
name="name",
|
|
625
962
|
)
|
|
626
963
|
"""
|
|
627
|
-
_request: typing.Dict[str, typing.Any] = {"name": name}
|
|
628
|
-
if description is not OMIT:
|
|
629
|
-
_request["description"] = description
|
|
630
|
-
if type is not OMIT:
|
|
631
|
-
_request["type"] = type
|
|
632
964
|
_response = self._client_wrapper.httpx_client.request(
|
|
633
|
-
"
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
return pydantic.parse_obj_as(WorkspaceResponse, _response.json()) # type: ignore
|
|
644
|
-
if _response.status_code == 422:
|
|
645
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
965
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces",
|
|
966
|
+
method="POST",
|
|
967
|
+
json={
|
|
968
|
+
"name": name,
|
|
969
|
+
"description": description,
|
|
970
|
+
"type": type,
|
|
971
|
+
},
|
|
972
|
+
request_options=request_options,
|
|
973
|
+
omit=OMIT,
|
|
974
|
+
)
|
|
646
975
|
try:
|
|
976
|
+
if 200 <= _response.status_code < 300:
|
|
977
|
+
return typing.cast(
|
|
978
|
+
WorkspaceResponse,
|
|
979
|
+
parse_obj_as(
|
|
980
|
+
type_=WorkspaceResponse, # type: ignore
|
|
981
|
+
object_=_response.json(),
|
|
982
|
+
),
|
|
983
|
+
)
|
|
984
|
+
if _response.status_code == 422:
|
|
985
|
+
raise UnprocessableEntityError(
|
|
986
|
+
typing.cast(
|
|
987
|
+
HttpValidationError,
|
|
988
|
+
parse_obj_as(
|
|
989
|
+
type_=HttpValidationError, # type: ignore
|
|
990
|
+
object_=_response.json(),
|
|
991
|
+
),
|
|
992
|
+
)
|
|
993
|
+
)
|
|
647
994
|
_response_json = _response.json()
|
|
648
995
|
except JSONDecodeError:
|
|
649
996
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -657,20 +1004,32 @@ class AgentaApi:
|
|
|
657
1004
|
name: typing.Optional[str] = OMIT,
|
|
658
1005
|
description: typing.Optional[str] = OMIT,
|
|
659
1006
|
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
1007
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
660
1008
|
) -> WorkspaceResponse:
|
|
661
1009
|
"""
|
|
662
|
-
Parameters
|
|
663
|
-
|
|
1010
|
+
Parameters
|
|
1011
|
+
----------
|
|
1012
|
+
org_id : str
|
|
1013
|
+
|
|
1014
|
+
workspace_id : str
|
|
1015
|
+
|
|
1016
|
+
name : typing.Optional[str]
|
|
1017
|
+
|
|
1018
|
+
description : typing.Optional[str]
|
|
664
1019
|
|
|
665
|
-
|
|
1020
|
+
updated_at : typing.Optional[dt.datetime]
|
|
666
1021
|
|
|
667
|
-
|
|
1022
|
+
request_options : typing.Optional[RequestOptions]
|
|
1023
|
+
Request-specific configuration.
|
|
668
1024
|
|
|
669
|
-
|
|
1025
|
+
Returns
|
|
1026
|
+
-------
|
|
1027
|
+
WorkspaceResponse
|
|
1028
|
+
Successful Response
|
|
670
1029
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
from agenta
|
|
1030
|
+
Examples
|
|
1031
|
+
--------
|
|
1032
|
+
from agenta import AgentaApi
|
|
674
1033
|
|
|
675
1034
|
client = AgentaApi(
|
|
676
1035
|
api_key="YOUR_API_KEY",
|
|
@@ -681,34 +1040,44 @@ class AgentaApi:
|
|
|
681
1040
|
workspace_id="workspace_id",
|
|
682
1041
|
)
|
|
683
1042
|
"""
|
|
684
|
-
_request: typing.Dict[str, typing.Any] = {}
|
|
685
|
-
if name is not OMIT:
|
|
686
|
-
_request["name"] = name
|
|
687
|
-
if description is not OMIT:
|
|
688
|
-
_request["description"] = description
|
|
689
|
-
if updated_at is not OMIT:
|
|
690
|
-
_request["updated_at"] = updated_at
|
|
691
1043
|
_response = self._client_wrapper.httpx_client.request(
|
|
692
|
-
"
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
return pydantic.parse_obj_as(WorkspaceResponse, _response.json()) # type: ignore
|
|
703
|
-
if _response.status_code == 422:
|
|
704
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1044
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}",
|
|
1045
|
+
method="PUT",
|
|
1046
|
+
json={
|
|
1047
|
+
"name": name,
|
|
1048
|
+
"description": description,
|
|
1049
|
+
"updated_at": updated_at,
|
|
1050
|
+
},
|
|
1051
|
+
request_options=request_options,
|
|
1052
|
+
omit=OMIT,
|
|
1053
|
+
)
|
|
705
1054
|
try:
|
|
1055
|
+
if 200 <= _response.status_code < 300:
|
|
1056
|
+
return typing.cast(
|
|
1057
|
+
WorkspaceResponse,
|
|
1058
|
+
parse_obj_as(
|
|
1059
|
+
type_=WorkspaceResponse, # type: ignore
|
|
1060
|
+
object_=_response.json(),
|
|
1061
|
+
),
|
|
1062
|
+
)
|
|
1063
|
+
if _response.status_code == 422:
|
|
1064
|
+
raise UnprocessableEntityError(
|
|
1065
|
+
typing.cast(
|
|
1066
|
+
HttpValidationError,
|
|
1067
|
+
parse_obj_as(
|
|
1068
|
+
type_=HttpValidationError, # type: ignore
|
|
1069
|
+
object_=_response.json(),
|
|
1070
|
+
),
|
|
1071
|
+
)
|
|
1072
|
+
)
|
|
706
1073
|
_response_json = _response.json()
|
|
707
1074
|
except JSONDecodeError:
|
|
708
1075
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
709
1076
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
710
1077
|
|
|
711
|
-
def get_all_workspace_roles(
|
|
1078
|
+
def get_all_workspace_roles(
|
|
1079
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1080
|
+
) -> typing.List[WorkspaceRoleResponse]:
|
|
712
1081
|
"""
|
|
713
1082
|
Get all workspace roles.
|
|
714
1083
|
|
|
@@ -720,8 +1089,19 @@ class AgentaApi:
|
|
|
720
1089
|
Raises:
|
|
721
1090
|
HTTPException: If an error occurs while retrieving the workspace roles.
|
|
722
1091
|
|
|
723
|
-
|
|
724
|
-
|
|
1092
|
+
Parameters
|
|
1093
|
+
----------
|
|
1094
|
+
request_options : typing.Optional[RequestOptions]
|
|
1095
|
+
Request-specific configuration.
|
|
1096
|
+
|
|
1097
|
+
Returns
|
|
1098
|
+
-------
|
|
1099
|
+
typing.List[WorkspaceRoleResponse]
|
|
1100
|
+
Successful Response
|
|
1101
|
+
|
|
1102
|
+
Examples
|
|
1103
|
+
--------
|
|
1104
|
+
from agenta import AgentaApi
|
|
725
1105
|
|
|
726
1106
|
client = AgentaApi(
|
|
727
1107
|
api_key="YOUR_API_KEY",
|
|
@@ -730,22 +1110,27 @@ class AgentaApi:
|
|
|
730
1110
|
client.get_all_workspace_roles()
|
|
731
1111
|
"""
|
|
732
1112
|
_response = self._client_wrapper.httpx_client.request(
|
|
733
|
-
"
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
headers=self._client_wrapper.get_headers(),
|
|
738
|
-
timeout=60,
|
|
739
|
-
)
|
|
740
|
-
if 200 <= _response.status_code < 300:
|
|
741
|
-
return pydantic.parse_obj_as(typing.List[WorkspaceRoleResponse], _response.json()) # type: ignore
|
|
1113
|
+
"workspaces/roles",
|
|
1114
|
+
method="GET",
|
|
1115
|
+
request_options=request_options,
|
|
1116
|
+
)
|
|
742
1117
|
try:
|
|
1118
|
+
if 200 <= _response.status_code < 300:
|
|
1119
|
+
return typing.cast(
|
|
1120
|
+
typing.List[WorkspaceRoleResponse],
|
|
1121
|
+
parse_obj_as(
|
|
1122
|
+
type_=typing.List[WorkspaceRoleResponse], # type: ignore
|
|
1123
|
+
object_=_response.json(),
|
|
1124
|
+
),
|
|
1125
|
+
)
|
|
743
1126
|
_response_json = _response.json()
|
|
744
1127
|
except JSONDecodeError:
|
|
745
1128
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
746
1129
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
747
1130
|
|
|
748
|
-
def get_all_workspace_permissions(
|
|
1131
|
+
def get_all_workspace_permissions(
|
|
1132
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1133
|
+
) -> typing.List[Permission]:
|
|
749
1134
|
"""
|
|
750
1135
|
Get all workspace permissions.
|
|
751
1136
|
|
|
@@ -757,8 +1142,19 @@ class AgentaApi:
|
|
|
757
1142
|
Raises:
|
|
758
1143
|
HTTPException: If there is an error retrieving the workspace permissions.
|
|
759
1144
|
|
|
760
|
-
|
|
761
|
-
|
|
1145
|
+
Parameters
|
|
1146
|
+
----------
|
|
1147
|
+
request_options : typing.Optional[RequestOptions]
|
|
1148
|
+
Request-specific configuration.
|
|
1149
|
+
|
|
1150
|
+
Returns
|
|
1151
|
+
-------
|
|
1152
|
+
typing.List[Permission]
|
|
1153
|
+
Successful Response
|
|
1154
|
+
|
|
1155
|
+
Examples
|
|
1156
|
+
--------
|
|
1157
|
+
from agenta import AgentaApi
|
|
762
1158
|
|
|
763
1159
|
client = AgentaApi(
|
|
764
1160
|
api_key="YOUR_API_KEY",
|
|
@@ -767,16 +1163,19 @@ class AgentaApi:
|
|
|
767
1163
|
client.get_all_workspace_permissions()
|
|
768
1164
|
"""
|
|
769
1165
|
_response = self._client_wrapper.httpx_client.request(
|
|
770
|
-
"
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
headers=self._client_wrapper.get_headers(),
|
|
775
|
-
timeout=60,
|
|
776
|
-
)
|
|
777
|
-
if 200 <= _response.status_code < 300:
|
|
778
|
-
return pydantic.parse_obj_as(typing.List[Permission], _response.json()) # type: ignore
|
|
1166
|
+
"workspaces/permissions",
|
|
1167
|
+
method="GET",
|
|
1168
|
+
request_options=request_options,
|
|
1169
|
+
)
|
|
779
1170
|
try:
|
|
1171
|
+
if 200 <= _response.status_code < 300:
|
|
1172
|
+
return typing.cast(
|
|
1173
|
+
typing.List[Permission],
|
|
1174
|
+
parse_obj_as(
|
|
1175
|
+
type_=typing.List[Permission], # type: ignore
|
|
1176
|
+
object_=_response.json(),
|
|
1177
|
+
),
|
|
1178
|
+
)
|
|
780
1179
|
_response_json = _response.json()
|
|
781
1180
|
except JSONDecodeError:
|
|
782
1181
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -788,7 +1187,8 @@ class AgentaApi:
|
|
|
788
1187
|
*,
|
|
789
1188
|
email: str,
|
|
790
1189
|
organization_id: str,
|
|
791
|
-
role: typing.Optional[
|
|
1190
|
+
role: typing.Optional[str] = OMIT,
|
|
1191
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
792
1192
|
) -> bool:
|
|
793
1193
|
"""
|
|
794
1194
|
Assigns a role to a user in a workspace.
|
|
@@ -805,16 +1205,27 @@ class AgentaApi:
|
|
|
805
1205
|
HTTPException: If the user does not have permission to perform this action.
|
|
806
1206
|
HTTPException: If there is an error assigning the role to the user.
|
|
807
1207
|
|
|
808
|
-
Parameters
|
|
809
|
-
|
|
1208
|
+
Parameters
|
|
1209
|
+
----------
|
|
1210
|
+
workspace_id : str
|
|
810
1211
|
|
|
811
|
-
|
|
1212
|
+
email : str
|
|
812
1213
|
|
|
813
|
-
|
|
1214
|
+
organization_id : str
|
|
814
1215
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
1216
|
+
role : typing.Optional[str]
|
|
1217
|
+
|
|
1218
|
+
request_options : typing.Optional[RequestOptions]
|
|
1219
|
+
Request-specific configuration.
|
|
1220
|
+
|
|
1221
|
+
Returns
|
|
1222
|
+
-------
|
|
1223
|
+
bool
|
|
1224
|
+
Successful Response
|
|
1225
|
+
|
|
1226
|
+
Examples
|
|
1227
|
+
--------
|
|
1228
|
+
from agenta import AgentaApi
|
|
818
1229
|
|
|
819
1230
|
client = AgentaApi(
|
|
820
1231
|
api_key="YOUR_API_KEY",
|
|
@@ -826,35 +1237,50 @@ class AgentaApi:
|
|
|
826
1237
|
organization_id="organization_id",
|
|
827
1238
|
)
|
|
828
1239
|
"""
|
|
829
|
-
_request: typing.Dict[str, typing.Any] = {
|
|
830
|
-
"email": email,
|
|
831
|
-
"organization_id": organization_id,
|
|
832
|
-
}
|
|
833
|
-
if role is not OMIT:
|
|
834
|
-
_request["role"] = role.value
|
|
835
1240
|
_response = self._client_wrapper.httpx_client.request(
|
|
836
|
-
"
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
return pydantic.parse_obj_as(bool, _response.json()) # type: ignore
|
|
847
|
-
if _response.status_code == 422:
|
|
848
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1241
|
+
f"workspaces/{jsonable_encoder(workspace_id)}/roles",
|
|
1242
|
+
method="POST",
|
|
1243
|
+
json={
|
|
1244
|
+
"email": email,
|
|
1245
|
+
"organization_id": organization_id,
|
|
1246
|
+
"role": role,
|
|
1247
|
+
},
|
|
1248
|
+
request_options=request_options,
|
|
1249
|
+
omit=OMIT,
|
|
1250
|
+
)
|
|
849
1251
|
try:
|
|
1252
|
+
if 200 <= _response.status_code < 300:
|
|
1253
|
+
return typing.cast(
|
|
1254
|
+
bool,
|
|
1255
|
+
parse_obj_as(
|
|
1256
|
+
type_=bool, # type: ignore
|
|
1257
|
+
object_=_response.json(),
|
|
1258
|
+
),
|
|
1259
|
+
)
|
|
1260
|
+
if _response.status_code == 422:
|
|
1261
|
+
raise UnprocessableEntityError(
|
|
1262
|
+
typing.cast(
|
|
1263
|
+
HttpValidationError,
|
|
1264
|
+
parse_obj_as(
|
|
1265
|
+
type_=HttpValidationError, # type: ignore
|
|
1266
|
+
object_=_response.json(),
|
|
1267
|
+
),
|
|
1268
|
+
)
|
|
1269
|
+
)
|
|
850
1270
|
_response_json = _response.json()
|
|
851
1271
|
except JSONDecodeError:
|
|
852
1272
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
853
1273
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
854
1274
|
|
|
855
1275
|
def unassign_role_from_user(
|
|
856
|
-
self,
|
|
857
|
-
|
|
1276
|
+
self,
|
|
1277
|
+
workspace_id: str,
|
|
1278
|
+
*,
|
|
1279
|
+
email: str,
|
|
1280
|
+
org_id: str,
|
|
1281
|
+
role: str,
|
|
1282
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1283
|
+
) -> typing.Optional[typing.Any]:
|
|
858
1284
|
"""
|
|
859
1285
|
Delete a role assignment from a user in a workspace.
|
|
860
1286
|
|
|
@@ -872,16 +1298,27 @@ class AgentaApi:
|
|
|
872
1298
|
HTTPException: If there is an error in the request or the user does not have permission to perform the action.
|
|
873
1299
|
HTTPException: If there is an error in updating the user's roles.
|
|
874
1300
|
|
|
875
|
-
Parameters
|
|
876
|
-
|
|
1301
|
+
Parameters
|
|
1302
|
+
----------
|
|
1303
|
+
workspace_id : str
|
|
877
1304
|
|
|
878
|
-
|
|
1305
|
+
email : str
|
|
879
1306
|
|
|
880
|
-
|
|
1307
|
+
org_id : str
|
|
881
1308
|
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
1309
|
+
role : str
|
|
1310
|
+
|
|
1311
|
+
request_options : typing.Optional[RequestOptions]
|
|
1312
|
+
Request-specific configuration.
|
|
1313
|
+
|
|
1314
|
+
Returns
|
|
1315
|
+
-------
|
|
1316
|
+
typing.Optional[typing.Any]
|
|
1317
|
+
Successful Response
|
|
1318
|
+
|
|
1319
|
+
Examples
|
|
1320
|
+
--------
|
|
1321
|
+
from agenta import AgentaApi
|
|
885
1322
|
|
|
886
1323
|
client = AgentaApi(
|
|
887
1324
|
api_key="YOUR_API_KEY",
|
|
@@ -895,29 +1332,46 @@ class AgentaApi:
|
|
|
895
1332
|
)
|
|
896
1333
|
"""
|
|
897
1334
|
_response = self._client_wrapper.httpx_client.request(
|
|
898
|
-
"
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
timeout=60,
|
|
908
|
-
)
|
|
909
|
-
if 200 <= _response.status_code < 300:
|
|
910
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
911
|
-
if _response.status_code == 422:
|
|
912
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1335
|
+
f"workspaces/{jsonable_encoder(workspace_id)}/roles",
|
|
1336
|
+
method="DELETE",
|
|
1337
|
+
params={
|
|
1338
|
+
"email": email,
|
|
1339
|
+
"org_id": org_id,
|
|
1340
|
+
"role": role,
|
|
1341
|
+
},
|
|
1342
|
+
request_options=request_options,
|
|
1343
|
+
)
|
|
913
1344
|
try:
|
|
1345
|
+
if 200 <= _response.status_code < 300:
|
|
1346
|
+
return typing.cast(
|
|
1347
|
+
typing.Optional[typing.Any],
|
|
1348
|
+
parse_obj_as(
|
|
1349
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1350
|
+
object_=_response.json(),
|
|
1351
|
+
),
|
|
1352
|
+
)
|
|
1353
|
+
if _response.status_code == 422:
|
|
1354
|
+
raise UnprocessableEntityError(
|
|
1355
|
+
typing.cast(
|
|
1356
|
+
HttpValidationError,
|
|
1357
|
+
parse_obj_as(
|
|
1358
|
+
type_=HttpValidationError, # type: ignore
|
|
1359
|
+
object_=_response.json(),
|
|
1360
|
+
),
|
|
1361
|
+
)
|
|
1362
|
+
)
|
|
914
1363
|
_response_json = _response.json()
|
|
915
1364
|
except JSONDecodeError:
|
|
916
1365
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
917
1366
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
918
1367
|
|
|
919
1368
|
def remove_user_from_workspace(
|
|
920
|
-
self,
|
|
1369
|
+
self,
|
|
1370
|
+
workspace_id: str,
|
|
1371
|
+
*,
|
|
1372
|
+
org_id: str,
|
|
1373
|
+
email: str,
|
|
1374
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
921
1375
|
) -> WorkspaceResponse:
|
|
922
1376
|
"""
|
|
923
1377
|
Remove a user from a workspace.
|
|
@@ -937,14 +1391,25 @@ class AgentaApi:
|
|
|
937
1391
|
- HTTPException: If the user does not have permission to perform this action.
|
|
938
1392
|
- HTTPException: If there is an error during the removal process.
|
|
939
1393
|
|
|
940
|
-
Parameters
|
|
941
|
-
|
|
1394
|
+
Parameters
|
|
1395
|
+
----------
|
|
1396
|
+
workspace_id : str
|
|
942
1397
|
|
|
943
|
-
|
|
1398
|
+
org_id : str
|
|
944
1399
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1400
|
+
email : str
|
|
1401
|
+
|
|
1402
|
+
request_options : typing.Optional[RequestOptions]
|
|
1403
|
+
Request-specific configuration.
|
|
1404
|
+
|
|
1405
|
+
Returns
|
|
1406
|
+
-------
|
|
1407
|
+
WorkspaceResponse
|
|
1408
|
+
Successful Response
|
|
1409
|
+
|
|
1410
|
+
Examples
|
|
1411
|
+
--------
|
|
1412
|
+
from agenta import AgentaApi
|
|
948
1413
|
|
|
949
1414
|
client = AgentaApi(
|
|
950
1415
|
api_key="YOUR_API_KEY",
|
|
@@ -957,28 +1422,55 @@ class AgentaApi:
|
|
|
957
1422
|
)
|
|
958
1423
|
"""
|
|
959
1424
|
_response = self._client_wrapper.httpx_client.request(
|
|
960
|
-
"
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
)
|
|
969
|
-
if 200 <= _response.status_code < 300:
|
|
970
|
-
return pydantic.parse_obj_as(WorkspaceResponse, _response.json()) # type: ignore
|
|
971
|
-
if _response.status_code == 422:
|
|
972
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1425
|
+
f"workspaces/{jsonable_encoder(workspace_id)}/users",
|
|
1426
|
+
method="DELETE",
|
|
1427
|
+
params={
|
|
1428
|
+
"org_id": org_id,
|
|
1429
|
+
"email": email,
|
|
1430
|
+
},
|
|
1431
|
+
request_options=request_options,
|
|
1432
|
+
)
|
|
973
1433
|
try:
|
|
1434
|
+
if 200 <= _response.status_code < 300:
|
|
1435
|
+
return typing.cast(
|
|
1436
|
+
WorkspaceResponse,
|
|
1437
|
+
parse_obj_as(
|
|
1438
|
+
type_=WorkspaceResponse, # type: ignore
|
|
1439
|
+
object_=_response.json(),
|
|
1440
|
+
),
|
|
1441
|
+
)
|
|
1442
|
+
if _response.status_code == 422:
|
|
1443
|
+
raise UnprocessableEntityError(
|
|
1444
|
+
typing.cast(
|
|
1445
|
+
HttpValidationError,
|
|
1446
|
+
parse_obj_as(
|
|
1447
|
+
type_=HttpValidationError, # type: ignore
|
|
1448
|
+
object_=_response.json(),
|
|
1449
|
+
),
|
|
1450
|
+
)
|
|
1451
|
+
)
|
|
974
1452
|
_response_json = _response.json()
|
|
975
1453
|
except JSONDecodeError:
|
|
976
1454
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
977
1455
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
978
1456
|
|
|
979
|
-
def health_check(
|
|
1457
|
+
def health_check(
|
|
1458
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1459
|
+
) -> typing.Optional[typing.Any]:
|
|
980
1460
|
"""
|
|
981
|
-
|
|
1461
|
+
Parameters
|
|
1462
|
+
----------
|
|
1463
|
+
request_options : typing.Optional[RequestOptions]
|
|
1464
|
+
Request-specific configuration.
|
|
1465
|
+
|
|
1466
|
+
Returns
|
|
1467
|
+
-------
|
|
1468
|
+
typing.Optional[typing.Any]
|
|
1469
|
+
Successful Response
|
|
1470
|
+
|
|
1471
|
+
Examples
|
|
1472
|
+
--------
|
|
1473
|
+
from agenta import AgentaApi
|
|
982
1474
|
|
|
983
1475
|
client = AgentaApi(
|
|
984
1476
|
api_key="YOUR_API_KEY",
|
|
@@ -987,38 +1479,80 @@ class AgentaApi:
|
|
|
987
1479
|
client.health_check()
|
|
988
1480
|
"""
|
|
989
1481
|
_response = self._client_wrapper.httpx_client.request(
|
|
990
|
-
"
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
timeout=60,
|
|
1482
|
+
"health",
|
|
1483
|
+
method="GET",
|
|
1484
|
+
request_options=request_options,
|
|
994
1485
|
)
|
|
995
|
-
if 200 <= _response.status_code < 300:
|
|
996
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
997
1486
|
try:
|
|
1487
|
+
if 200 <= _response.status_code < 300:
|
|
1488
|
+
return typing.cast(
|
|
1489
|
+
typing.Optional[typing.Any],
|
|
1490
|
+
parse_obj_as(
|
|
1491
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1492
|
+
object_=_response.json(),
|
|
1493
|
+
),
|
|
1494
|
+
)
|
|
998
1495
|
_response_json = _response.json()
|
|
999
1496
|
except JSONDecodeError:
|
|
1000
1497
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1001
1498
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1002
1499
|
|
|
1003
|
-
def
|
|
1500
|
+
def fetch_user_profile(
|
|
1501
|
+
self,
|
|
1502
|
+
*,
|
|
1503
|
+
user_id: typing.Optional[str] = None,
|
|
1504
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1505
|
+
) -> typing.Optional[typing.Any]:
|
|
1004
1506
|
"""
|
|
1005
|
-
|
|
1507
|
+
Parameters
|
|
1508
|
+
----------
|
|
1509
|
+
user_id : typing.Optional[str]
|
|
1510
|
+
|
|
1511
|
+
request_options : typing.Optional[RequestOptions]
|
|
1512
|
+
Request-specific configuration.
|
|
1513
|
+
|
|
1514
|
+
Returns
|
|
1515
|
+
-------
|
|
1516
|
+
typing.Optional[typing.Any]
|
|
1517
|
+
Successful Response
|
|
1518
|
+
|
|
1519
|
+
Examples
|
|
1520
|
+
--------
|
|
1521
|
+
from agenta import AgentaApi
|
|
1006
1522
|
|
|
1007
1523
|
client = AgentaApi(
|
|
1008
1524
|
api_key="YOUR_API_KEY",
|
|
1009
1525
|
base_url="https://yourhost.com/path/to/api",
|
|
1010
1526
|
)
|
|
1011
|
-
client.
|
|
1527
|
+
client.fetch_user_profile()
|
|
1012
1528
|
"""
|
|
1013
1529
|
_response = self._client_wrapper.httpx_client.request(
|
|
1014
|
-
"
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1530
|
+
"profile",
|
|
1531
|
+
method="GET",
|
|
1532
|
+
params={
|
|
1533
|
+
"user_id": user_id,
|
|
1534
|
+
},
|
|
1535
|
+
request_options=request_options,
|
|
1018
1536
|
)
|
|
1019
|
-
if 200 <= _response.status_code < 300:
|
|
1020
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
1021
1537
|
try:
|
|
1538
|
+
if 200 <= _response.status_code < 300:
|
|
1539
|
+
return typing.cast(
|
|
1540
|
+
typing.Optional[typing.Any],
|
|
1541
|
+
parse_obj_as(
|
|
1542
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1543
|
+
object_=_response.json(),
|
|
1544
|
+
),
|
|
1545
|
+
)
|
|
1546
|
+
if _response.status_code == 422:
|
|
1547
|
+
raise UnprocessableEntityError(
|
|
1548
|
+
typing.cast(
|
|
1549
|
+
HttpValidationError,
|
|
1550
|
+
parse_obj_as(
|
|
1551
|
+
type_=HttpValidationError, # type: ignore
|
|
1552
|
+
object_=_response.json(),
|
|
1553
|
+
),
|
|
1554
|
+
)
|
|
1555
|
+
)
|
|
1022
1556
|
_response_json = _response.json()
|
|
1023
1557
|
except JSONDecodeError:
|
|
1024
1558
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1026,22 +1560,57 @@ class AgentaApi:
|
|
|
1026
1560
|
|
|
1027
1561
|
|
|
1028
1562
|
class AsyncAgentaApi:
|
|
1563
|
+
"""
|
|
1564
|
+
Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.
|
|
1565
|
+
|
|
1566
|
+
Parameters
|
|
1567
|
+
----------
|
|
1568
|
+
base_url : str
|
|
1569
|
+
The base url to use for requests from the client.
|
|
1570
|
+
|
|
1571
|
+
api_key : str
|
|
1572
|
+
timeout : typing.Optional[float]
|
|
1573
|
+
The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
|
|
1574
|
+
|
|
1575
|
+
follow_redirects : typing.Optional[bool]
|
|
1576
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
1577
|
+
|
|
1578
|
+
httpx_client : typing.Optional[httpx.AsyncClient]
|
|
1579
|
+
The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
|
1580
|
+
|
|
1581
|
+
Examples
|
|
1582
|
+
--------
|
|
1583
|
+
from agenta import AsyncAgentaApi
|
|
1584
|
+
|
|
1585
|
+
client = AsyncAgentaApi(
|
|
1586
|
+
api_key="YOUR_API_KEY",
|
|
1587
|
+
base_url="https://yourhost.com/path/to/api",
|
|
1588
|
+
)
|
|
1589
|
+
"""
|
|
1590
|
+
|
|
1029
1591
|
def __init__(
|
|
1030
1592
|
self,
|
|
1031
1593
|
*,
|
|
1032
1594
|
base_url: str,
|
|
1033
1595
|
api_key: str,
|
|
1034
|
-
timeout: typing.Optional[float] =
|
|
1596
|
+
timeout: typing.Optional[float] = None,
|
|
1597
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
1035
1598
|
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
|
1036
1599
|
):
|
|
1600
|
+
_defaulted_timeout = (
|
|
1601
|
+
timeout if timeout is not None else 60 if httpx_client is None else None
|
|
1602
|
+
)
|
|
1037
1603
|
self._client_wrapper = AsyncClientWrapper(
|
|
1038
1604
|
base_url=base_url,
|
|
1039
1605
|
api_key=api_key,
|
|
1040
|
-
httpx_client=
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
)
|
|
1606
|
+
httpx_client=httpx_client
|
|
1607
|
+
if httpx_client is not None
|
|
1608
|
+
else httpx.AsyncClient(
|
|
1609
|
+
timeout=_defaulted_timeout, follow_redirects=follow_redirects
|
|
1610
|
+
)
|
|
1611
|
+
if follow_redirects is not None
|
|
1612
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
|
1613
|
+
timeout=_defaulted_timeout,
|
|
1045
1614
|
)
|
|
1046
1615
|
self.observability = AsyncObservabilityClient(
|
|
1047
1616
|
client_wrapper=self._client_wrapper
|
|
@@ -1056,7 +1625,9 @@ class AsyncAgentaApi:
|
|
|
1056
1625
|
self.bases = AsyncBasesClient(client_wrapper=self._client_wrapper)
|
|
1057
1626
|
self.configs = AsyncConfigsClient(client_wrapper=self._client_wrapper)
|
|
1058
1627
|
|
|
1059
|
-
async def list_api_keys(
|
|
1628
|
+
async def list_api_keys(
|
|
1629
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1630
|
+
) -> typing.List[ListApiKeysResponse]:
|
|
1060
1631
|
"""
|
|
1061
1632
|
List all API keys associated with the authenticated user.
|
|
1062
1633
|
|
|
@@ -1066,30 +1637,59 @@ class AsyncAgentaApi:
|
|
|
1066
1637
|
Returns:
|
|
1067
1638
|
List[ListAPIKeysResponse]: A list of API Keys associated with the user.
|
|
1068
1639
|
|
|
1069
|
-
|
|
1070
|
-
|
|
1640
|
+
Parameters
|
|
1641
|
+
----------
|
|
1642
|
+
request_options : typing.Optional[RequestOptions]
|
|
1643
|
+
Request-specific configuration.
|
|
1644
|
+
|
|
1645
|
+
Returns
|
|
1646
|
+
-------
|
|
1647
|
+
typing.List[ListApiKeysResponse]
|
|
1648
|
+
Successful Response
|
|
1649
|
+
|
|
1650
|
+
Examples
|
|
1651
|
+
--------
|
|
1652
|
+
import asyncio
|
|
1653
|
+
|
|
1654
|
+
from agenta import AsyncAgentaApi
|
|
1071
1655
|
|
|
1072
1656
|
client = AsyncAgentaApi(
|
|
1073
1657
|
api_key="YOUR_API_KEY",
|
|
1074
1658
|
base_url="https://yourhost.com/path/to/api",
|
|
1075
1659
|
)
|
|
1076
|
-
|
|
1660
|
+
|
|
1661
|
+
|
|
1662
|
+
async def main() -> None:
|
|
1663
|
+
await client.list_api_keys()
|
|
1664
|
+
|
|
1665
|
+
|
|
1666
|
+
asyncio.run(main())
|
|
1077
1667
|
"""
|
|
1078
1668
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1079
|
-
"
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
timeout=60,
|
|
1669
|
+
"keys",
|
|
1670
|
+
method="GET",
|
|
1671
|
+
request_options=request_options,
|
|
1083
1672
|
)
|
|
1084
|
-
if 200 <= _response.status_code < 300:
|
|
1085
|
-
return pydantic.parse_obj_as(typing.List[ListApiKeysResponse], _response.json()) # type: ignore
|
|
1086
1673
|
try:
|
|
1674
|
+
if 200 <= _response.status_code < 300:
|
|
1675
|
+
return typing.cast(
|
|
1676
|
+
typing.List[ListApiKeysResponse],
|
|
1677
|
+
parse_obj_as(
|
|
1678
|
+
type_=typing.List[ListApiKeysResponse], # type: ignore
|
|
1679
|
+
object_=_response.json(),
|
|
1680
|
+
),
|
|
1681
|
+
)
|
|
1087
1682
|
_response_json = _response.json()
|
|
1088
1683
|
except JSONDecodeError:
|
|
1089
1684
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1090
1685
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1091
1686
|
|
|
1092
|
-
async def create_api_key(
|
|
1687
|
+
async def create_api_key(
|
|
1688
|
+
self,
|
|
1689
|
+
*,
|
|
1690
|
+
workspace_id: str,
|
|
1691
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1692
|
+
) -> str:
|
|
1093
1693
|
"""
|
|
1094
1694
|
Creates an API key for a user.
|
|
1095
1695
|
|
|
@@ -1099,37 +1699,76 @@ class AsyncAgentaApi:
|
|
|
1099
1699
|
Returns:
|
|
1100
1700
|
str: The created API key.
|
|
1101
1701
|
|
|
1102
|
-
Parameters
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1702
|
+
Parameters
|
|
1703
|
+
----------
|
|
1704
|
+
workspace_id : str
|
|
1705
|
+
|
|
1706
|
+
request_options : typing.Optional[RequestOptions]
|
|
1707
|
+
Request-specific configuration.
|
|
1708
|
+
|
|
1709
|
+
Returns
|
|
1710
|
+
-------
|
|
1711
|
+
str
|
|
1712
|
+
Successful Response
|
|
1713
|
+
|
|
1714
|
+
Examples
|
|
1715
|
+
--------
|
|
1716
|
+
import asyncio
|
|
1717
|
+
|
|
1718
|
+
from agenta import AsyncAgentaApi
|
|
1106
1719
|
|
|
1107
1720
|
client = AsyncAgentaApi(
|
|
1108
1721
|
api_key="YOUR_API_KEY",
|
|
1109
1722
|
base_url="https://yourhost.com/path/to/api",
|
|
1110
1723
|
)
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
)
|
|
1724
|
+
|
|
1725
|
+
|
|
1726
|
+
async def main() -> None:
|
|
1727
|
+
await client.create_api_key(
|
|
1728
|
+
workspace_id="workspace_id",
|
|
1729
|
+
)
|
|
1730
|
+
|
|
1731
|
+
|
|
1732
|
+
asyncio.run(main())
|
|
1114
1733
|
"""
|
|
1115
1734
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1116
|
-
"
|
|
1117
|
-
|
|
1118
|
-
params=
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
return pydantic.parse_obj_as(str, _response.json()) # type: ignore
|
|
1124
|
-
if _response.status_code == 422:
|
|
1125
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1735
|
+
"keys",
|
|
1736
|
+
method="POST",
|
|
1737
|
+
params={
|
|
1738
|
+
"workspace_id": workspace_id,
|
|
1739
|
+
},
|
|
1740
|
+
request_options=request_options,
|
|
1741
|
+
)
|
|
1126
1742
|
try:
|
|
1743
|
+
if 200 <= _response.status_code < 300:
|
|
1744
|
+
return typing.cast(
|
|
1745
|
+
str,
|
|
1746
|
+
parse_obj_as(
|
|
1747
|
+
type_=str, # type: ignore
|
|
1748
|
+
object_=_response.json(),
|
|
1749
|
+
),
|
|
1750
|
+
)
|
|
1751
|
+
if _response.status_code == 422:
|
|
1752
|
+
raise UnprocessableEntityError(
|
|
1753
|
+
typing.cast(
|
|
1754
|
+
HttpValidationError,
|
|
1755
|
+
parse_obj_as(
|
|
1756
|
+
type_=HttpValidationError, # type: ignore
|
|
1757
|
+
object_=_response.json(),
|
|
1758
|
+
),
|
|
1759
|
+
)
|
|
1760
|
+
)
|
|
1127
1761
|
_response_json = _response.json()
|
|
1128
1762
|
except JSONDecodeError:
|
|
1129
1763
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1130
1764
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1131
1765
|
|
|
1132
|
-
async def delete_api_key(
|
|
1766
|
+
async def delete_api_key(
|
|
1767
|
+
self,
|
|
1768
|
+
key_prefix: str,
|
|
1769
|
+
*,
|
|
1770
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1771
|
+
) -> typing.Dict[str, typing.Optional[typing.Any]]:
|
|
1133
1772
|
"""
|
|
1134
1773
|
Delete an API key with the given key prefix for the authenticated user.
|
|
1135
1774
|
|
|
@@ -1143,75 +1782,142 @@ class AsyncAgentaApi:
|
|
|
1143
1782
|
Raises:
|
|
1144
1783
|
HTTPException: If the API key is not found or does not belong to the user.
|
|
1145
1784
|
|
|
1146
|
-
Parameters
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1785
|
+
Parameters
|
|
1786
|
+
----------
|
|
1787
|
+
key_prefix : str
|
|
1788
|
+
|
|
1789
|
+
request_options : typing.Optional[RequestOptions]
|
|
1790
|
+
Request-specific configuration.
|
|
1791
|
+
|
|
1792
|
+
Returns
|
|
1793
|
+
-------
|
|
1794
|
+
typing.Dict[str, typing.Optional[typing.Any]]
|
|
1795
|
+
Successful Response
|
|
1796
|
+
|
|
1797
|
+
Examples
|
|
1798
|
+
--------
|
|
1799
|
+
import asyncio
|
|
1800
|
+
|
|
1801
|
+
from agenta import AsyncAgentaApi
|
|
1150
1802
|
|
|
1151
1803
|
client = AsyncAgentaApi(
|
|
1152
1804
|
api_key="YOUR_API_KEY",
|
|
1153
1805
|
base_url="https://yourhost.com/path/to/api",
|
|
1154
1806
|
)
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
)
|
|
1807
|
+
|
|
1808
|
+
|
|
1809
|
+
async def main() -> None:
|
|
1810
|
+
await client.delete_api_key(
|
|
1811
|
+
key_prefix="key_prefix",
|
|
1812
|
+
)
|
|
1813
|
+
|
|
1814
|
+
|
|
1815
|
+
asyncio.run(main())
|
|
1158
1816
|
"""
|
|
1159
1817
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1160
|
-
"
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
headers=self._client_wrapper.get_headers(),
|
|
1165
|
-
timeout=60,
|
|
1166
|
-
)
|
|
1167
|
-
if 200 <= _response.status_code < 300:
|
|
1168
|
-
return pydantic.parse_obj_as(typing.Dict[str, typing.Any], _response.json()) # type: ignore
|
|
1169
|
-
if _response.status_code == 422:
|
|
1170
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1818
|
+
f"keys/{jsonable_encoder(key_prefix)}",
|
|
1819
|
+
method="DELETE",
|
|
1820
|
+
request_options=request_options,
|
|
1821
|
+
)
|
|
1171
1822
|
try:
|
|
1823
|
+
if 200 <= _response.status_code < 300:
|
|
1824
|
+
return typing.cast(
|
|
1825
|
+
typing.Dict[str, typing.Optional[typing.Any]],
|
|
1826
|
+
parse_obj_as(
|
|
1827
|
+
type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
|
|
1828
|
+
object_=_response.json(),
|
|
1829
|
+
),
|
|
1830
|
+
)
|
|
1831
|
+
if _response.status_code == 422:
|
|
1832
|
+
raise UnprocessableEntityError(
|
|
1833
|
+
typing.cast(
|
|
1834
|
+
HttpValidationError,
|
|
1835
|
+
parse_obj_as(
|
|
1836
|
+
type_=HttpValidationError, # type: ignore
|
|
1837
|
+
object_=_response.json(),
|
|
1838
|
+
),
|
|
1839
|
+
)
|
|
1840
|
+
)
|
|
1172
1841
|
_response_json = _response.json()
|
|
1173
1842
|
except JSONDecodeError:
|
|
1174
1843
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1175
1844
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1176
1845
|
|
|
1177
|
-
async def validate_api_key(
|
|
1846
|
+
async def validate_api_key(
|
|
1847
|
+
self,
|
|
1848
|
+
key_prefix: str,
|
|
1849
|
+
*,
|
|
1850
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1851
|
+
) -> bool:
|
|
1178
1852
|
"""
|
|
1179
1853
|
This Function is called by the CLI and is used to validate an API key provided by a user in agenta init setup.
|
|
1180
1854
|
Returns:
|
|
1181
1855
|
bool: True. If the request reaches this point, the API key is valid.
|
|
1182
1856
|
|
|
1183
|
-
Parameters
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1857
|
+
Parameters
|
|
1858
|
+
----------
|
|
1859
|
+
key_prefix : str
|
|
1860
|
+
|
|
1861
|
+
request_options : typing.Optional[RequestOptions]
|
|
1862
|
+
Request-specific configuration.
|
|
1863
|
+
|
|
1864
|
+
Returns
|
|
1865
|
+
-------
|
|
1866
|
+
bool
|
|
1867
|
+
Successful Response
|
|
1868
|
+
|
|
1869
|
+
Examples
|
|
1870
|
+
--------
|
|
1871
|
+
import asyncio
|
|
1872
|
+
|
|
1873
|
+
from agenta import AsyncAgentaApi
|
|
1187
1874
|
|
|
1188
1875
|
client = AsyncAgentaApi(
|
|
1189
1876
|
api_key="YOUR_API_KEY",
|
|
1190
1877
|
base_url="https://yourhost.com/path/to/api",
|
|
1191
1878
|
)
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
)
|
|
1879
|
+
|
|
1880
|
+
|
|
1881
|
+
async def main() -> None:
|
|
1882
|
+
await client.validate_api_key(
|
|
1883
|
+
key_prefix="key_prefix",
|
|
1884
|
+
)
|
|
1885
|
+
|
|
1886
|
+
|
|
1887
|
+
asyncio.run(main())
|
|
1195
1888
|
"""
|
|
1196
1889
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1197
|
-
"
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
headers=self._client_wrapper.get_headers(),
|
|
1202
|
-
timeout=60,
|
|
1203
|
-
)
|
|
1204
|
-
if 200 <= _response.status_code < 300:
|
|
1205
|
-
return pydantic.parse_obj_as(bool, _response.json()) # type: ignore
|
|
1206
|
-
if _response.status_code == 422:
|
|
1207
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1890
|
+
f"keys/{jsonable_encoder(key_prefix)}/validate",
|
|
1891
|
+
method="GET",
|
|
1892
|
+
request_options=request_options,
|
|
1893
|
+
)
|
|
1208
1894
|
try:
|
|
1895
|
+
if 200 <= _response.status_code < 300:
|
|
1896
|
+
return typing.cast(
|
|
1897
|
+
bool,
|
|
1898
|
+
parse_obj_as(
|
|
1899
|
+
type_=bool, # type: ignore
|
|
1900
|
+
object_=_response.json(),
|
|
1901
|
+
),
|
|
1902
|
+
)
|
|
1903
|
+
if _response.status_code == 422:
|
|
1904
|
+
raise UnprocessableEntityError(
|
|
1905
|
+
typing.cast(
|
|
1906
|
+
HttpValidationError,
|
|
1907
|
+
parse_obj_as(
|
|
1908
|
+
type_=HttpValidationError, # type: ignore
|
|
1909
|
+
object_=_response.json(),
|
|
1910
|
+
),
|
|
1911
|
+
)
|
|
1912
|
+
)
|
|
1209
1913
|
_response_json = _response.json()
|
|
1210
1914
|
except JSONDecodeError:
|
|
1211
1915
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1212
1916
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1213
1917
|
|
|
1214
|
-
async def list_organizations(
|
|
1918
|
+
async def list_organizations(
|
|
1919
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
1920
|
+
) -> typing.List[Organization]:
|
|
1215
1921
|
"""
|
|
1216
1922
|
Returns a list of organizations associated with the user's session.
|
|
1217
1923
|
|
|
@@ -1224,26 +1930,48 @@ class AsyncAgentaApi:
|
|
|
1224
1930
|
Raises:
|
|
1225
1931
|
HTTPException: If there is an error retrieving the organizations from the database.
|
|
1226
1932
|
|
|
1227
|
-
|
|
1228
|
-
|
|
1933
|
+
Parameters
|
|
1934
|
+
----------
|
|
1935
|
+
request_options : typing.Optional[RequestOptions]
|
|
1936
|
+
Request-specific configuration.
|
|
1937
|
+
|
|
1938
|
+
Returns
|
|
1939
|
+
-------
|
|
1940
|
+
typing.List[Organization]
|
|
1941
|
+
Successful Response
|
|
1942
|
+
|
|
1943
|
+
Examples
|
|
1944
|
+
--------
|
|
1945
|
+
import asyncio
|
|
1946
|
+
|
|
1947
|
+
from agenta import AsyncAgentaApi
|
|
1229
1948
|
|
|
1230
1949
|
client = AsyncAgentaApi(
|
|
1231
1950
|
api_key="YOUR_API_KEY",
|
|
1232
1951
|
base_url="https://yourhost.com/path/to/api",
|
|
1233
1952
|
)
|
|
1234
|
-
|
|
1953
|
+
|
|
1954
|
+
|
|
1955
|
+
async def main() -> None:
|
|
1956
|
+
await client.list_organizations()
|
|
1957
|
+
|
|
1958
|
+
|
|
1959
|
+
asyncio.run(main())
|
|
1235
1960
|
"""
|
|
1236
1961
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1237
|
-
"
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
headers=self._client_wrapper.get_headers(),
|
|
1242
|
-
timeout=60,
|
|
1243
|
-
)
|
|
1244
|
-
if 200 <= _response.status_code < 300:
|
|
1245
|
-
return pydantic.parse_obj_as(typing.List[Organization], _response.json()) # type: ignore
|
|
1962
|
+
"organizations",
|
|
1963
|
+
method="GET",
|
|
1964
|
+
request_options=request_options,
|
|
1965
|
+
)
|
|
1246
1966
|
try:
|
|
1967
|
+
if 200 <= _response.status_code < 300:
|
|
1968
|
+
return typing.cast(
|
|
1969
|
+
typing.List[Organization],
|
|
1970
|
+
parse_obj_as(
|
|
1971
|
+
type_=typing.List[Organization], # type: ignore
|
|
1972
|
+
object_=_response.json(),
|
|
1973
|
+
),
|
|
1974
|
+
)
|
|
1247
1975
|
_response_json = _response.json()
|
|
1248
1976
|
except JSONDecodeError:
|
|
1249
1977
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1253,83 +1981,141 @@ class AsyncAgentaApi:
|
|
|
1253
1981
|
self,
|
|
1254
1982
|
*,
|
|
1255
1983
|
name: str,
|
|
1984
|
+
owner: str,
|
|
1256
1985
|
description: typing.Optional[str] = OMIT,
|
|
1257
1986
|
type: typing.Optional[str] = OMIT,
|
|
1258
|
-
|
|
1259
|
-
) -> typing.Any:
|
|
1987
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1988
|
+
) -> typing.Optional[typing.Any]:
|
|
1260
1989
|
"""
|
|
1261
|
-
Parameters
|
|
1262
|
-
|
|
1990
|
+
Parameters
|
|
1991
|
+
----------
|
|
1992
|
+
name : str
|
|
1993
|
+
|
|
1994
|
+
owner : str
|
|
1263
1995
|
|
|
1264
|
-
|
|
1996
|
+
description : typing.Optional[str]
|
|
1265
1997
|
|
|
1266
|
-
|
|
1998
|
+
type : typing.Optional[str]
|
|
1267
1999
|
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
2000
|
+
request_options : typing.Optional[RequestOptions]
|
|
2001
|
+
Request-specific configuration.
|
|
2002
|
+
|
|
2003
|
+
Returns
|
|
2004
|
+
-------
|
|
2005
|
+
typing.Optional[typing.Any]
|
|
2006
|
+
Successful Response
|
|
2007
|
+
|
|
2008
|
+
Examples
|
|
2009
|
+
--------
|
|
2010
|
+
import asyncio
|
|
2011
|
+
|
|
2012
|
+
from agenta import AsyncAgentaApi
|
|
1271
2013
|
|
|
1272
2014
|
client = AsyncAgentaApi(
|
|
1273
2015
|
api_key="YOUR_API_KEY",
|
|
1274
2016
|
base_url="https://yourhost.com/path/to/api",
|
|
1275
2017
|
)
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
)
|
|
2018
|
+
|
|
2019
|
+
|
|
2020
|
+
async def main() -> None:
|
|
2021
|
+
await client.create_organization(
|
|
2022
|
+
name="name",
|
|
2023
|
+
owner="owner",
|
|
2024
|
+
)
|
|
2025
|
+
|
|
2026
|
+
|
|
2027
|
+
asyncio.run(main())
|
|
1279
2028
|
"""
|
|
1280
|
-
_request: typing.Dict[str, typing.Any] = {"name": name}
|
|
1281
|
-
if description is not OMIT:
|
|
1282
|
-
_request["description"] = description
|
|
1283
|
-
if type is not OMIT:
|
|
1284
|
-
_request["type"] = type
|
|
1285
|
-
if owner is not OMIT:
|
|
1286
|
-
_request["owner"] = owner
|
|
1287
2029
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1288
|
-
"
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2030
|
+
"organizations",
|
|
2031
|
+
method="POST",
|
|
2032
|
+
json={
|
|
2033
|
+
"name": name,
|
|
2034
|
+
"owner": owner,
|
|
2035
|
+
"description": description,
|
|
2036
|
+
"type": type,
|
|
2037
|
+
},
|
|
2038
|
+
request_options=request_options,
|
|
2039
|
+
omit=OMIT,
|
|
2040
|
+
)
|
|
1300
2041
|
try:
|
|
2042
|
+
if 200 <= _response.status_code < 300:
|
|
2043
|
+
return typing.cast(
|
|
2044
|
+
typing.Optional[typing.Any],
|
|
2045
|
+
parse_obj_as(
|
|
2046
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2047
|
+
object_=_response.json(),
|
|
2048
|
+
),
|
|
2049
|
+
)
|
|
2050
|
+
if _response.status_code == 422:
|
|
2051
|
+
raise UnprocessableEntityError(
|
|
2052
|
+
typing.cast(
|
|
2053
|
+
HttpValidationError,
|
|
2054
|
+
parse_obj_as(
|
|
2055
|
+
type_=HttpValidationError, # type: ignore
|
|
2056
|
+
object_=_response.json(),
|
|
2057
|
+
),
|
|
2058
|
+
)
|
|
2059
|
+
)
|
|
1301
2060
|
_response_json = _response.json()
|
|
1302
2061
|
except JSONDecodeError:
|
|
1303
2062
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1304
2063
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1305
2064
|
|
|
1306
|
-
async def get_own_org(
|
|
2065
|
+
async def get_own_org(
|
|
2066
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
2067
|
+
) -> OrganizationOutput:
|
|
1307
2068
|
"""
|
|
1308
|
-
|
|
2069
|
+
Parameters
|
|
2070
|
+
----------
|
|
2071
|
+
request_options : typing.Optional[RequestOptions]
|
|
2072
|
+
Request-specific configuration.
|
|
2073
|
+
|
|
2074
|
+
Returns
|
|
2075
|
+
-------
|
|
2076
|
+
OrganizationOutput
|
|
2077
|
+
Successful Response
|
|
2078
|
+
|
|
2079
|
+
Examples
|
|
2080
|
+
--------
|
|
2081
|
+
import asyncio
|
|
2082
|
+
|
|
2083
|
+
from agenta import AsyncAgentaApi
|
|
1309
2084
|
|
|
1310
2085
|
client = AsyncAgentaApi(
|
|
1311
2086
|
api_key="YOUR_API_KEY",
|
|
1312
2087
|
base_url="https://yourhost.com/path/to/api",
|
|
1313
2088
|
)
|
|
1314
|
-
|
|
2089
|
+
|
|
2090
|
+
|
|
2091
|
+
async def main() -> None:
|
|
2092
|
+
await client.get_own_org()
|
|
2093
|
+
|
|
2094
|
+
|
|
2095
|
+
asyncio.run(main())
|
|
1315
2096
|
"""
|
|
1316
2097
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1317
|
-
"
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
headers=self._client_wrapper.get_headers(),
|
|
1322
|
-
timeout=60,
|
|
1323
|
-
)
|
|
1324
|
-
if 200 <= _response.status_code < 300:
|
|
1325
|
-
return pydantic.parse_obj_as(OrganizationOutput, _response.json()) # type: ignore
|
|
2098
|
+
"organizations/own",
|
|
2099
|
+
method="GET",
|
|
2100
|
+
request_options=request_options,
|
|
2101
|
+
)
|
|
1326
2102
|
try:
|
|
2103
|
+
if 200 <= _response.status_code < 300:
|
|
2104
|
+
return typing.cast(
|
|
2105
|
+
OrganizationOutput,
|
|
2106
|
+
parse_obj_as(
|
|
2107
|
+
type_=OrganizationOutput, # type: ignore
|
|
2108
|
+
object_=_response.json(),
|
|
2109
|
+
),
|
|
2110
|
+
)
|
|
1327
2111
|
_response_json = _response.json()
|
|
1328
2112
|
except JSONDecodeError:
|
|
1329
2113
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1330
2114
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1331
2115
|
|
|
1332
|
-
async def fetch_organization_details(
|
|
2116
|
+
async def fetch_organization_details(
|
|
2117
|
+
self, org_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2118
|
+
) -> typing.Optional[typing.Any]:
|
|
1333
2119
|
"""
|
|
1334
2120
|
Get an organization's details.
|
|
1335
2121
|
|
|
@@ -1340,32 +2126,62 @@ class AsyncAgentaApi:
|
|
|
1340
2126
|
Returns:
|
|
1341
2127
|
OrganizationDB Instance
|
|
1342
2128
|
|
|
1343
|
-
Parameters
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
2129
|
+
Parameters
|
|
2130
|
+
----------
|
|
2131
|
+
org_id : str
|
|
2132
|
+
|
|
2133
|
+
request_options : typing.Optional[RequestOptions]
|
|
2134
|
+
Request-specific configuration.
|
|
2135
|
+
|
|
2136
|
+
Returns
|
|
2137
|
+
-------
|
|
2138
|
+
typing.Optional[typing.Any]
|
|
2139
|
+
Successful Response
|
|
2140
|
+
|
|
2141
|
+
Examples
|
|
2142
|
+
--------
|
|
2143
|
+
import asyncio
|
|
2144
|
+
|
|
2145
|
+
from agenta import AsyncAgentaApi
|
|
1347
2146
|
|
|
1348
2147
|
client = AsyncAgentaApi(
|
|
1349
2148
|
api_key="YOUR_API_KEY",
|
|
1350
2149
|
base_url="https://yourhost.com/path/to/api",
|
|
1351
2150
|
)
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
)
|
|
2151
|
+
|
|
2152
|
+
|
|
2153
|
+
async def main() -> None:
|
|
2154
|
+
await client.fetch_organization_details(
|
|
2155
|
+
org_id="org_id",
|
|
2156
|
+
)
|
|
2157
|
+
|
|
2158
|
+
|
|
2159
|
+
asyncio.run(main())
|
|
1355
2160
|
"""
|
|
1356
2161
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1357
|
-
"
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
headers=self._client_wrapper.get_headers(),
|
|
1362
|
-
timeout=60,
|
|
1363
|
-
)
|
|
1364
|
-
if 200 <= _response.status_code < 300:
|
|
1365
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
1366
|
-
if _response.status_code == 422:
|
|
1367
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2162
|
+
f"organizations/{jsonable_encoder(org_id)}",
|
|
2163
|
+
method="GET",
|
|
2164
|
+
request_options=request_options,
|
|
2165
|
+
)
|
|
1368
2166
|
try:
|
|
2167
|
+
if 200 <= _response.status_code < 300:
|
|
2168
|
+
return typing.cast(
|
|
2169
|
+
typing.Optional[typing.Any],
|
|
2170
|
+
parse_obj_as(
|
|
2171
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2172
|
+
object_=_response.json(),
|
|
2173
|
+
),
|
|
2174
|
+
)
|
|
2175
|
+
if _response.status_code == 422:
|
|
2176
|
+
raise UnprocessableEntityError(
|
|
2177
|
+
typing.cast(
|
|
2178
|
+
HttpValidationError,
|
|
2179
|
+
parse_obj_as(
|
|
2180
|
+
type_=HttpValidationError, # type: ignore
|
|
2181
|
+
object_=_response.json(),
|
|
2182
|
+
),
|
|
2183
|
+
)
|
|
2184
|
+
)
|
|
1369
2185
|
_response_json = _response.json()
|
|
1370
2186
|
except JSONDecodeError:
|
|
1371
2187
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1377,106 +2193,174 @@ class AsyncAgentaApi:
|
|
|
1377
2193
|
*,
|
|
1378
2194
|
name: typing.Optional[str] = OMIT,
|
|
1379
2195
|
description: typing.Optional[str] = OMIT,
|
|
1380
|
-
updated_at: typing.Optional[
|
|
1381
|
-
|
|
2196
|
+
updated_at: typing.Optional[str] = OMIT,
|
|
2197
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2198
|
+
) -> typing.Optional[typing.Any]:
|
|
1382
2199
|
"""
|
|
1383
|
-
Parameters
|
|
1384
|
-
|
|
2200
|
+
Parameters
|
|
2201
|
+
----------
|
|
2202
|
+
org_id : str
|
|
2203
|
+
|
|
2204
|
+
name : typing.Optional[str]
|
|
2205
|
+
|
|
2206
|
+
description : typing.Optional[str]
|
|
2207
|
+
|
|
2208
|
+
updated_at : typing.Optional[str]
|
|
1385
2209
|
|
|
1386
|
-
|
|
2210
|
+
request_options : typing.Optional[RequestOptions]
|
|
2211
|
+
Request-specific configuration.
|
|
1387
2212
|
|
|
1388
|
-
|
|
2213
|
+
Returns
|
|
2214
|
+
-------
|
|
2215
|
+
typing.Optional[typing.Any]
|
|
2216
|
+
Successful Response
|
|
1389
2217
|
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
2218
|
+
Examples
|
|
2219
|
+
--------
|
|
2220
|
+
import asyncio
|
|
2221
|
+
|
|
2222
|
+
from agenta import AsyncAgentaApi
|
|
1393
2223
|
|
|
1394
2224
|
client = AsyncAgentaApi(
|
|
1395
2225
|
api_key="YOUR_API_KEY",
|
|
1396
2226
|
base_url="https://yourhost.com/path/to/api",
|
|
1397
2227
|
)
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
)
|
|
2228
|
+
|
|
2229
|
+
|
|
2230
|
+
async def main() -> None:
|
|
2231
|
+
await client.update_organization(
|
|
2232
|
+
org_id="org_id",
|
|
2233
|
+
)
|
|
2234
|
+
|
|
2235
|
+
|
|
2236
|
+
asyncio.run(main())
|
|
1401
2237
|
"""
|
|
1402
|
-
_request: typing.Dict[str, typing.Any] = {}
|
|
1403
|
-
if name is not OMIT:
|
|
1404
|
-
_request["name"] = name
|
|
1405
|
-
if description is not OMIT:
|
|
1406
|
-
_request["description"] = description
|
|
1407
|
-
if updated_at is not OMIT:
|
|
1408
|
-
_request["updated_at"] = updated_at
|
|
1409
2238
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1410
|
-
"
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
if _response.status_code == 422:
|
|
1421
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2239
|
+
f"organizations/{jsonable_encoder(org_id)}",
|
|
2240
|
+
method="PUT",
|
|
2241
|
+
json={
|
|
2242
|
+
"name": name,
|
|
2243
|
+
"description": description,
|
|
2244
|
+
"updated_at": updated_at,
|
|
2245
|
+
},
|
|
2246
|
+
request_options=request_options,
|
|
2247
|
+
omit=OMIT,
|
|
2248
|
+
)
|
|
1422
2249
|
try:
|
|
2250
|
+
if 200 <= _response.status_code < 300:
|
|
2251
|
+
return typing.cast(
|
|
2252
|
+
typing.Optional[typing.Any],
|
|
2253
|
+
parse_obj_as(
|
|
2254
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2255
|
+
object_=_response.json(),
|
|
2256
|
+
),
|
|
2257
|
+
)
|
|
2258
|
+
if _response.status_code == 422:
|
|
2259
|
+
raise UnprocessableEntityError(
|
|
2260
|
+
typing.cast(
|
|
2261
|
+
HttpValidationError,
|
|
2262
|
+
parse_obj_as(
|
|
2263
|
+
type_=HttpValidationError, # type: ignore
|
|
2264
|
+
object_=_response.json(),
|
|
2265
|
+
),
|
|
2266
|
+
)
|
|
2267
|
+
)
|
|
1423
2268
|
_response_json = _response.json()
|
|
1424
2269
|
except JSONDecodeError:
|
|
1425
2270
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1426
2271
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1427
2272
|
|
|
1428
2273
|
async def invite_user_to_workspace(
|
|
1429
|
-
self,
|
|
1430
|
-
|
|
2274
|
+
self,
|
|
2275
|
+
org_id: str,
|
|
2276
|
+
workspace_id: str,
|
|
2277
|
+
*,
|
|
2278
|
+
request: typing.Sequence[InviteRequest],
|
|
2279
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2280
|
+
) -> typing.Optional[typing.Any]:
|
|
1431
2281
|
"""
|
|
1432
|
-
Parameters
|
|
1433
|
-
|
|
2282
|
+
Parameters
|
|
2283
|
+
----------
|
|
2284
|
+
org_id : str
|
|
1434
2285
|
|
|
1435
|
-
|
|
2286
|
+
workspace_id : str
|
|
1436
2287
|
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
2288
|
+
request : typing.Sequence[InviteRequest]
|
|
2289
|
+
|
|
2290
|
+
request_options : typing.Optional[RequestOptions]
|
|
2291
|
+
Request-specific configuration.
|
|
2292
|
+
|
|
2293
|
+
Returns
|
|
2294
|
+
-------
|
|
2295
|
+
typing.Optional[typing.Any]
|
|
2296
|
+
Successful Response
|
|
2297
|
+
|
|
2298
|
+
Examples
|
|
2299
|
+
--------
|
|
2300
|
+
import asyncio
|
|
2301
|
+
|
|
2302
|
+
from agenta import AsyncAgentaApi, InviteRequest
|
|
1441
2303
|
|
|
1442
2304
|
client = AsyncAgentaApi(
|
|
1443
2305
|
api_key="YOUR_API_KEY",
|
|
1444
2306
|
base_url="https://yourhost.com/path/to/api",
|
|
1445
2307
|
)
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
2308
|
+
|
|
2309
|
+
|
|
2310
|
+
async def main() -> None:
|
|
2311
|
+
await client.invite_user_to_workspace(
|
|
2312
|
+
org_id="org_id",
|
|
2313
|
+
workspace_id="workspace_id",
|
|
2314
|
+
request=[
|
|
2315
|
+
InviteRequest(
|
|
2316
|
+
email="email",
|
|
2317
|
+
roles=["roles"],
|
|
2318
|
+
)
|
|
2319
|
+
],
|
|
2320
|
+
)
|
|
2321
|
+
|
|
2322
|
+
|
|
2323
|
+
asyncio.run(main())
|
|
1456
2324
|
"""
|
|
1457
2325
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1458
|
-
"
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
headers=self._client_wrapper.get_headers(),
|
|
1465
|
-
timeout=60,
|
|
1466
|
-
)
|
|
1467
|
-
if 200 <= _response.status_code < 300:
|
|
1468
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
1469
|
-
if _response.status_code == 422:
|
|
1470
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2326
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite",
|
|
2327
|
+
method="POST",
|
|
2328
|
+
json=request,
|
|
2329
|
+
request_options=request_options,
|
|
2330
|
+
omit=OMIT,
|
|
2331
|
+
)
|
|
1471
2332
|
try:
|
|
2333
|
+
if 200 <= _response.status_code < 300:
|
|
2334
|
+
return typing.cast(
|
|
2335
|
+
typing.Optional[typing.Any],
|
|
2336
|
+
parse_obj_as(
|
|
2337
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2338
|
+
object_=_response.json(),
|
|
2339
|
+
),
|
|
2340
|
+
)
|
|
2341
|
+
if _response.status_code == 422:
|
|
2342
|
+
raise UnprocessableEntityError(
|
|
2343
|
+
typing.cast(
|
|
2344
|
+
HttpValidationError,
|
|
2345
|
+
parse_obj_as(
|
|
2346
|
+
type_=HttpValidationError, # type: ignore
|
|
2347
|
+
object_=_response.json(),
|
|
2348
|
+
),
|
|
2349
|
+
)
|
|
2350
|
+
)
|
|
1472
2351
|
_response_json = _response.json()
|
|
1473
2352
|
except JSONDecodeError:
|
|
1474
2353
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1475
2354
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1476
2355
|
|
|
1477
2356
|
async def resend_invitation(
|
|
1478
|
-
self,
|
|
1479
|
-
|
|
2357
|
+
self,
|
|
2358
|
+
org_id: str,
|
|
2359
|
+
workspace_id: str,
|
|
2360
|
+
*,
|
|
2361
|
+
email: str,
|
|
2362
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2363
|
+
) -> typing.Optional[typing.Any]:
|
|
1480
2364
|
"""
|
|
1481
2365
|
Resend an invitation to a user to an Organization.
|
|
1482
2366
|
|
|
@@ -1488,48 +2372,85 @@ class AsyncAgentaApi:
|
|
|
1488
2372
|
Returns:
|
|
1489
2373
|
JSONResponse: Resent invitation to user; status_code: 200
|
|
1490
2374
|
|
|
1491
|
-
Parameters
|
|
1492
|
-
|
|
2375
|
+
Parameters
|
|
2376
|
+
----------
|
|
2377
|
+
org_id : str
|
|
2378
|
+
|
|
2379
|
+
workspace_id : str
|
|
2380
|
+
|
|
2381
|
+
email : str
|
|
1493
2382
|
|
|
1494
|
-
|
|
2383
|
+
request_options : typing.Optional[RequestOptions]
|
|
2384
|
+
Request-specific configuration.
|
|
1495
2385
|
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
2386
|
+
Returns
|
|
2387
|
+
-------
|
|
2388
|
+
typing.Optional[typing.Any]
|
|
2389
|
+
Successful Response
|
|
2390
|
+
|
|
2391
|
+
Examples
|
|
2392
|
+
--------
|
|
2393
|
+
import asyncio
|
|
2394
|
+
|
|
2395
|
+
from agenta import AsyncAgentaApi
|
|
1499
2396
|
|
|
1500
2397
|
client = AsyncAgentaApi(
|
|
1501
2398
|
api_key="YOUR_API_KEY",
|
|
1502
2399
|
base_url="https://yourhost.com/path/to/api",
|
|
1503
2400
|
)
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
2401
|
+
|
|
2402
|
+
|
|
2403
|
+
async def main() -> None:
|
|
2404
|
+
await client.resend_invitation(
|
|
2405
|
+
org_id="org_id",
|
|
2406
|
+
workspace_id="workspace_id",
|
|
2407
|
+
email="email",
|
|
2408
|
+
)
|
|
2409
|
+
|
|
2410
|
+
|
|
2411
|
+
asyncio.run(main())
|
|
1509
2412
|
"""
|
|
1510
2413
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1511
|
-
"
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
)
|
|
1520
|
-
if 200 <= _response.status_code < 300:
|
|
1521
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
1522
|
-
if _response.status_code == 422:
|
|
1523
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2414
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite/resend",
|
|
2415
|
+
method="POST",
|
|
2416
|
+
json={
|
|
2417
|
+
"email": email,
|
|
2418
|
+
},
|
|
2419
|
+
request_options=request_options,
|
|
2420
|
+
omit=OMIT,
|
|
2421
|
+
)
|
|
1524
2422
|
try:
|
|
2423
|
+
if 200 <= _response.status_code < 300:
|
|
2424
|
+
return typing.cast(
|
|
2425
|
+
typing.Optional[typing.Any],
|
|
2426
|
+
parse_obj_as(
|
|
2427
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2428
|
+
object_=_response.json(),
|
|
2429
|
+
),
|
|
2430
|
+
)
|
|
2431
|
+
if _response.status_code == 422:
|
|
2432
|
+
raise UnprocessableEntityError(
|
|
2433
|
+
typing.cast(
|
|
2434
|
+
HttpValidationError,
|
|
2435
|
+
parse_obj_as(
|
|
2436
|
+
type_=HttpValidationError, # type: ignore
|
|
2437
|
+
object_=_response.json(),
|
|
2438
|
+
),
|
|
2439
|
+
)
|
|
2440
|
+
)
|
|
1525
2441
|
_response_json = _response.json()
|
|
1526
2442
|
except JSONDecodeError:
|
|
1527
2443
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1528
2444
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1529
2445
|
|
|
1530
2446
|
async def accept_invitation(
|
|
1531
|
-
self,
|
|
1532
|
-
|
|
2447
|
+
self,
|
|
2448
|
+
org_id: str,
|
|
2449
|
+
workspace_id: str,
|
|
2450
|
+
*,
|
|
2451
|
+
token: str,
|
|
2452
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2453
|
+
) -> typing.Optional[typing.Any]:
|
|
1533
2454
|
"""
|
|
1534
2455
|
Accept an invitation to a workspace.
|
|
1535
2456
|
|
|
@@ -1541,40 +2462,72 @@ class AsyncAgentaApi:
|
|
|
1541
2462
|
Returns:
|
|
1542
2463
|
JSONResponse: Accepted invitation to workspace; status_code: 200
|
|
1543
2464
|
|
|
1544
|
-
Parameters
|
|
1545
|
-
|
|
2465
|
+
Parameters
|
|
2466
|
+
----------
|
|
2467
|
+
org_id : str
|
|
2468
|
+
|
|
2469
|
+
workspace_id : str
|
|
2470
|
+
|
|
2471
|
+
token : str
|
|
1546
2472
|
|
|
1547
|
-
|
|
2473
|
+
request_options : typing.Optional[RequestOptions]
|
|
2474
|
+
Request-specific configuration.
|
|
1548
2475
|
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
2476
|
+
Returns
|
|
2477
|
+
-------
|
|
2478
|
+
typing.Optional[typing.Any]
|
|
2479
|
+
Successful Response
|
|
2480
|
+
|
|
2481
|
+
Examples
|
|
2482
|
+
--------
|
|
2483
|
+
import asyncio
|
|
2484
|
+
|
|
2485
|
+
from agenta import AsyncAgentaApi
|
|
1552
2486
|
|
|
1553
2487
|
client = AsyncAgentaApi(
|
|
1554
2488
|
api_key="YOUR_API_KEY",
|
|
1555
2489
|
base_url="https://yourhost.com/path/to/api",
|
|
1556
2490
|
)
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
2491
|
+
|
|
2492
|
+
|
|
2493
|
+
async def main() -> None:
|
|
2494
|
+
await client.accept_invitation(
|
|
2495
|
+
org_id="org_id",
|
|
2496
|
+
workspace_id="workspace_id",
|
|
2497
|
+
token="token",
|
|
2498
|
+
)
|
|
2499
|
+
|
|
2500
|
+
|
|
2501
|
+
asyncio.run(main())
|
|
1562
2502
|
"""
|
|
1563
2503
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1564
|
-
"
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
)
|
|
1573
|
-
if 200 <= _response.status_code < 300:
|
|
1574
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
1575
|
-
if _response.status_code == 422:
|
|
1576
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2504
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}/invite/accept",
|
|
2505
|
+
method="POST",
|
|
2506
|
+
json={
|
|
2507
|
+
"token": token,
|
|
2508
|
+
},
|
|
2509
|
+
request_options=request_options,
|
|
2510
|
+
omit=OMIT,
|
|
2511
|
+
)
|
|
1577
2512
|
try:
|
|
2513
|
+
if 200 <= _response.status_code < 300:
|
|
2514
|
+
return typing.cast(
|
|
2515
|
+
typing.Optional[typing.Any],
|
|
2516
|
+
parse_obj_as(
|
|
2517
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2518
|
+
object_=_response.json(),
|
|
2519
|
+
),
|
|
2520
|
+
)
|
|
2521
|
+
if _response.status_code == 422:
|
|
2522
|
+
raise UnprocessableEntityError(
|
|
2523
|
+
typing.cast(
|
|
2524
|
+
HttpValidationError,
|
|
2525
|
+
parse_obj_as(
|
|
2526
|
+
type_=HttpValidationError, # type: ignore
|
|
2527
|
+
object_=_response.json(),
|
|
2528
|
+
),
|
|
2529
|
+
)
|
|
2530
|
+
)
|
|
1578
2531
|
_response_json = _response.json()
|
|
1579
2532
|
except JSONDecodeError:
|
|
1580
2533
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1587,48 +2540,78 @@ class AsyncAgentaApi:
|
|
|
1587
2540
|
name: str,
|
|
1588
2541
|
description: typing.Optional[str] = OMIT,
|
|
1589
2542
|
type: typing.Optional[str] = OMIT,
|
|
2543
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1590
2544
|
) -> WorkspaceResponse:
|
|
1591
2545
|
"""
|
|
1592
|
-
Parameters
|
|
1593
|
-
|
|
2546
|
+
Parameters
|
|
2547
|
+
----------
|
|
2548
|
+
org_id : str
|
|
2549
|
+
|
|
2550
|
+
name : str
|
|
1594
2551
|
|
|
1595
|
-
|
|
2552
|
+
description : typing.Optional[str]
|
|
1596
2553
|
|
|
1597
|
-
|
|
2554
|
+
type : typing.Optional[str]
|
|
1598
2555
|
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
2556
|
+
request_options : typing.Optional[RequestOptions]
|
|
2557
|
+
Request-specific configuration.
|
|
2558
|
+
|
|
2559
|
+
Returns
|
|
2560
|
+
-------
|
|
2561
|
+
WorkspaceResponse
|
|
2562
|
+
Successful Response
|
|
2563
|
+
|
|
2564
|
+
Examples
|
|
2565
|
+
--------
|
|
2566
|
+
import asyncio
|
|
2567
|
+
|
|
2568
|
+
from agenta import AsyncAgentaApi
|
|
1602
2569
|
|
|
1603
2570
|
client = AsyncAgentaApi(
|
|
1604
2571
|
api_key="YOUR_API_KEY",
|
|
1605
2572
|
base_url="https://yourhost.com/path/to/api",
|
|
1606
2573
|
)
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
2574
|
+
|
|
2575
|
+
|
|
2576
|
+
async def main() -> None:
|
|
2577
|
+
await client.create_workspace(
|
|
2578
|
+
org_id="org_id",
|
|
2579
|
+
name="name",
|
|
2580
|
+
)
|
|
2581
|
+
|
|
2582
|
+
|
|
2583
|
+
asyncio.run(main())
|
|
1611
2584
|
"""
|
|
1612
|
-
_request: typing.Dict[str, typing.Any] = {"name": name}
|
|
1613
|
-
if description is not OMIT:
|
|
1614
|
-
_request["description"] = description
|
|
1615
|
-
if type is not OMIT:
|
|
1616
|
-
_request["type"] = type
|
|
1617
2585
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1618
|
-
"
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
return pydantic.parse_obj_as(WorkspaceResponse, _response.json()) # type: ignore
|
|
1629
|
-
if _response.status_code == 422:
|
|
1630
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2586
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces",
|
|
2587
|
+
method="POST",
|
|
2588
|
+
json={
|
|
2589
|
+
"name": name,
|
|
2590
|
+
"description": description,
|
|
2591
|
+
"type": type,
|
|
2592
|
+
},
|
|
2593
|
+
request_options=request_options,
|
|
2594
|
+
omit=OMIT,
|
|
2595
|
+
)
|
|
1631
2596
|
try:
|
|
2597
|
+
if 200 <= _response.status_code < 300:
|
|
2598
|
+
return typing.cast(
|
|
2599
|
+
WorkspaceResponse,
|
|
2600
|
+
parse_obj_as(
|
|
2601
|
+
type_=WorkspaceResponse, # type: ignore
|
|
2602
|
+
object_=_response.json(),
|
|
2603
|
+
),
|
|
2604
|
+
)
|
|
2605
|
+
if _response.status_code == 422:
|
|
2606
|
+
raise UnprocessableEntityError(
|
|
2607
|
+
typing.cast(
|
|
2608
|
+
HttpValidationError,
|
|
2609
|
+
parse_obj_as(
|
|
2610
|
+
type_=HttpValidationError, # type: ignore
|
|
2611
|
+
object_=_response.json(),
|
|
2612
|
+
),
|
|
2613
|
+
)
|
|
2614
|
+
)
|
|
1632
2615
|
_response_json = _response.json()
|
|
1633
2616
|
except JSONDecodeError:
|
|
1634
2617
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1642,58 +2625,88 @@ class AsyncAgentaApi:
|
|
|
1642
2625
|
name: typing.Optional[str] = OMIT,
|
|
1643
2626
|
description: typing.Optional[str] = OMIT,
|
|
1644
2627
|
updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
2628
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1645
2629
|
) -> WorkspaceResponse:
|
|
1646
2630
|
"""
|
|
1647
|
-
Parameters
|
|
1648
|
-
|
|
2631
|
+
Parameters
|
|
2632
|
+
----------
|
|
2633
|
+
org_id : str
|
|
2634
|
+
|
|
2635
|
+
workspace_id : str
|
|
2636
|
+
|
|
2637
|
+
name : typing.Optional[str]
|
|
1649
2638
|
|
|
1650
|
-
|
|
2639
|
+
description : typing.Optional[str]
|
|
1651
2640
|
|
|
1652
|
-
|
|
2641
|
+
updated_at : typing.Optional[dt.datetime]
|
|
1653
2642
|
|
|
1654
|
-
|
|
2643
|
+
request_options : typing.Optional[RequestOptions]
|
|
2644
|
+
Request-specific configuration.
|
|
1655
2645
|
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
2646
|
+
Returns
|
|
2647
|
+
-------
|
|
2648
|
+
WorkspaceResponse
|
|
2649
|
+
Successful Response
|
|
2650
|
+
|
|
2651
|
+
Examples
|
|
2652
|
+
--------
|
|
2653
|
+
import asyncio
|
|
2654
|
+
|
|
2655
|
+
from agenta import AsyncAgentaApi
|
|
1659
2656
|
|
|
1660
2657
|
client = AsyncAgentaApi(
|
|
1661
2658
|
api_key="YOUR_API_KEY",
|
|
1662
2659
|
base_url="https://yourhost.com/path/to/api",
|
|
1663
2660
|
)
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
2661
|
+
|
|
2662
|
+
|
|
2663
|
+
async def main() -> None:
|
|
2664
|
+
await client.update_workspace(
|
|
2665
|
+
org_id="org_id",
|
|
2666
|
+
workspace_id="workspace_id",
|
|
2667
|
+
)
|
|
2668
|
+
|
|
2669
|
+
|
|
2670
|
+
asyncio.run(main())
|
|
1668
2671
|
"""
|
|
1669
|
-
_request: typing.Dict[str, typing.Any] = {}
|
|
1670
|
-
if name is not OMIT:
|
|
1671
|
-
_request["name"] = name
|
|
1672
|
-
if description is not OMIT:
|
|
1673
|
-
_request["description"] = description
|
|
1674
|
-
if updated_at is not OMIT:
|
|
1675
|
-
_request["updated_at"] = updated_at
|
|
1676
2672
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1677
|
-
"
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
return pydantic.parse_obj_as(WorkspaceResponse, _response.json()) # type: ignore
|
|
1688
|
-
if _response.status_code == 422:
|
|
1689
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2673
|
+
f"organizations/{jsonable_encoder(org_id)}/workspaces/{jsonable_encoder(workspace_id)}",
|
|
2674
|
+
method="PUT",
|
|
2675
|
+
json={
|
|
2676
|
+
"name": name,
|
|
2677
|
+
"description": description,
|
|
2678
|
+
"updated_at": updated_at,
|
|
2679
|
+
},
|
|
2680
|
+
request_options=request_options,
|
|
2681
|
+
omit=OMIT,
|
|
2682
|
+
)
|
|
1690
2683
|
try:
|
|
2684
|
+
if 200 <= _response.status_code < 300:
|
|
2685
|
+
return typing.cast(
|
|
2686
|
+
WorkspaceResponse,
|
|
2687
|
+
parse_obj_as(
|
|
2688
|
+
type_=WorkspaceResponse, # type: ignore
|
|
2689
|
+
object_=_response.json(),
|
|
2690
|
+
),
|
|
2691
|
+
)
|
|
2692
|
+
if _response.status_code == 422:
|
|
2693
|
+
raise UnprocessableEntityError(
|
|
2694
|
+
typing.cast(
|
|
2695
|
+
HttpValidationError,
|
|
2696
|
+
parse_obj_as(
|
|
2697
|
+
type_=HttpValidationError, # type: ignore
|
|
2698
|
+
object_=_response.json(),
|
|
2699
|
+
),
|
|
2700
|
+
)
|
|
2701
|
+
)
|
|
1691
2702
|
_response_json = _response.json()
|
|
1692
2703
|
except JSONDecodeError:
|
|
1693
2704
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1694
2705
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1695
2706
|
|
|
1696
|
-
async def get_all_workspace_roles(
|
|
2707
|
+
async def get_all_workspace_roles(
|
|
2708
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
2709
|
+
) -> typing.List[WorkspaceRoleResponse]:
|
|
1697
2710
|
"""
|
|
1698
2711
|
Get all workspace roles.
|
|
1699
2712
|
|
|
@@ -1705,32 +2718,56 @@ class AsyncAgentaApi:
|
|
|
1705
2718
|
Raises:
|
|
1706
2719
|
HTTPException: If an error occurs while retrieving the workspace roles.
|
|
1707
2720
|
|
|
1708
|
-
|
|
1709
|
-
|
|
2721
|
+
Parameters
|
|
2722
|
+
----------
|
|
2723
|
+
request_options : typing.Optional[RequestOptions]
|
|
2724
|
+
Request-specific configuration.
|
|
2725
|
+
|
|
2726
|
+
Returns
|
|
2727
|
+
-------
|
|
2728
|
+
typing.List[WorkspaceRoleResponse]
|
|
2729
|
+
Successful Response
|
|
2730
|
+
|
|
2731
|
+
Examples
|
|
2732
|
+
--------
|
|
2733
|
+
import asyncio
|
|
2734
|
+
|
|
2735
|
+
from agenta import AsyncAgentaApi
|
|
1710
2736
|
|
|
1711
2737
|
client = AsyncAgentaApi(
|
|
1712
2738
|
api_key="YOUR_API_KEY",
|
|
1713
2739
|
base_url="https://yourhost.com/path/to/api",
|
|
1714
2740
|
)
|
|
1715
|
-
|
|
2741
|
+
|
|
2742
|
+
|
|
2743
|
+
async def main() -> None:
|
|
2744
|
+
await client.get_all_workspace_roles()
|
|
2745
|
+
|
|
2746
|
+
|
|
2747
|
+
asyncio.run(main())
|
|
1716
2748
|
"""
|
|
1717
2749
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1718
|
-
"
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
headers=self._client_wrapper.get_headers(),
|
|
1723
|
-
timeout=60,
|
|
1724
|
-
)
|
|
1725
|
-
if 200 <= _response.status_code < 300:
|
|
1726
|
-
return pydantic.parse_obj_as(typing.List[WorkspaceRoleResponse], _response.json()) # type: ignore
|
|
2750
|
+
"workspaces/roles",
|
|
2751
|
+
method="GET",
|
|
2752
|
+
request_options=request_options,
|
|
2753
|
+
)
|
|
1727
2754
|
try:
|
|
2755
|
+
if 200 <= _response.status_code < 300:
|
|
2756
|
+
return typing.cast(
|
|
2757
|
+
typing.List[WorkspaceRoleResponse],
|
|
2758
|
+
parse_obj_as(
|
|
2759
|
+
type_=typing.List[WorkspaceRoleResponse], # type: ignore
|
|
2760
|
+
object_=_response.json(),
|
|
2761
|
+
),
|
|
2762
|
+
)
|
|
1728
2763
|
_response_json = _response.json()
|
|
1729
2764
|
except JSONDecodeError:
|
|
1730
2765
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1731
2766
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1732
2767
|
|
|
1733
|
-
async def get_all_workspace_permissions(
|
|
2768
|
+
async def get_all_workspace_permissions(
|
|
2769
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
2770
|
+
) -> typing.List[Permission]:
|
|
1734
2771
|
"""
|
|
1735
2772
|
Get all workspace permissions.
|
|
1736
2773
|
|
|
@@ -1742,26 +2779,48 @@ class AsyncAgentaApi:
|
|
|
1742
2779
|
Raises:
|
|
1743
2780
|
HTTPException: If there is an error retrieving the workspace permissions.
|
|
1744
2781
|
|
|
1745
|
-
|
|
1746
|
-
|
|
2782
|
+
Parameters
|
|
2783
|
+
----------
|
|
2784
|
+
request_options : typing.Optional[RequestOptions]
|
|
2785
|
+
Request-specific configuration.
|
|
2786
|
+
|
|
2787
|
+
Returns
|
|
2788
|
+
-------
|
|
2789
|
+
typing.List[Permission]
|
|
2790
|
+
Successful Response
|
|
2791
|
+
|
|
2792
|
+
Examples
|
|
2793
|
+
--------
|
|
2794
|
+
import asyncio
|
|
2795
|
+
|
|
2796
|
+
from agenta import AsyncAgentaApi
|
|
1747
2797
|
|
|
1748
2798
|
client = AsyncAgentaApi(
|
|
1749
2799
|
api_key="YOUR_API_KEY",
|
|
1750
2800
|
base_url="https://yourhost.com/path/to/api",
|
|
1751
2801
|
)
|
|
1752
|
-
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
async def main() -> None:
|
|
2805
|
+
await client.get_all_workspace_permissions()
|
|
2806
|
+
|
|
2807
|
+
|
|
2808
|
+
asyncio.run(main())
|
|
1753
2809
|
"""
|
|
1754
2810
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1755
|
-
"
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
headers=self._client_wrapper.get_headers(),
|
|
1760
|
-
timeout=60,
|
|
1761
|
-
)
|
|
1762
|
-
if 200 <= _response.status_code < 300:
|
|
1763
|
-
return pydantic.parse_obj_as(typing.List[Permission], _response.json()) # type: ignore
|
|
2811
|
+
"workspaces/permissions",
|
|
2812
|
+
method="GET",
|
|
2813
|
+
request_options=request_options,
|
|
2814
|
+
)
|
|
1764
2815
|
try:
|
|
2816
|
+
if 200 <= _response.status_code < 300:
|
|
2817
|
+
return typing.cast(
|
|
2818
|
+
typing.List[Permission],
|
|
2819
|
+
parse_obj_as(
|
|
2820
|
+
type_=typing.List[Permission], # type: ignore
|
|
2821
|
+
object_=_response.json(),
|
|
2822
|
+
),
|
|
2823
|
+
)
|
|
1765
2824
|
_response_json = _response.json()
|
|
1766
2825
|
except JSONDecodeError:
|
|
1767
2826
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -1773,7 +2832,8 @@ class AsyncAgentaApi:
|
|
|
1773
2832
|
*,
|
|
1774
2833
|
email: str,
|
|
1775
2834
|
organization_id: str,
|
|
1776
|
-
role: typing.Optional[
|
|
2835
|
+
role: typing.Optional[str] = OMIT,
|
|
2836
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1777
2837
|
) -> bool:
|
|
1778
2838
|
"""
|
|
1779
2839
|
Assigns a role to a user in a workspace.
|
|
@@ -1790,56 +2850,90 @@ class AsyncAgentaApi:
|
|
|
1790
2850
|
HTTPException: If the user does not have permission to perform this action.
|
|
1791
2851
|
HTTPException: If there is an error assigning the role to the user.
|
|
1792
2852
|
|
|
1793
|
-
Parameters
|
|
1794
|
-
|
|
2853
|
+
Parameters
|
|
2854
|
+
----------
|
|
2855
|
+
workspace_id : str
|
|
2856
|
+
|
|
2857
|
+
email : str
|
|
1795
2858
|
|
|
1796
|
-
|
|
2859
|
+
organization_id : str
|
|
1797
2860
|
|
|
1798
|
-
|
|
2861
|
+
role : typing.Optional[str]
|
|
1799
2862
|
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
2863
|
+
request_options : typing.Optional[RequestOptions]
|
|
2864
|
+
Request-specific configuration.
|
|
2865
|
+
|
|
2866
|
+
Returns
|
|
2867
|
+
-------
|
|
2868
|
+
bool
|
|
2869
|
+
Successful Response
|
|
2870
|
+
|
|
2871
|
+
Examples
|
|
2872
|
+
--------
|
|
2873
|
+
import asyncio
|
|
2874
|
+
|
|
2875
|
+
from agenta import AsyncAgentaApi
|
|
1803
2876
|
|
|
1804
2877
|
client = AsyncAgentaApi(
|
|
1805
2878
|
api_key="YOUR_API_KEY",
|
|
1806
2879
|
base_url="https://yourhost.com/path/to/api",
|
|
1807
2880
|
)
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
2881
|
+
|
|
2882
|
+
|
|
2883
|
+
async def main() -> None:
|
|
2884
|
+
await client.assign_role_to_user(
|
|
2885
|
+
workspace_id="workspace_id",
|
|
2886
|
+
email="email",
|
|
2887
|
+
organization_id="organization_id",
|
|
2888
|
+
)
|
|
2889
|
+
|
|
2890
|
+
|
|
2891
|
+
asyncio.run(main())
|
|
1813
2892
|
"""
|
|
1814
|
-
_request: typing.Dict[str, typing.Any] = {
|
|
1815
|
-
"email": email,
|
|
1816
|
-
"organization_id": organization_id,
|
|
1817
|
-
}
|
|
1818
|
-
if role is not OMIT:
|
|
1819
|
-
_request["role"] = role.value
|
|
1820
2893
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1821
|
-
"
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
return pydantic.parse_obj_as(bool, _response.json()) # type: ignore
|
|
1832
|
-
if _response.status_code == 422:
|
|
1833
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2894
|
+
f"workspaces/{jsonable_encoder(workspace_id)}/roles",
|
|
2895
|
+
method="POST",
|
|
2896
|
+
json={
|
|
2897
|
+
"email": email,
|
|
2898
|
+
"organization_id": organization_id,
|
|
2899
|
+
"role": role,
|
|
2900
|
+
},
|
|
2901
|
+
request_options=request_options,
|
|
2902
|
+
omit=OMIT,
|
|
2903
|
+
)
|
|
1834
2904
|
try:
|
|
2905
|
+
if 200 <= _response.status_code < 300:
|
|
2906
|
+
return typing.cast(
|
|
2907
|
+
bool,
|
|
2908
|
+
parse_obj_as(
|
|
2909
|
+
type_=bool, # type: ignore
|
|
2910
|
+
object_=_response.json(),
|
|
2911
|
+
),
|
|
2912
|
+
)
|
|
2913
|
+
if _response.status_code == 422:
|
|
2914
|
+
raise UnprocessableEntityError(
|
|
2915
|
+
typing.cast(
|
|
2916
|
+
HttpValidationError,
|
|
2917
|
+
parse_obj_as(
|
|
2918
|
+
type_=HttpValidationError, # type: ignore
|
|
2919
|
+
object_=_response.json(),
|
|
2920
|
+
),
|
|
2921
|
+
)
|
|
2922
|
+
)
|
|
1835
2923
|
_response_json = _response.json()
|
|
1836
2924
|
except JSONDecodeError:
|
|
1837
2925
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1838
2926
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1839
2927
|
|
|
1840
2928
|
async def unassign_role_from_user(
|
|
1841
|
-
self,
|
|
1842
|
-
|
|
2929
|
+
self,
|
|
2930
|
+
workspace_id: str,
|
|
2931
|
+
*,
|
|
2932
|
+
email: str,
|
|
2933
|
+
org_id: str,
|
|
2934
|
+
role: str,
|
|
2935
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2936
|
+
) -> typing.Optional[typing.Any]:
|
|
1843
2937
|
"""
|
|
1844
2938
|
Delete a role assignment from a user in a workspace.
|
|
1845
2939
|
|
|
@@ -1857,52 +2951,88 @@ class AsyncAgentaApi:
|
|
|
1857
2951
|
HTTPException: If there is an error in the request or the user does not have permission to perform the action.
|
|
1858
2952
|
HTTPException: If there is an error in updating the user's roles.
|
|
1859
2953
|
|
|
1860
|
-
Parameters
|
|
1861
|
-
|
|
2954
|
+
Parameters
|
|
2955
|
+
----------
|
|
2956
|
+
workspace_id : str
|
|
2957
|
+
|
|
2958
|
+
email : str
|
|
2959
|
+
|
|
2960
|
+
org_id : str
|
|
2961
|
+
|
|
2962
|
+
role : str
|
|
1862
2963
|
|
|
1863
|
-
|
|
2964
|
+
request_options : typing.Optional[RequestOptions]
|
|
2965
|
+
Request-specific configuration.
|
|
1864
2966
|
|
|
1865
|
-
|
|
2967
|
+
Returns
|
|
2968
|
+
-------
|
|
2969
|
+
typing.Optional[typing.Any]
|
|
2970
|
+
Successful Response
|
|
1866
2971
|
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
2972
|
+
Examples
|
|
2973
|
+
--------
|
|
2974
|
+
import asyncio
|
|
2975
|
+
|
|
2976
|
+
from agenta import AsyncAgentaApi
|
|
1870
2977
|
|
|
1871
2978
|
client = AsyncAgentaApi(
|
|
1872
2979
|
api_key="YOUR_API_KEY",
|
|
1873
2980
|
base_url="https://yourhost.com/path/to/api",
|
|
1874
2981
|
)
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
2982
|
+
|
|
2983
|
+
|
|
2984
|
+
async def main() -> None:
|
|
2985
|
+
await client.unassign_role_from_user(
|
|
2986
|
+
workspace_id="workspace_id",
|
|
2987
|
+
email="email",
|
|
2988
|
+
org_id="org_id",
|
|
2989
|
+
role="role",
|
|
2990
|
+
)
|
|
2991
|
+
|
|
2992
|
+
|
|
2993
|
+
asyncio.run(main())
|
|
1881
2994
|
"""
|
|
1882
2995
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1883
|
-
"
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
timeout=60,
|
|
1893
|
-
)
|
|
1894
|
-
if 200 <= _response.status_code < 300:
|
|
1895
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
1896
|
-
if _response.status_code == 422:
|
|
1897
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2996
|
+
f"workspaces/{jsonable_encoder(workspace_id)}/roles",
|
|
2997
|
+
method="DELETE",
|
|
2998
|
+
params={
|
|
2999
|
+
"email": email,
|
|
3000
|
+
"org_id": org_id,
|
|
3001
|
+
"role": role,
|
|
3002
|
+
},
|
|
3003
|
+
request_options=request_options,
|
|
3004
|
+
)
|
|
1898
3005
|
try:
|
|
3006
|
+
if 200 <= _response.status_code < 300:
|
|
3007
|
+
return typing.cast(
|
|
3008
|
+
typing.Optional[typing.Any],
|
|
3009
|
+
parse_obj_as(
|
|
3010
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
3011
|
+
object_=_response.json(),
|
|
3012
|
+
),
|
|
3013
|
+
)
|
|
3014
|
+
if _response.status_code == 422:
|
|
3015
|
+
raise UnprocessableEntityError(
|
|
3016
|
+
typing.cast(
|
|
3017
|
+
HttpValidationError,
|
|
3018
|
+
parse_obj_as(
|
|
3019
|
+
type_=HttpValidationError, # type: ignore
|
|
3020
|
+
object_=_response.json(),
|
|
3021
|
+
),
|
|
3022
|
+
)
|
|
3023
|
+
)
|
|
1899
3024
|
_response_json = _response.json()
|
|
1900
3025
|
except JSONDecodeError:
|
|
1901
3026
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1902
3027
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1903
3028
|
|
|
1904
3029
|
async def remove_user_from_workspace(
|
|
1905
|
-
self,
|
|
3030
|
+
self,
|
|
3031
|
+
workspace_id: str,
|
|
3032
|
+
*,
|
|
3033
|
+
org_id: str,
|
|
3034
|
+
email: str,
|
|
3035
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1906
3036
|
) -> WorkspaceResponse:
|
|
1907
3037
|
"""
|
|
1908
3038
|
Remove a user from a workspace.
|
|
@@ -1922,88 +3052,192 @@ class AsyncAgentaApi:
|
|
|
1922
3052
|
- HTTPException: If the user does not have permission to perform this action.
|
|
1923
3053
|
- HTTPException: If there is an error during the removal process.
|
|
1924
3054
|
|
|
1925
|
-
Parameters
|
|
1926
|
-
|
|
3055
|
+
Parameters
|
|
3056
|
+
----------
|
|
3057
|
+
workspace_id : str
|
|
3058
|
+
|
|
3059
|
+
org_id : str
|
|
3060
|
+
|
|
3061
|
+
email : str
|
|
3062
|
+
|
|
3063
|
+
request_options : typing.Optional[RequestOptions]
|
|
3064
|
+
Request-specific configuration.
|
|
3065
|
+
|
|
3066
|
+
Returns
|
|
3067
|
+
-------
|
|
3068
|
+
WorkspaceResponse
|
|
3069
|
+
Successful Response
|
|
1927
3070
|
|
|
1928
|
-
|
|
3071
|
+
Examples
|
|
3072
|
+
--------
|
|
3073
|
+
import asyncio
|
|
1929
3074
|
|
|
1930
|
-
|
|
1931
|
-
---
|
|
1932
|
-
from agenta.client import AsyncAgentaApi
|
|
3075
|
+
from agenta import AsyncAgentaApi
|
|
1933
3076
|
|
|
1934
3077
|
client = AsyncAgentaApi(
|
|
1935
3078
|
api_key="YOUR_API_KEY",
|
|
1936
3079
|
base_url="https://yourhost.com/path/to/api",
|
|
1937
3080
|
)
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
3081
|
+
|
|
3082
|
+
|
|
3083
|
+
async def main() -> None:
|
|
3084
|
+
await client.remove_user_from_workspace(
|
|
3085
|
+
workspace_id="workspace_id",
|
|
3086
|
+
org_id="org_id",
|
|
3087
|
+
email="email",
|
|
3088
|
+
)
|
|
3089
|
+
|
|
3090
|
+
|
|
3091
|
+
asyncio.run(main())
|
|
1943
3092
|
"""
|
|
1944
3093
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1945
|
-
"
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
)
|
|
1954
|
-
if 200 <= _response.status_code < 300:
|
|
1955
|
-
return pydantic.parse_obj_as(WorkspaceResponse, _response.json()) # type: ignore
|
|
1956
|
-
if _response.status_code == 422:
|
|
1957
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
3094
|
+
f"workspaces/{jsonable_encoder(workspace_id)}/users",
|
|
3095
|
+
method="DELETE",
|
|
3096
|
+
params={
|
|
3097
|
+
"org_id": org_id,
|
|
3098
|
+
"email": email,
|
|
3099
|
+
},
|
|
3100
|
+
request_options=request_options,
|
|
3101
|
+
)
|
|
1958
3102
|
try:
|
|
3103
|
+
if 200 <= _response.status_code < 300:
|
|
3104
|
+
return typing.cast(
|
|
3105
|
+
WorkspaceResponse,
|
|
3106
|
+
parse_obj_as(
|
|
3107
|
+
type_=WorkspaceResponse, # type: ignore
|
|
3108
|
+
object_=_response.json(),
|
|
3109
|
+
),
|
|
3110
|
+
)
|
|
3111
|
+
if _response.status_code == 422:
|
|
3112
|
+
raise UnprocessableEntityError(
|
|
3113
|
+
typing.cast(
|
|
3114
|
+
HttpValidationError,
|
|
3115
|
+
parse_obj_as(
|
|
3116
|
+
type_=HttpValidationError, # type: ignore
|
|
3117
|
+
object_=_response.json(),
|
|
3118
|
+
),
|
|
3119
|
+
)
|
|
3120
|
+
)
|
|
1959
3121
|
_response_json = _response.json()
|
|
1960
3122
|
except JSONDecodeError:
|
|
1961
3123
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1962
3124
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1963
3125
|
|
|
1964
|
-
async def health_check(
|
|
3126
|
+
async def health_check(
|
|
3127
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
3128
|
+
) -> typing.Optional[typing.Any]:
|
|
1965
3129
|
"""
|
|
1966
|
-
|
|
3130
|
+
Parameters
|
|
3131
|
+
----------
|
|
3132
|
+
request_options : typing.Optional[RequestOptions]
|
|
3133
|
+
Request-specific configuration.
|
|
3134
|
+
|
|
3135
|
+
Returns
|
|
3136
|
+
-------
|
|
3137
|
+
typing.Optional[typing.Any]
|
|
3138
|
+
Successful Response
|
|
3139
|
+
|
|
3140
|
+
Examples
|
|
3141
|
+
--------
|
|
3142
|
+
import asyncio
|
|
3143
|
+
|
|
3144
|
+
from agenta import AsyncAgentaApi
|
|
1967
3145
|
|
|
1968
3146
|
client = AsyncAgentaApi(
|
|
1969
3147
|
api_key="YOUR_API_KEY",
|
|
1970
3148
|
base_url="https://yourhost.com/path/to/api",
|
|
1971
3149
|
)
|
|
1972
|
-
|
|
3150
|
+
|
|
3151
|
+
|
|
3152
|
+
async def main() -> None:
|
|
3153
|
+
await client.health_check()
|
|
3154
|
+
|
|
3155
|
+
|
|
3156
|
+
asyncio.run(main())
|
|
1973
3157
|
"""
|
|
1974
3158
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1975
|
-
"
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
timeout=60,
|
|
3159
|
+
"health",
|
|
3160
|
+
method="GET",
|
|
3161
|
+
request_options=request_options,
|
|
1979
3162
|
)
|
|
1980
|
-
if 200 <= _response.status_code < 300:
|
|
1981
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
1982
3163
|
try:
|
|
3164
|
+
if 200 <= _response.status_code < 300:
|
|
3165
|
+
return typing.cast(
|
|
3166
|
+
typing.Optional[typing.Any],
|
|
3167
|
+
parse_obj_as(
|
|
3168
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
3169
|
+
object_=_response.json(),
|
|
3170
|
+
),
|
|
3171
|
+
)
|
|
1983
3172
|
_response_json = _response.json()
|
|
1984
3173
|
except JSONDecodeError:
|
|
1985
3174
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1986
3175
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1987
3176
|
|
|
1988
|
-
async def
|
|
3177
|
+
async def fetch_user_profile(
|
|
3178
|
+
self,
|
|
3179
|
+
*,
|
|
3180
|
+
user_id: typing.Optional[str] = None,
|
|
3181
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
3182
|
+
) -> typing.Optional[typing.Any]:
|
|
1989
3183
|
"""
|
|
1990
|
-
|
|
3184
|
+
Parameters
|
|
3185
|
+
----------
|
|
3186
|
+
user_id : typing.Optional[str]
|
|
3187
|
+
|
|
3188
|
+
request_options : typing.Optional[RequestOptions]
|
|
3189
|
+
Request-specific configuration.
|
|
3190
|
+
|
|
3191
|
+
Returns
|
|
3192
|
+
-------
|
|
3193
|
+
typing.Optional[typing.Any]
|
|
3194
|
+
Successful Response
|
|
3195
|
+
|
|
3196
|
+
Examples
|
|
3197
|
+
--------
|
|
3198
|
+
import asyncio
|
|
3199
|
+
|
|
3200
|
+
from agenta import AsyncAgentaApi
|
|
1991
3201
|
|
|
1992
3202
|
client = AsyncAgentaApi(
|
|
1993
3203
|
api_key="YOUR_API_KEY",
|
|
1994
3204
|
base_url="https://yourhost.com/path/to/api",
|
|
1995
3205
|
)
|
|
1996
|
-
|
|
3206
|
+
|
|
3207
|
+
|
|
3208
|
+
async def main() -> None:
|
|
3209
|
+
await client.fetch_user_profile()
|
|
3210
|
+
|
|
3211
|
+
|
|
3212
|
+
asyncio.run(main())
|
|
1997
3213
|
"""
|
|
1998
3214
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1999
|
-
"
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
3215
|
+
"profile",
|
|
3216
|
+
method="GET",
|
|
3217
|
+
params={
|
|
3218
|
+
"user_id": user_id,
|
|
3219
|
+
},
|
|
3220
|
+
request_options=request_options,
|
|
2003
3221
|
)
|
|
2004
|
-
if 200 <= _response.status_code < 300:
|
|
2005
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
2006
3222
|
try:
|
|
3223
|
+
if 200 <= _response.status_code < 300:
|
|
3224
|
+
return typing.cast(
|
|
3225
|
+
typing.Optional[typing.Any],
|
|
3226
|
+
parse_obj_as(
|
|
3227
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
3228
|
+
object_=_response.json(),
|
|
3229
|
+
),
|
|
3230
|
+
)
|
|
3231
|
+
if _response.status_code == 422:
|
|
3232
|
+
raise UnprocessableEntityError(
|
|
3233
|
+
typing.cast(
|
|
3234
|
+
HttpValidationError,
|
|
3235
|
+
parse_obj_as(
|
|
3236
|
+
type_=HttpValidationError, # type: ignore
|
|
3237
|
+
object_=_response.json(),
|
|
3238
|
+
),
|
|
3239
|
+
)
|
|
3240
|
+
)
|
|
2007
3241
|
_response_json = _response.json()
|
|
2008
3242
|
except JSONDecodeError:
|
|
2009
3243
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|