alchemy-python 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- alchemy/.fern/metadata.json +18 -0
- alchemy/CONTRIBUTING.md +125 -0
- alchemy/__init__.py +380 -0
- alchemy/_default_clients.py +30 -0
- alchemy/auth/__init__.py +4 -0
- alchemy/auth/client.py +767 -0
- alchemy/auth/raw_client.py +866 -0
- alchemy/client.py +717 -0
- alchemy/core/__init__.py +127 -0
- alchemy/core/api_error.py +23 -0
- alchemy/core/client_wrapper.py +155 -0
- alchemy/core/datetime_utils.py +70 -0
- alchemy/core/file.py +67 -0
- alchemy/core/force_multipart.py +18 -0
- alchemy/core/http_client.py +940 -0
- alchemy/core/http_response.py +63 -0
- alchemy/core/http_sse/__init__.py +42 -0
- alchemy/core/http_sse/_api.py +455 -0
- alchemy/core/http_sse/_decoders.py +74 -0
- alchemy/core/http_sse/_exceptions.py +7 -0
- alchemy/core/http_sse/_models.py +17 -0
- alchemy/core/jsonable_encoder.py +133 -0
- alchemy/core/logging.py +107 -0
- alchemy/core/oauth_token_provider.py +73 -0
- alchemy/core/parse_error.py +36 -0
- alchemy/core/pydantic_utilities.py +486 -0
- alchemy/core/query_encoder.py +58 -0
- alchemy/core/remove_none_from_dict.py +11 -0
- alchemy/core/request_options.py +40 -0
- alchemy/core/serialization.py +347 -0
- alchemy/environment.py +7 -0
- alchemy/function/__init__.py +34 -0
- alchemy/function/client.py +808 -0
- alchemy/function/raw_client.py +903 -0
- alchemy/function/version/__init__.py +4 -0
- alchemy/function/version/client.py +364 -0
- alchemy/function/version/raw_client.py +410 -0
- alchemy/host/__init__.py +4 -0
- alchemy/host/client.py +227 -0
- alchemy/host/raw_client.py +242 -0
- alchemy/instance/__init__.py +4 -0
- alchemy/instance/client.py +136 -0
- alchemy/instance/raw_client.py +141 -0
- alchemy/invocation/__init__.py +4 -0
- alchemy/invocation/client.py +570 -0
- alchemy/invocation/raw_client.py +636 -0
- alchemy/member/__init__.py +4 -0
- alchemy/member/client.py +441 -0
- alchemy/member/raw_client.py +504 -0
- alchemy/metrics/__init__.py +4 -0
- alchemy/metrics/client.py +428 -0
- alchemy/metrics/raw_client.py +478 -0
- alchemy/py.typed +0 -0
- alchemy/raw_client.py +138 -0
- alchemy/reference.md +3300 -0
- alchemy/runtime/__init__.py +4 -0
- alchemy/runtime/client.py +141 -0
- alchemy/runtime/raw_client.py +140 -0
- alchemy/service_account/__init__.py +4 -0
- alchemy/service_account/client.py +429 -0
- alchemy/service_account/raw_client.py +490 -0
- alchemy/template/__init__.py +4 -0
- alchemy/template/client.py +141 -0
- alchemy/template/raw_client.py +140 -0
- alchemy/types/__init__.py +344 -0
- alchemy/types/auth_v1accept_invite_response.py +5 -0
- alchemy/types/auth_v1create_service_account_response.py +34 -0
- alchemy/types/auth_v1get_auth_config_request.py +5 -0
- alchemy/types/auth_v1get_auth_config_response.py +53 -0
- alchemy/types/auth_v1get_session_request.py +9 -0
- alchemy/types/auth_v1get_session_response.py +28 -0
- alchemy/types/auth_v1get_token_response.py +29 -0
- alchemy/types/auth_v1invite_member_response.py +29 -0
- alchemy/types/auth_v1list_members_request.py +5 -0
- alchemy/types/auth_v1list_members_response.py +34 -0
- alchemy/types/auth_v1list_service_accounts_request.py +5 -0
- alchemy/types/auth_v1list_service_accounts_response.py +29 -0
- alchemy/types/auth_v1login_response.py +5 -0
- alchemy/types/auth_v1logout_request.py +8 -0
- alchemy/types/auth_v1logout_response.py +5 -0
- alchemy/types/auth_v1member.py +31 -0
- alchemy/types/auth_v1register_response.py +23 -0
- alchemy/types/auth_v1remove_member_response.py +5 -0
- alchemy/types/auth_v1remove_service_account_response.py +5 -0
- alchemy/types/auth_v1role.py +5 -0
- alchemy/types/auth_v1rotate_service_account_secret_response.py +31 -0
- alchemy/types/auth_v1service_account.py +35 -0
- alchemy/types/auth_v1set_member_role_response.py +5 -0
- alchemy/types/connect_error.py +38 -0
- alchemy/types/connect_error_code.py +25 -0
- alchemy/types/connect_error_details_any.py +36 -0
- alchemy/types/connect_protocol_version.py +5 -0
- alchemy/types/connect_timeout_header.py +6 -0
- alchemy/types/functions_v1arrow_contract.py +50 -0
- alchemy/types/functions_v1contract.py +8 -0
- alchemy/types/functions_v1contract_arrow.py +20 -0
- alchemy/types/functions_v1contract_json_schema.py +26 -0
- alchemy/types/functions_v1contract_violation.py +32 -0
- alchemy/types/functions_v1create_function_response.py +22 -0
- alchemy/types/functions_v1create_function_version_response.py +20 -0
- alchemy/types/functions_v1delete_function_response.py +5 -0
- alchemy/types/functions_v1function.py +100 -0
- alchemy/types/functions_v1function_error.py +30 -0
- alchemy/types/functions_v1function_error_kind.py +15 -0
- alchemy/types/functions_v1function_spec.py +58 -0
- alchemy/types/functions_v1function_version.py +81 -0
- alchemy/types/functions_v1function_version_status.py +13 -0
- alchemy/types/functions_v1get_function_response.py +20 -0
- alchemy/types/functions_v1get_function_version_response.py +20 -0
- alchemy/types/functions_v1get_host_request.py +5 -0
- alchemy/types/functions_v1get_host_response.py +20 -0
- alchemy/types/functions_v1get_invocation_logs_request.py +31 -0
- alchemy/types/functions_v1get_invocation_logs_response.py +24 -0
- alchemy/types/functions_v1get_invocation_response.py +20 -0
- alchemy/types/functions_v1get_version_request.py +5 -0
- alchemy/types/functions_v1get_version_response.py +25 -0
- alchemy/types/functions_v1host.py +58 -0
- alchemy/types/functions_v1instance.py +54 -0
- alchemy/types/functions_v1instance_status.py +14 -0
- alchemy/types/functions_v1invocation.py +106 -0
- alchemy/types/functions_v1invocation_protocol.py +8 -0
- alchemy/types/functions_v1invocation_stats.py +41 -0
- alchemy/types/functions_v1invocation_status.py +18 -0
- alchemy/types/functions_v1invoke_async_response.py +34 -0
- alchemy/types/functions_v1invoke_response.py +8 -0
- alchemy/types/functions_v1invoke_response_error.py +20 -0
- alchemy/types/functions_v1invoke_response_output.py +19 -0
- alchemy/types/functions_v1json_schema_contract.py +28 -0
- alchemy/types/functions_v1list_function_versions_response.py +22 -0
- alchemy/types/functions_v1list_functions_response.py +22 -0
- alchemy/types/functions_v1list_hosts_request.py +5 -0
- alchemy/types/functions_v1list_hosts_response.py +23 -0
- alchemy/types/functions_v1list_instances_response.py +20 -0
- alchemy/types/functions_v1list_invocations_response.py +22 -0
- alchemy/types/functions_v1list_runtimes_request.py +5 -0
- alchemy/types/functions_v1list_runtimes_response.py +22 -0
- alchemy/types/functions_v1list_templates_request.py +5 -0
- alchemy/types/functions_v1list_templates_response.py +20 -0
- alchemy/types/functions_v1network.py +5 -0
- alchemy/types/functions_v1pagination_request.py +31 -0
- alchemy/types/functions_v1pagination_response.py +33 -0
- alchemy/types/functions_v1resources.py +28 -0
- alchemy/types/functions_v1runtime.py +59 -0
- alchemy/types/functions_v1runtime_starters.py +29 -0
- alchemy/types/functions_v1source.py +31 -0
- alchemy/types/functions_v1source_file.py +28 -0
- alchemy/types/functions_v1source_layer.py +27 -0
- alchemy/types/functions_v1source_limits.py +30 -0
- alchemy/types/functions_v1start_kind.py +8 -0
- alchemy/types/functions_v1tail_invocations_request.py +32 -0
- alchemy/types/functions_v1tail_invocations_response.py +34 -0
- alchemy/types/functions_v1template.py +94 -0
- alchemy/types/functions_v1template_source.py +27 -0
- alchemy/types/functions_v1update_function_response.py +20 -0
- alchemy/types/google_protobuf_list_value.py +10 -0
- alchemy/types/google_protobuf_null_value.py +5 -0
- alchemy/types/google_protobuf_struct.py +10 -0
- alchemy/types/google_protobuf_value.py +5 -0
- alchemy/types/metrics_v1aggregate_row.py +24 -0
- alchemy/types/metrics_v1get_queue_response.py +25 -0
- alchemy/types/metrics_v1metric.py +16 -0
- alchemy/types/metrics_v1metric_dimension.py +14 -0
- alchemy/types/metrics_v1metric_filter.py +26 -0
- alchemy/types/metrics_v1metric_granularity.py +13 -0
- alchemy/types/metrics_v1query_aggregate_response.py +20 -0
- alchemy/types/metrics_v1query_timeseries_response.py +20 -0
- alchemy/types/metrics_v1timeseries.py +28 -0
- alchemy/types/metrics_v1timeseries_point.py +28 -0
- alchemy_python-0.1.0.dist-info/METADATA +196 -0
- alchemy_python-0.1.0.dist-info/RECORD +172 -0
- alchemy_python-0.1.0.dist-info/WHEEL +4 -0
- alchemy_python-0.1.0.dist-info/licenses/LICENSE +201 -0
alchemy/client.py
ADDED
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
from .core.api_error import ApiError
|
|
9
|
+
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
10
|
+
from .core.logging import LogConfig, Logger
|
|
11
|
+
from .core.oauth_token_provider import AsyncOAuthTokenProvider, OAuthTokenProvider
|
|
12
|
+
from .core.request_options import RequestOptions
|
|
13
|
+
from .environment import AlchemyEnvironment
|
|
14
|
+
from .raw_client import AsyncRawAlchemy, RawAlchemy
|
|
15
|
+
from .types.connect_timeout_header import ConnectTimeoutHeader
|
|
16
|
+
from .types.functions_v1get_version_request import FunctionsV1GetVersionRequest
|
|
17
|
+
from .types.functions_v1get_version_response import FunctionsV1GetVersionResponse
|
|
18
|
+
|
|
19
|
+
if typing.TYPE_CHECKING:
|
|
20
|
+
from .auth.client import AsyncAuthClient, AuthClient
|
|
21
|
+
from .function.client import AsyncFunctionClient, FunctionClient
|
|
22
|
+
from .host.client import AsyncHostClient, HostClient
|
|
23
|
+
from .instance.client import AsyncInstanceClient, InstanceClient
|
|
24
|
+
from .invocation.client import AsyncInvocationClient, InvocationClient
|
|
25
|
+
from .member.client import AsyncMemberClient, MemberClient
|
|
26
|
+
from .metrics.client import AsyncMetricsClient, MetricsClient
|
|
27
|
+
from .runtime.client import AsyncRuntimeClient, RuntimeClient
|
|
28
|
+
from .service_account.client import AsyncServiceAccountClient, ServiceAccountClient
|
|
29
|
+
from .template.client import AsyncTemplateClient, TemplateClient
|
|
30
|
+
# this is used as the default value for optional parameters
|
|
31
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class Alchemy:
|
|
35
|
+
"""
|
|
36
|
+
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.
|
|
37
|
+
|
|
38
|
+
Parameters
|
|
39
|
+
----------
|
|
40
|
+
|
|
41
|
+
base_url : typing.Optional[str]
|
|
42
|
+
The base url to use for requests from the client.
|
|
43
|
+
|
|
44
|
+
client_id : str
|
|
45
|
+
The client identifier used for authentication.
|
|
46
|
+
|
|
47
|
+
client_secret : str
|
|
48
|
+
The client secret used for authentication.
|
|
49
|
+
|
|
50
|
+
timeout : typing.Optional[float]
|
|
51
|
+
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.
|
|
52
|
+
|
|
53
|
+
max_retries : typing.Optional[int]
|
|
54
|
+
The default maximum number of retries for failed requests. Defaults to 0. Per-request `max_retries` in `request_options` takes precedence over this value.
|
|
55
|
+
|
|
56
|
+
follow_redirects : typing.Optional[bool]
|
|
57
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
58
|
+
|
|
59
|
+
httpx_client : typing.Optional[httpx.Client]
|
|
60
|
+
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.
|
|
61
|
+
|
|
62
|
+
# or ...
|
|
63
|
+
|
|
64
|
+
base_url : typing.Optional[str]
|
|
65
|
+
The base url to use for requests from the client.
|
|
66
|
+
|
|
67
|
+
token : typing.Union[str, typing.Callable[[], str]]
|
|
68
|
+
Authenticate by providing a pre-generated bearer token, or a callable that returns one. In this mode, OAuth client credentials are not required.
|
|
69
|
+
|
|
70
|
+
timeout : typing.Optional[float]
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
max_retries : typing.Optional[int]
|
|
74
|
+
The default maximum number of retries for failed requests. Defaults to 0. Per-request `max_retries` in `request_options` takes precedence over this value.
|
|
75
|
+
|
|
76
|
+
follow_redirects : typing.Optional[bool]
|
|
77
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
78
|
+
|
|
79
|
+
httpx_client : typing.Optional[httpx.Client]
|
|
80
|
+
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.
|
|
81
|
+
|
|
82
|
+
Examples
|
|
83
|
+
--------
|
|
84
|
+
from alchemy import Alchemy
|
|
85
|
+
|
|
86
|
+
client = Alchemy(
|
|
87
|
+
client_id="YOUR_CLIENT_ID",
|
|
88
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
# or ...
|
|
92
|
+
|
|
93
|
+
from alchemy import Alchemy
|
|
94
|
+
|
|
95
|
+
client = Alchemy(
|
|
96
|
+
base_url="https://yourhost.com/path/to/api",
|
|
97
|
+
token="YOUR_BEARER_TOKEN",
|
|
98
|
+
)
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
@typing.overload
|
|
102
|
+
def __init__(
|
|
103
|
+
self,
|
|
104
|
+
*,
|
|
105
|
+
base_url: typing.Optional[str] = None,
|
|
106
|
+
environment: AlchemyEnvironment = AlchemyEnvironment.DEFAULT,
|
|
107
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
108
|
+
timeout: typing.Optional[float] = None,
|
|
109
|
+
max_retries: typing.Optional[int] = None,
|
|
110
|
+
stream_reconnection_enabled: typing.Optional[bool] = None,
|
|
111
|
+
max_stream_reconnection_attempts: typing.Optional[int] = None,
|
|
112
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
113
|
+
httpx_client: typing.Optional[httpx.Client] = None,
|
|
114
|
+
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
|
|
115
|
+
connect_protocol_version: typing.Optional[str] = None,
|
|
116
|
+
client_id: str,
|
|
117
|
+
client_secret: str,
|
|
118
|
+
): ...
|
|
119
|
+
@typing.overload
|
|
120
|
+
def __init__(
|
|
121
|
+
self,
|
|
122
|
+
*,
|
|
123
|
+
base_url: typing.Optional[str] = None,
|
|
124
|
+
environment: AlchemyEnvironment = AlchemyEnvironment.DEFAULT,
|
|
125
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
126
|
+
timeout: typing.Optional[float] = None,
|
|
127
|
+
max_retries: typing.Optional[int] = None,
|
|
128
|
+
stream_reconnection_enabled: typing.Optional[bool] = None,
|
|
129
|
+
max_stream_reconnection_attempts: typing.Optional[int] = None,
|
|
130
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
131
|
+
httpx_client: typing.Optional[httpx.Client] = None,
|
|
132
|
+
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
|
|
133
|
+
connect_protocol_version: typing.Optional[str] = None,
|
|
134
|
+
token: typing.Union[str, typing.Callable[[], str]],
|
|
135
|
+
): ...
|
|
136
|
+
def __init__(
|
|
137
|
+
self,
|
|
138
|
+
*,
|
|
139
|
+
base_url: typing.Optional[str] = None,
|
|
140
|
+
environment: AlchemyEnvironment = AlchemyEnvironment.DEFAULT,
|
|
141
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
142
|
+
client_id: typing.Optional[str] = None,
|
|
143
|
+
client_secret: typing.Optional[str] = None,
|
|
144
|
+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
|
|
145
|
+
_token_getter_override: typing.Optional[typing.Callable[[], str]] = None,
|
|
146
|
+
timeout: typing.Optional[float] = None,
|
|
147
|
+
max_retries: typing.Optional[int] = None,
|
|
148
|
+
stream_reconnection_enabled: typing.Optional[bool] = None,
|
|
149
|
+
max_stream_reconnection_attempts: typing.Optional[int] = None,
|
|
150
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
151
|
+
httpx_client: typing.Optional[httpx.Client] = None,
|
|
152
|
+
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
|
|
153
|
+
connect_protocol_version: typing.Optional[str] = None,
|
|
154
|
+
):
|
|
155
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
156
|
+
_defaulted_max_retries = max_retries if max_retries is not None else 0
|
|
157
|
+
if token is not None:
|
|
158
|
+
self._client_wrapper = SyncClientWrapper(
|
|
159
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
160
|
+
headers=headers,
|
|
161
|
+
httpx_client=httpx_client
|
|
162
|
+
if httpx_client is not None
|
|
163
|
+
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
164
|
+
if follow_redirects is not None
|
|
165
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
166
|
+
timeout=_defaulted_timeout,
|
|
167
|
+
max_retries=_defaulted_max_retries,
|
|
168
|
+
stream_reconnection_enabled=stream_reconnection_enabled,
|
|
169
|
+
max_stream_reconnection_attempts=max_stream_reconnection_attempts,
|
|
170
|
+
logging=logging,
|
|
171
|
+
connect_protocol_version=connect_protocol_version,
|
|
172
|
+
token=_token_getter_override if _token_getter_override is not None else token,
|
|
173
|
+
)
|
|
174
|
+
elif client_id is not None and client_secret is not None:
|
|
175
|
+
oauth_token_provider = OAuthTokenProvider(
|
|
176
|
+
client_id=client_id,
|
|
177
|
+
client_secret=client_secret,
|
|
178
|
+
client_wrapper=SyncClientWrapper(
|
|
179
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
180
|
+
headers=headers,
|
|
181
|
+
httpx_client=httpx_client
|
|
182
|
+
if httpx_client is not None
|
|
183
|
+
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
184
|
+
if follow_redirects is not None
|
|
185
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
186
|
+
timeout=_defaulted_timeout,
|
|
187
|
+
max_retries=_defaulted_max_retries,
|
|
188
|
+
stream_reconnection_enabled=stream_reconnection_enabled,
|
|
189
|
+
max_stream_reconnection_attempts=max_stream_reconnection_attempts,
|
|
190
|
+
logging=logging,
|
|
191
|
+
connect_protocol_version=connect_protocol_version,
|
|
192
|
+
),
|
|
193
|
+
)
|
|
194
|
+
self._client_wrapper = SyncClientWrapper(
|
|
195
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
196
|
+
headers=headers,
|
|
197
|
+
token=_token_getter_override if _token_getter_override is not None else oauth_token_provider.get_token,
|
|
198
|
+
httpx_client=httpx_client
|
|
199
|
+
if httpx_client is not None
|
|
200
|
+
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
201
|
+
if follow_redirects is not None
|
|
202
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
|
203
|
+
timeout=_defaulted_timeout,
|
|
204
|
+
max_retries=_defaulted_max_retries,
|
|
205
|
+
stream_reconnection_enabled=stream_reconnection_enabled,
|
|
206
|
+
max_stream_reconnection_attempts=max_stream_reconnection_attempts,
|
|
207
|
+
logging=logging,
|
|
208
|
+
connect_protocol_version=connect_protocol_version,
|
|
209
|
+
)
|
|
210
|
+
else:
|
|
211
|
+
raise ApiError(
|
|
212
|
+
body="The client must be instantiated with either 'token' or both 'client_id' and 'client_secret'"
|
|
213
|
+
)
|
|
214
|
+
self._raw_client = RawAlchemy(client_wrapper=self._client_wrapper)
|
|
215
|
+
self._function: typing.Optional[FunctionClient] = None
|
|
216
|
+
self._host: typing.Optional[HostClient] = None
|
|
217
|
+
self._invocation: typing.Optional[InvocationClient] = None
|
|
218
|
+
self._instance: typing.Optional[InstanceClient] = None
|
|
219
|
+
self._runtime: typing.Optional[RuntimeClient] = None
|
|
220
|
+
self._template: typing.Optional[TemplateClient] = None
|
|
221
|
+
self._metrics: typing.Optional[MetricsClient] = None
|
|
222
|
+
self._auth: typing.Optional[AuthClient] = None
|
|
223
|
+
self._service_account: typing.Optional[ServiceAccountClient] = None
|
|
224
|
+
self._member: typing.Optional[MemberClient] = None
|
|
225
|
+
|
|
226
|
+
@property
|
|
227
|
+
def with_raw_response(self) -> RawAlchemy:
|
|
228
|
+
"""
|
|
229
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
230
|
+
|
|
231
|
+
Returns
|
|
232
|
+
-------
|
|
233
|
+
RawAlchemy
|
|
234
|
+
"""
|
|
235
|
+
return self._raw_client
|
|
236
|
+
|
|
237
|
+
def get_version(
|
|
238
|
+
self,
|
|
239
|
+
*,
|
|
240
|
+
request: FunctionsV1GetVersionRequest,
|
|
241
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
242
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
243
|
+
) -> FunctionsV1GetVersionResponse:
|
|
244
|
+
"""
|
|
245
|
+
The build the server runs.
|
|
246
|
+
|
|
247
|
+
Parameters
|
|
248
|
+
----------
|
|
249
|
+
request : FunctionsV1GetVersionRequest
|
|
250
|
+
|
|
251
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
252
|
+
Define the timeout, in ms
|
|
253
|
+
|
|
254
|
+
request_options : typing.Optional[RequestOptions]
|
|
255
|
+
Request-specific configuration.
|
|
256
|
+
|
|
257
|
+
Returns
|
|
258
|
+
-------
|
|
259
|
+
FunctionsV1GetVersionResponse
|
|
260
|
+
Success
|
|
261
|
+
|
|
262
|
+
Examples
|
|
263
|
+
--------
|
|
264
|
+
from alchemy import Alchemy
|
|
265
|
+
|
|
266
|
+
client = Alchemy(
|
|
267
|
+
client_id="YOUR_CLIENT_ID",
|
|
268
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
269
|
+
)
|
|
270
|
+
client.get_version(
|
|
271
|
+
connect_timeout_ms=1000.0,
|
|
272
|
+
request={"key": "value"},
|
|
273
|
+
)
|
|
274
|
+
"""
|
|
275
|
+
_response = self._raw_client.get_version(
|
|
276
|
+
request=request, connect_timeout_ms=connect_timeout_ms, request_options=request_options
|
|
277
|
+
)
|
|
278
|
+
return _response.data
|
|
279
|
+
|
|
280
|
+
@property
|
|
281
|
+
def function(self):
|
|
282
|
+
if self._function is None:
|
|
283
|
+
from .function.client import FunctionClient # noqa: E402
|
|
284
|
+
|
|
285
|
+
self._function = FunctionClient(client_wrapper=self._client_wrapper)
|
|
286
|
+
return self._function
|
|
287
|
+
|
|
288
|
+
@property
|
|
289
|
+
def host(self):
|
|
290
|
+
if self._host is None:
|
|
291
|
+
from .host.client import HostClient # noqa: E402
|
|
292
|
+
|
|
293
|
+
self._host = HostClient(client_wrapper=self._client_wrapper)
|
|
294
|
+
return self._host
|
|
295
|
+
|
|
296
|
+
@property
|
|
297
|
+
def invocation(self):
|
|
298
|
+
if self._invocation is None:
|
|
299
|
+
from .invocation.client import InvocationClient # noqa: E402
|
|
300
|
+
|
|
301
|
+
self._invocation = InvocationClient(client_wrapper=self._client_wrapper)
|
|
302
|
+
return self._invocation
|
|
303
|
+
|
|
304
|
+
@property
|
|
305
|
+
def instance(self):
|
|
306
|
+
if self._instance is None:
|
|
307
|
+
from .instance.client import InstanceClient # noqa: E402
|
|
308
|
+
|
|
309
|
+
self._instance = InstanceClient(client_wrapper=self._client_wrapper)
|
|
310
|
+
return self._instance
|
|
311
|
+
|
|
312
|
+
@property
|
|
313
|
+
def runtime(self):
|
|
314
|
+
if self._runtime is None:
|
|
315
|
+
from .runtime.client import RuntimeClient # noqa: E402
|
|
316
|
+
|
|
317
|
+
self._runtime = RuntimeClient(client_wrapper=self._client_wrapper)
|
|
318
|
+
return self._runtime
|
|
319
|
+
|
|
320
|
+
@property
|
|
321
|
+
def template(self):
|
|
322
|
+
if self._template is None:
|
|
323
|
+
from .template.client import TemplateClient # noqa: E402
|
|
324
|
+
|
|
325
|
+
self._template = TemplateClient(client_wrapper=self._client_wrapper)
|
|
326
|
+
return self._template
|
|
327
|
+
|
|
328
|
+
@property
|
|
329
|
+
def metrics(self):
|
|
330
|
+
if self._metrics is None:
|
|
331
|
+
from .metrics.client import MetricsClient # noqa: E402
|
|
332
|
+
|
|
333
|
+
self._metrics = MetricsClient(client_wrapper=self._client_wrapper)
|
|
334
|
+
return self._metrics
|
|
335
|
+
|
|
336
|
+
@property
|
|
337
|
+
def auth(self):
|
|
338
|
+
if self._auth is None:
|
|
339
|
+
from .auth.client import AuthClient # noqa: E402
|
|
340
|
+
|
|
341
|
+
self._auth = AuthClient(client_wrapper=self._client_wrapper)
|
|
342
|
+
return self._auth
|
|
343
|
+
|
|
344
|
+
@property
|
|
345
|
+
def service_account(self):
|
|
346
|
+
if self._service_account is None:
|
|
347
|
+
from .service_account.client import ServiceAccountClient # noqa: E402
|
|
348
|
+
|
|
349
|
+
self._service_account = ServiceAccountClient(client_wrapper=self._client_wrapper)
|
|
350
|
+
return self._service_account
|
|
351
|
+
|
|
352
|
+
@property
|
|
353
|
+
def member(self):
|
|
354
|
+
if self._member is None:
|
|
355
|
+
from .member.client import MemberClient # noqa: E402
|
|
356
|
+
|
|
357
|
+
self._member = MemberClient(client_wrapper=self._client_wrapper)
|
|
358
|
+
return self._member
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
def _make_default_async_client(
|
|
362
|
+
timeout: typing.Optional[float],
|
|
363
|
+
follow_redirects: typing.Optional[bool],
|
|
364
|
+
) -> httpx.AsyncClient:
|
|
365
|
+
try:
|
|
366
|
+
import httpx_aiohttp # type: ignore[import-not-found]
|
|
367
|
+
except ImportError:
|
|
368
|
+
pass
|
|
369
|
+
else:
|
|
370
|
+
if follow_redirects is not None:
|
|
371
|
+
return httpx_aiohttp.HttpxAiohttpClient(timeout=timeout, follow_redirects=follow_redirects)
|
|
372
|
+
return httpx_aiohttp.HttpxAiohttpClient(timeout=timeout)
|
|
373
|
+
|
|
374
|
+
if follow_redirects is not None:
|
|
375
|
+
return httpx.AsyncClient(timeout=timeout, follow_redirects=follow_redirects)
|
|
376
|
+
return httpx.AsyncClient(timeout=timeout)
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
class AsyncAlchemy:
|
|
380
|
+
"""
|
|
381
|
+
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.
|
|
382
|
+
|
|
383
|
+
Parameters
|
|
384
|
+
----------
|
|
385
|
+
|
|
386
|
+
base_url : typing.Optional[str]
|
|
387
|
+
The base url to use for requests from the client.
|
|
388
|
+
|
|
389
|
+
client_id : str
|
|
390
|
+
The client identifier used for authentication.
|
|
391
|
+
|
|
392
|
+
client_secret : str
|
|
393
|
+
The client secret used for authentication.
|
|
394
|
+
|
|
395
|
+
timeout : typing.Optional[float]
|
|
396
|
+
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.
|
|
397
|
+
|
|
398
|
+
max_retries : typing.Optional[int]
|
|
399
|
+
The default maximum number of retries for failed requests. Defaults to 0. Per-request `max_retries` in `request_options` takes precedence over this value.
|
|
400
|
+
|
|
401
|
+
follow_redirects : typing.Optional[bool]
|
|
402
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
403
|
+
|
|
404
|
+
httpx_client : typing.Optional[httpx.AsyncClient]
|
|
405
|
+
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.
|
|
406
|
+
|
|
407
|
+
# or ...
|
|
408
|
+
|
|
409
|
+
base_url : typing.Optional[str]
|
|
410
|
+
The base url to use for requests from the client.
|
|
411
|
+
|
|
412
|
+
token : typing.Union[str, typing.Callable[[], str]]
|
|
413
|
+
Authenticate by providing a pre-generated bearer token, or a callable that returns one. In this mode, OAuth client credentials are not required.
|
|
414
|
+
|
|
415
|
+
timeout : typing.Optional[float]
|
|
416
|
+
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.
|
|
417
|
+
|
|
418
|
+
max_retries : typing.Optional[int]
|
|
419
|
+
The default maximum number of retries for failed requests. Defaults to 0. Per-request `max_retries` in `request_options` takes precedence over this value.
|
|
420
|
+
|
|
421
|
+
follow_redirects : typing.Optional[bool]
|
|
422
|
+
Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
|
423
|
+
|
|
424
|
+
httpx_client : typing.Optional[httpx.AsyncClient]
|
|
425
|
+
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.
|
|
426
|
+
|
|
427
|
+
Examples
|
|
428
|
+
--------
|
|
429
|
+
from alchemy import AsyncAlchemy
|
|
430
|
+
|
|
431
|
+
client = AsyncAlchemy(
|
|
432
|
+
client_id="YOUR_CLIENT_ID",
|
|
433
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
# or ...
|
|
437
|
+
|
|
438
|
+
from alchemy import AsyncAlchemy
|
|
439
|
+
|
|
440
|
+
client = AsyncAlchemy(
|
|
441
|
+
base_url="https://yourhost.com/path/to/api",
|
|
442
|
+
token="YOUR_BEARER_TOKEN",
|
|
443
|
+
)
|
|
444
|
+
"""
|
|
445
|
+
|
|
446
|
+
@typing.overload
|
|
447
|
+
def __init__(
|
|
448
|
+
self,
|
|
449
|
+
*,
|
|
450
|
+
base_url: typing.Optional[str] = None,
|
|
451
|
+
environment: AlchemyEnvironment = AlchemyEnvironment.DEFAULT,
|
|
452
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
453
|
+
timeout: typing.Optional[float] = None,
|
|
454
|
+
max_retries: typing.Optional[int] = None,
|
|
455
|
+
stream_reconnection_enabled: typing.Optional[bool] = None,
|
|
456
|
+
max_stream_reconnection_attempts: typing.Optional[int] = None,
|
|
457
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
458
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
|
459
|
+
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
|
|
460
|
+
connect_protocol_version: typing.Optional[str] = None,
|
|
461
|
+
client_id: str,
|
|
462
|
+
client_secret: str,
|
|
463
|
+
): ...
|
|
464
|
+
@typing.overload
|
|
465
|
+
def __init__(
|
|
466
|
+
self,
|
|
467
|
+
*,
|
|
468
|
+
base_url: typing.Optional[str] = None,
|
|
469
|
+
environment: AlchemyEnvironment = AlchemyEnvironment.DEFAULT,
|
|
470
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
471
|
+
timeout: typing.Optional[float] = None,
|
|
472
|
+
max_retries: typing.Optional[int] = None,
|
|
473
|
+
stream_reconnection_enabled: typing.Optional[bool] = None,
|
|
474
|
+
max_stream_reconnection_attempts: typing.Optional[int] = None,
|
|
475
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
476
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
|
477
|
+
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
|
|
478
|
+
connect_protocol_version: typing.Optional[str] = None,
|
|
479
|
+
token: typing.Union[str, typing.Callable[[], str]],
|
|
480
|
+
): ...
|
|
481
|
+
def __init__(
|
|
482
|
+
self,
|
|
483
|
+
*,
|
|
484
|
+
base_url: typing.Optional[str] = None,
|
|
485
|
+
environment: AlchemyEnvironment = AlchemyEnvironment.DEFAULT,
|
|
486
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
487
|
+
client_id: typing.Optional[str] = None,
|
|
488
|
+
client_secret: typing.Optional[str] = None,
|
|
489
|
+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
|
|
490
|
+
_token_getter_override: typing.Optional[typing.Callable[[], str]] = None,
|
|
491
|
+
timeout: typing.Optional[float] = None,
|
|
492
|
+
max_retries: typing.Optional[int] = None,
|
|
493
|
+
stream_reconnection_enabled: typing.Optional[bool] = None,
|
|
494
|
+
max_stream_reconnection_attempts: typing.Optional[int] = None,
|
|
495
|
+
follow_redirects: typing.Optional[bool] = True,
|
|
496
|
+
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
|
497
|
+
logging: typing.Optional[typing.Union[LogConfig, Logger]] = None,
|
|
498
|
+
connect_protocol_version: typing.Optional[str] = None,
|
|
499
|
+
):
|
|
500
|
+
_defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None
|
|
501
|
+
_defaulted_max_retries = max_retries if max_retries is not None else 0
|
|
502
|
+
if token is not None:
|
|
503
|
+
self._client_wrapper = AsyncClientWrapper(
|
|
504
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
505
|
+
headers=headers,
|
|
506
|
+
httpx_client=httpx_client
|
|
507
|
+
if httpx_client is not None
|
|
508
|
+
else _make_default_async_client(timeout=_defaulted_timeout, follow_redirects=follow_redirects),
|
|
509
|
+
timeout=_defaulted_timeout,
|
|
510
|
+
max_retries=_defaulted_max_retries,
|
|
511
|
+
stream_reconnection_enabled=stream_reconnection_enabled,
|
|
512
|
+
max_stream_reconnection_attempts=max_stream_reconnection_attempts,
|
|
513
|
+
logging=logging,
|
|
514
|
+
connect_protocol_version=connect_protocol_version,
|
|
515
|
+
token=_token_getter_override if _token_getter_override is not None else token,
|
|
516
|
+
)
|
|
517
|
+
elif client_id is not None and client_secret is not None:
|
|
518
|
+
oauth_token_provider = AsyncOAuthTokenProvider(
|
|
519
|
+
client_id=client_id,
|
|
520
|
+
client_secret=client_secret,
|
|
521
|
+
client_wrapper=AsyncClientWrapper(
|
|
522
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
523
|
+
headers=headers,
|
|
524
|
+
httpx_client=httpx_client
|
|
525
|
+
if httpx_client is not None
|
|
526
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
|
527
|
+
if follow_redirects is not None
|
|
528
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
|
529
|
+
timeout=_defaulted_timeout,
|
|
530
|
+
max_retries=_defaulted_max_retries,
|
|
531
|
+
stream_reconnection_enabled=stream_reconnection_enabled,
|
|
532
|
+
max_stream_reconnection_attempts=max_stream_reconnection_attempts,
|
|
533
|
+
logging=logging,
|
|
534
|
+
connect_protocol_version=connect_protocol_version,
|
|
535
|
+
),
|
|
536
|
+
)
|
|
537
|
+
self._client_wrapper = AsyncClientWrapper(
|
|
538
|
+
base_url=_get_base_url(base_url=base_url, environment=environment),
|
|
539
|
+
headers=headers,
|
|
540
|
+
token=_token_getter_override,
|
|
541
|
+
async_token=oauth_token_provider.get_token,
|
|
542
|
+
httpx_client=httpx_client
|
|
543
|
+
if httpx_client is not None
|
|
544
|
+
else _make_default_async_client(timeout=_defaulted_timeout, follow_redirects=follow_redirects),
|
|
545
|
+
timeout=_defaulted_timeout,
|
|
546
|
+
max_retries=_defaulted_max_retries,
|
|
547
|
+
stream_reconnection_enabled=stream_reconnection_enabled,
|
|
548
|
+
max_stream_reconnection_attempts=max_stream_reconnection_attempts,
|
|
549
|
+
logging=logging,
|
|
550
|
+
connect_protocol_version=connect_protocol_version,
|
|
551
|
+
)
|
|
552
|
+
else:
|
|
553
|
+
raise ApiError(
|
|
554
|
+
body="The client must be instantiated with either 'token' or both 'client_id' and 'client_secret'"
|
|
555
|
+
)
|
|
556
|
+
self._raw_client = AsyncRawAlchemy(client_wrapper=self._client_wrapper)
|
|
557
|
+
self._function: typing.Optional[AsyncFunctionClient] = None
|
|
558
|
+
self._host: typing.Optional[AsyncHostClient] = None
|
|
559
|
+
self._invocation: typing.Optional[AsyncInvocationClient] = None
|
|
560
|
+
self._instance: typing.Optional[AsyncInstanceClient] = None
|
|
561
|
+
self._runtime: typing.Optional[AsyncRuntimeClient] = None
|
|
562
|
+
self._template: typing.Optional[AsyncTemplateClient] = None
|
|
563
|
+
self._metrics: typing.Optional[AsyncMetricsClient] = None
|
|
564
|
+
self._auth: typing.Optional[AsyncAuthClient] = None
|
|
565
|
+
self._service_account: typing.Optional[AsyncServiceAccountClient] = None
|
|
566
|
+
self._member: typing.Optional[AsyncMemberClient] = None
|
|
567
|
+
|
|
568
|
+
@property
|
|
569
|
+
def with_raw_response(self) -> AsyncRawAlchemy:
|
|
570
|
+
"""
|
|
571
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
572
|
+
|
|
573
|
+
Returns
|
|
574
|
+
-------
|
|
575
|
+
AsyncRawAlchemy
|
|
576
|
+
"""
|
|
577
|
+
return self._raw_client
|
|
578
|
+
|
|
579
|
+
async def get_version(
|
|
580
|
+
self,
|
|
581
|
+
*,
|
|
582
|
+
request: FunctionsV1GetVersionRequest,
|
|
583
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
584
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
585
|
+
) -> FunctionsV1GetVersionResponse:
|
|
586
|
+
"""
|
|
587
|
+
The build the server runs.
|
|
588
|
+
|
|
589
|
+
Parameters
|
|
590
|
+
----------
|
|
591
|
+
request : FunctionsV1GetVersionRequest
|
|
592
|
+
|
|
593
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
594
|
+
Define the timeout, in ms
|
|
595
|
+
|
|
596
|
+
request_options : typing.Optional[RequestOptions]
|
|
597
|
+
Request-specific configuration.
|
|
598
|
+
|
|
599
|
+
Returns
|
|
600
|
+
-------
|
|
601
|
+
FunctionsV1GetVersionResponse
|
|
602
|
+
Success
|
|
603
|
+
|
|
604
|
+
Examples
|
|
605
|
+
--------
|
|
606
|
+
import asyncio
|
|
607
|
+
|
|
608
|
+
from alchemy import AsyncAlchemy
|
|
609
|
+
|
|
610
|
+
client = AsyncAlchemy(
|
|
611
|
+
client_id="YOUR_CLIENT_ID",
|
|
612
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
async def main() -> None:
|
|
617
|
+
await client.get_version(
|
|
618
|
+
connect_timeout_ms=1000.0,
|
|
619
|
+
request={"key": "value"},
|
|
620
|
+
)
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
asyncio.run(main())
|
|
624
|
+
"""
|
|
625
|
+
_response = await self._raw_client.get_version(
|
|
626
|
+
request=request, connect_timeout_ms=connect_timeout_ms, request_options=request_options
|
|
627
|
+
)
|
|
628
|
+
return _response.data
|
|
629
|
+
|
|
630
|
+
@property
|
|
631
|
+
def function(self):
|
|
632
|
+
if self._function is None:
|
|
633
|
+
from .function.client import AsyncFunctionClient # noqa: E402
|
|
634
|
+
|
|
635
|
+
self._function = AsyncFunctionClient(client_wrapper=self._client_wrapper)
|
|
636
|
+
return self._function
|
|
637
|
+
|
|
638
|
+
@property
|
|
639
|
+
def host(self):
|
|
640
|
+
if self._host is None:
|
|
641
|
+
from .host.client import AsyncHostClient # noqa: E402
|
|
642
|
+
|
|
643
|
+
self._host = AsyncHostClient(client_wrapper=self._client_wrapper)
|
|
644
|
+
return self._host
|
|
645
|
+
|
|
646
|
+
@property
|
|
647
|
+
def invocation(self):
|
|
648
|
+
if self._invocation is None:
|
|
649
|
+
from .invocation.client import AsyncInvocationClient # noqa: E402
|
|
650
|
+
|
|
651
|
+
self._invocation = AsyncInvocationClient(client_wrapper=self._client_wrapper)
|
|
652
|
+
return self._invocation
|
|
653
|
+
|
|
654
|
+
@property
|
|
655
|
+
def instance(self):
|
|
656
|
+
if self._instance is None:
|
|
657
|
+
from .instance.client import AsyncInstanceClient # noqa: E402
|
|
658
|
+
|
|
659
|
+
self._instance = AsyncInstanceClient(client_wrapper=self._client_wrapper)
|
|
660
|
+
return self._instance
|
|
661
|
+
|
|
662
|
+
@property
|
|
663
|
+
def runtime(self):
|
|
664
|
+
if self._runtime is None:
|
|
665
|
+
from .runtime.client import AsyncRuntimeClient # noqa: E402
|
|
666
|
+
|
|
667
|
+
self._runtime = AsyncRuntimeClient(client_wrapper=self._client_wrapper)
|
|
668
|
+
return self._runtime
|
|
669
|
+
|
|
670
|
+
@property
|
|
671
|
+
def template(self):
|
|
672
|
+
if self._template is None:
|
|
673
|
+
from .template.client import AsyncTemplateClient # noqa: E402
|
|
674
|
+
|
|
675
|
+
self._template = AsyncTemplateClient(client_wrapper=self._client_wrapper)
|
|
676
|
+
return self._template
|
|
677
|
+
|
|
678
|
+
@property
|
|
679
|
+
def metrics(self):
|
|
680
|
+
if self._metrics is None:
|
|
681
|
+
from .metrics.client import AsyncMetricsClient # noqa: E402
|
|
682
|
+
|
|
683
|
+
self._metrics = AsyncMetricsClient(client_wrapper=self._client_wrapper)
|
|
684
|
+
return self._metrics
|
|
685
|
+
|
|
686
|
+
@property
|
|
687
|
+
def auth(self):
|
|
688
|
+
if self._auth is None:
|
|
689
|
+
from .auth.client import AsyncAuthClient # noqa: E402
|
|
690
|
+
|
|
691
|
+
self._auth = AsyncAuthClient(client_wrapper=self._client_wrapper)
|
|
692
|
+
return self._auth
|
|
693
|
+
|
|
694
|
+
@property
|
|
695
|
+
def service_account(self):
|
|
696
|
+
if self._service_account is None:
|
|
697
|
+
from .service_account.client import AsyncServiceAccountClient # noqa: E402
|
|
698
|
+
|
|
699
|
+
self._service_account = AsyncServiceAccountClient(client_wrapper=self._client_wrapper)
|
|
700
|
+
return self._service_account
|
|
701
|
+
|
|
702
|
+
@property
|
|
703
|
+
def member(self):
|
|
704
|
+
if self._member is None:
|
|
705
|
+
from .member.client import AsyncMemberClient # noqa: E402
|
|
706
|
+
|
|
707
|
+
self._member = AsyncMemberClient(client_wrapper=self._client_wrapper)
|
|
708
|
+
return self._member
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
def _get_base_url(*, base_url: typing.Optional[str] = None, environment: AlchemyEnvironment) -> str:
|
|
712
|
+
if base_url is not None:
|
|
713
|
+
return base_url
|
|
714
|
+
elif environment is not None:
|
|
715
|
+
return environment.value
|
|
716
|
+
else:
|
|
717
|
+
raise Exception("Please pass in either base_url or environment to construct the client")
|