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
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from ..types.connect_timeout_header import ConnectTimeoutHeader
|
|
8
|
+
from ..types.functions_v1get_invocation_response import FunctionsV1GetInvocationResponse
|
|
9
|
+
from ..types.functions_v1invocation_status import FunctionsV1InvocationStatus
|
|
10
|
+
from ..types.functions_v1invoke_async_response import FunctionsV1InvokeAsyncResponse
|
|
11
|
+
from ..types.functions_v1invoke_response import FunctionsV1InvokeResponse
|
|
12
|
+
from ..types.functions_v1list_invocations_response import FunctionsV1ListInvocationsResponse
|
|
13
|
+
from ..types.functions_v1pagination_request import FunctionsV1PaginationRequest
|
|
14
|
+
from ..types.functions_v1start_kind import FunctionsV1StartKind
|
|
15
|
+
from .raw_client import AsyncRawInvocationClient, RawInvocationClient
|
|
16
|
+
|
|
17
|
+
# this is used as the default value for optional parameters
|
|
18
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class InvocationClient:
|
|
22
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
23
|
+
self._raw_client = RawInvocationClient(client_wrapper=client_wrapper)
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def with_raw_response(self) -> RawInvocationClient:
|
|
27
|
+
"""
|
|
28
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
29
|
+
|
|
30
|
+
Returns
|
|
31
|
+
-------
|
|
32
|
+
RawInvocationClient
|
|
33
|
+
"""
|
|
34
|
+
return self._raw_client
|
|
35
|
+
|
|
36
|
+
def get(
|
|
37
|
+
self,
|
|
38
|
+
*,
|
|
39
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
40
|
+
id: typing.Optional[str] = OMIT,
|
|
41
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
42
|
+
) -> FunctionsV1GetInvocationResponse:
|
|
43
|
+
"""
|
|
44
|
+
Invocations; the persisted record of every Invoke, newest first.
|
|
45
|
+
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
49
|
+
Define the timeout, in ms
|
|
50
|
+
|
|
51
|
+
id : typing.Optional[str]
|
|
52
|
+
|
|
53
|
+
request_options : typing.Optional[RequestOptions]
|
|
54
|
+
Request-specific configuration.
|
|
55
|
+
|
|
56
|
+
Returns
|
|
57
|
+
-------
|
|
58
|
+
FunctionsV1GetInvocationResponse
|
|
59
|
+
Success
|
|
60
|
+
|
|
61
|
+
Examples
|
|
62
|
+
--------
|
|
63
|
+
from alchemy import Alchemy
|
|
64
|
+
|
|
65
|
+
client = Alchemy(
|
|
66
|
+
client_id="YOUR_CLIENT_ID",
|
|
67
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
68
|
+
)
|
|
69
|
+
client.invocation.get(
|
|
70
|
+
connect_timeout_ms=1000.0,
|
|
71
|
+
)
|
|
72
|
+
"""
|
|
73
|
+
_response = self._raw_client.get(connect_timeout_ms=connect_timeout_ms, id=id, request_options=request_options)
|
|
74
|
+
return _response.data
|
|
75
|
+
|
|
76
|
+
def invoke(
|
|
77
|
+
self,
|
|
78
|
+
*,
|
|
79
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
80
|
+
function_id: typing.Optional[str] = OMIT,
|
|
81
|
+
version: typing.Optional[str] = OMIT,
|
|
82
|
+
input: typing.Optional[str] = OMIT,
|
|
83
|
+
idempotency_key: typing.Optional[str] = OMIT,
|
|
84
|
+
retries: typing.Optional[int] = OMIT,
|
|
85
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
86
|
+
) -> FunctionsV1InvokeResponse:
|
|
87
|
+
"""
|
|
88
|
+
Invocation; validate input, run one version against it, validate output.
|
|
89
|
+
An RPC error means the function did not produce a result: the request was
|
|
90
|
+
rejected (unknown function, input violates the contract, no capacity) or
|
|
91
|
+
the platform failed. Input violations are INVALID_ARGUMENT with one
|
|
92
|
+
ContractViolation error detail each. If the function ran, the RPC
|
|
93
|
+
succeeds and the response carries its output or a FunctionError. A
|
|
94
|
+
function that raised, crashed or timed out, or a platform that could
|
|
95
|
+
not run it, runs again up to the call's or the function's retries, with
|
|
96
|
+
exponential backoff, while the call's deadline leaves room. An input
|
|
97
|
+
that violates the contract never runs again.
|
|
98
|
+
|
|
99
|
+
Parameters
|
|
100
|
+
----------
|
|
101
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
102
|
+
Define the timeout, in ms
|
|
103
|
+
|
|
104
|
+
function_id : typing.Optional[str]
|
|
105
|
+
|
|
106
|
+
version : typing.Optional[str]
|
|
107
|
+
|
|
108
|
+
input : typing.Optional[str]
|
|
109
|
+
|
|
110
|
+
idempotency_key : typing.Optional[str]
|
|
111
|
+
idempotency_key makes the call safe to retry. Within the server's
|
|
112
|
+
idempotency window, every call to the same function with the same key
|
|
113
|
+
returns the invocation the first call started, with its output or
|
|
114
|
+
error, instead of running again. The key is released, so that a retry
|
|
115
|
+
runs, only when the platform never sent the invocation to a host. A
|
|
116
|
+
call a host took but never reported on has an unknown outcome and holds
|
|
117
|
+
the key: a retry gets ABORTED, and a new key runs again.
|
|
118
|
+
|
|
119
|
+
retries : typing.Optional[int]
|
|
120
|
+
retries, when set, is how many more times this call runs after a failed
|
|
121
|
+
attempt instead of the function's retries.
|
|
122
|
+
|
|
123
|
+
request_options : typing.Optional[RequestOptions]
|
|
124
|
+
Request-specific configuration.
|
|
125
|
+
|
|
126
|
+
Returns
|
|
127
|
+
-------
|
|
128
|
+
FunctionsV1InvokeResponse
|
|
129
|
+
Success
|
|
130
|
+
|
|
131
|
+
Examples
|
|
132
|
+
--------
|
|
133
|
+
from alchemy import Alchemy
|
|
134
|
+
|
|
135
|
+
client = Alchemy(
|
|
136
|
+
client_id="YOUR_CLIENT_ID",
|
|
137
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
138
|
+
)
|
|
139
|
+
client.invocation.invoke(
|
|
140
|
+
connect_timeout_ms=1000.0,
|
|
141
|
+
)
|
|
142
|
+
"""
|
|
143
|
+
_response = self._raw_client.invoke(
|
|
144
|
+
connect_timeout_ms=connect_timeout_ms,
|
|
145
|
+
function_id=function_id,
|
|
146
|
+
version=version,
|
|
147
|
+
input=input,
|
|
148
|
+
idempotency_key=idempotency_key,
|
|
149
|
+
retries=retries,
|
|
150
|
+
request_options=request_options,
|
|
151
|
+
)
|
|
152
|
+
return _response.data
|
|
153
|
+
|
|
154
|
+
def invoke_async(
|
|
155
|
+
self,
|
|
156
|
+
*,
|
|
157
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
158
|
+
function_id: typing.Optional[str] = OMIT,
|
|
159
|
+
version: typing.Optional[str] = OMIT,
|
|
160
|
+
input: typing.Optional[str] = OMIT,
|
|
161
|
+
idempotency_key: typing.Optional[str] = OMIT,
|
|
162
|
+
retries: typing.Optional[int] = OMIT,
|
|
163
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
164
|
+
) -> FunctionsV1InvokeAsyncResponse:
|
|
165
|
+
"""
|
|
166
|
+
InvokeAsync queues the invocation and returns its id without waiting.
|
|
167
|
+
The output is dropped. It retries as Invoke does. An idempotency_key
|
|
168
|
+
seen within the window returns the invocation it queued.
|
|
169
|
+
|
|
170
|
+
Parameters
|
|
171
|
+
----------
|
|
172
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
173
|
+
Define the timeout, in ms
|
|
174
|
+
|
|
175
|
+
function_id : typing.Optional[str]
|
|
176
|
+
|
|
177
|
+
version : typing.Optional[str]
|
|
178
|
+
|
|
179
|
+
input : typing.Optional[str]
|
|
180
|
+
|
|
181
|
+
idempotency_key : typing.Optional[str]
|
|
182
|
+
|
|
183
|
+
retries : typing.Optional[int]
|
|
184
|
+
|
|
185
|
+
request_options : typing.Optional[RequestOptions]
|
|
186
|
+
Request-specific configuration.
|
|
187
|
+
|
|
188
|
+
Returns
|
|
189
|
+
-------
|
|
190
|
+
FunctionsV1InvokeAsyncResponse
|
|
191
|
+
Success
|
|
192
|
+
|
|
193
|
+
Examples
|
|
194
|
+
--------
|
|
195
|
+
from alchemy import Alchemy
|
|
196
|
+
|
|
197
|
+
client = Alchemy(
|
|
198
|
+
client_id="YOUR_CLIENT_ID",
|
|
199
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
200
|
+
)
|
|
201
|
+
client.invocation.invoke_async(
|
|
202
|
+
connect_timeout_ms=1000.0,
|
|
203
|
+
)
|
|
204
|
+
"""
|
|
205
|
+
_response = self._raw_client.invoke_async(
|
|
206
|
+
connect_timeout_ms=connect_timeout_ms,
|
|
207
|
+
function_id=function_id,
|
|
208
|
+
version=version,
|
|
209
|
+
input=input,
|
|
210
|
+
idempotency_key=idempotency_key,
|
|
211
|
+
retries=retries,
|
|
212
|
+
request_options=request_options,
|
|
213
|
+
)
|
|
214
|
+
return _response.data
|
|
215
|
+
|
|
216
|
+
def list(
|
|
217
|
+
self,
|
|
218
|
+
*,
|
|
219
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
220
|
+
function_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
221
|
+
statuses: typing.Optional[typing.Sequence[FunctionsV1InvocationStatus]] = OMIT,
|
|
222
|
+
start_kinds: typing.Optional[typing.Sequence[FunctionsV1StartKind]] = OMIT,
|
|
223
|
+
pagination: typing.Optional[FunctionsV1PaginationRequest] = OMIT,
|
|
224
|
+
since_ms: typing.Optional[str] = OMIT,
|
|
225
|
+
until_ms: typing.Optional[str] = OMIT,
|
|
226
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
227
|
+
) -> FunctionsV1ListInvocationsResponse:
|
|
228
|
+
"""
|
|
229
|
+
Parameters
|
|
230
|
+
----------
|
|
231
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
232
|
+
Define the timeout, in ms
|
|
233
|
+
|
|
234
|
+
function_ids : typing.Optional[typing.Sequence[str]]
|
|
235
|
+
Empty lists match everything.
|
|
236
|
+
|
|
237
|
+
statuses : typing.Optional[typing.Sequence[FunctionsV1InvocationStatus]]
|
|
238
|
+
|
|
239
|
+
start_kinds : typing.Optional[typing.Sequence[FunctionsV1StartKind]]
|
|
240
|
+
|
|
241
|
+
pagination : typing.Optional[FunctionsV1PaginationRequest]
|
|
242
|
+
|
|
243
|
+
since_ms : typing.Optional[str]
|
|
244
|
+
|
|
245
|
+
until_ms : typing.Optional[str]
|
|
246
|
+
|
|
247
|
+
request_options : typing.Optional[RequestOptions]
|
|
248
|
+
Request-specific configuration.
|
|
249
|
+
|
|
250
|
+
Returns
|
|
251
|
+
-------
|
|
252
|
+
FunctionsV1ListInvocationsResponse
|
|
253
|
+
Success
|
|
254
|
+
|
|
255
|
+
Examples
|
|
256
|
+
--------
|
|
257
|
+
from alchemy import Alchemy
|
|
258
|
+
|
|
259
|
+
client = Alchemy(
|
|
260
|
+
client_id="YOUR_CLIENT_ID",
|
|
261
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
262
|
+
)
|
|
263
|
+
client.invocation.list(
|
|
264
|
+
connect_timeout_ms=1000.0,
|
|
265
|
+
)
|
|
266
|
+
"""
|
|
267
|
+
_response = self._raw_client.list(
|
|
268
|
+
connect_timeout_ms=connect_timeout_ms,
|
|
269
|
+
function_ids=function_ids,
|
|
270
|
+
statuses=statuses,
|
|
271
|
+
start_kinds=start_kinds,
|
|
272
|
+
pagination=pagination,
|
|
273
|
+
since_ms=since_ms,
|
|
274
|
+
until_ms=until_ms,
|
|
275
|
+
request_options=request_options,
|
|
276
|
+
)
|
|
277
|
+
return _response.data
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
class AsyncInvocationClient:
|
|
281
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
282
|
+
self._raw_client = AsyncRawInvocationClient(client_wrapper=client_wrapper)
|
|
283
|
+
|
|
284
|
+
@property
|
|
285
|
+
def with_raw_response(self) -> AsyncRawInvocationClient:
|
|
286
|
+
"""
|
|
287
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
288
|
+
|
|
289
|
+
Returns
|
|
290
|
+
-------
|
|
291
|
+
AsyncRawInvocationClient
|
|
292
|
+
"""
|
|
293
|
+
return self._raw_client
|
|
294
|
+
|
|
295
|
+
async def get(
|
|
296
|
+
self,
|
|
297
|
+
*,
|
|
298
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
299
|
+
id: typing.Optional[str] = OMIT,
|
|
300
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
301
|
+
) -> FunctionsV1GetInvocationResponse:
|
|
302
|
+
"""
|
|
303
|
+
Invocations; the persisted record of every Invoke, newest first.
|
|
304
|
+
|
|
305
|
+
Parameters
|
|
306
|
+
----------
|
|
307
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
308
|
+
Define the timeout, in ms
|
|
309
|
+
|
|
310
|
+
id : typing.Optional[str]
|
|
311
|
+
|
|
312
|
+
request_options : typing.Optional[RequestOptions]
|
|
313
|
+
Request-specific configuration.
|
|
314
|
+
|
|
315
|
+
Returns
|
|
316
|
+
-------
|
|
317
|
+
FunctionsV1GetInvocationResponse
|
|
318
|
+
Success
|
|
319
|
+
|
|
320
|
+
Examples
|
|
321
|
+
--------
|
|
322
|
+
import asyncio
|
|
323
|
+
|
|
324
|
+
from alchemy import AsyncAlchemy
|
|
325
|
+
|
|
326
|
+
client = AsyncAlchemy(
|
|
327
|
+
client_id="YOUR_CLIENT_ID",
|
|
328
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
329
|
+
)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
async def main() -> None:
|
|
333
|
+
await client.invocation.get(
|
|
334
|
+
connect_timeout_ms=1000.0,
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
asyncio.run(main())
|
|
339
|
+
"""
|
|
340
|
+
_response = await self._raw_client.get(
|
|
341
|
+
connect_timeout_ms=connect_timeout_ms, id=id, request_options=request_options
|
|
342
|
+
)
|
|
343
|
+
return _response.data
|
|
344
|
+
|
|
345
|
+
async def invoke(
|
|
346
|
+
self,
|
|
347
|
+
*,
|
|
348
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
349
|
+
function_id: typing.Optional[str] = OMIT,
|
|
350
|
+
version: typing.Optional[str] = OMIT,
|
|
351
|
+
input: typing.Optional[str] = OMIT,
|
|
352
|
+
idempotency_key: typing.Optional[str] = OMIT,
|
|
353
|
+
retries: typing.Optional[int] = OMIT,
|
|
354
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
355
|
+
) -> FunctionsV1InvokeResponse:
|
|
356
|
+
"""
|
|
357
|
+
Invocation; validate input, run one version against it, validate output.
|
|
358
|
+
An RPC error means the function did not produce a result: the request was
|
|
359
|
+
rejected (unknown function, input violates the contract, no capacity) or
|
|
360
|
+
the platform failed. Input violations are INVALID_ARGUMENT with one
|
|
361
|
+
ContractViolation error detail each. If the function ran, the RPC
|
|
362
|
+
succeeds and the response carries its output or a FunctionError. A
|
|
363
|
+
function that raised, crashed or timed out, or a platform that could
|
|
364
|
+
not run it, runs again up to the call's or the function's retries, with
|
|
365
|
+
exponential backoff, while the call's deadline leaves room. An input
|
|
366
|
+
that violates the contract never runs again.
|
|
367
|
+
|
|
368
|
+
Parameters
|
|
369
|
+
----------
|
|
370
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
371
|
+
Define the timeout, in ms
|
|
372
|
+
|
|
373
|
+
function_id : typing.Optional[str]
|
|
374
|
+
|
|
375
|
+
version : typing.Optional[str]
|
|
376
|
+
|
|
377
|
+
input : typing.Optional[str]
|
|
378
|
+
|
|
379
|
+
idempotency_key : typing.Optional[str]
|
|
380
|
+
idempotency_key makes the call safe to retry. Within the server's
|
|
381
|
+
idempotency window, every call to the same function with the same key
|
|
382
|
+
returns the invocation the first call started, with its output or
|
|
383
|
+
error, instead of running again. The key is released, so that a retry
|
|
384
|
+
runs, only when the platform never sent the invocation to a host. A
|
|
385
|
+
call a host took but never reported on has an unknown outcome and holds
|
|
386
|
+
the key: a retry gets ABORTED, and a new key runs again.
|
|
387
|
+
|
|
388
|
+
retries : typing.Optional[int]
|
|
389
|
+
retries, when set, is how many more times this call runs after a failed
|
|
390
|
+
attempt instead of the function's retries.
|
|
391
|
+
|
|
392
|
+
request_options : typing.Optional[RequestOptions]
|
|
393
|
+
Request-specific configuration.
|
|
394
|
+
|
|
395
|
+
Returns
|
|
396
|
+
-------
|
|
397
|
+
FunctionsV1InvokeResponse
|
|
398
|
+
Success
|
|
399
|
+
|
|
400
|
+
Examples
|
|
401
|
+
--------
|
|
402
|
+
import asyncio
|
|
403
|
+
|
|
404
|
+
from alchemy import AsyncAlchemy
|
|
405
|
+
|
|
406
|
+
client = AsyncAlchemy(
|
|
407
|
+
client_id="YOUR_CLIENT_ID",
|
|
408
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
async def main() -> None:
|
|
413
|
+
await client.invocation.invoke(
|
|
414
|
+
connect_timeout_ms=1000.0,
|
|
415
|
+
)
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
asyncio.run(main())
|
|
419
|
+
"""
|
|
420
|
+
_response = await self._raw_client.invoke(
|
|
421
|
+
connect_timeout_ms=connect_timeout_ms,
|
|
422
|
+
function_id=function_id,
|
|
423
|
+
version=version,
|
|
424
|
+
input=input,
|
|
425
|
+
idempotency_key=idempotency_key,
|
|
426
|
+
retries=retries,
|
|
427
|
+
request_options=request_options,
|
|
428
|
+
)
|
|
429
|
+
return _response.data
|
|
430
|
+
|
|
431
|
+
async def invoke_async(
|
|
432
|
+
self,
|
|
433
|
+
*,
|
|
434
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
435
|
+
function_id: typing.Optional[str] = OMIT,
|
|
436
|
+
version: typing.Optional[str] = OMIT,
|
|
437
|
+
input: typing.Optional[str] = OMIT,
|
|
438
|
+
idempotency_key: typing.Optional[str] = OMIT,
|
|
439
|
+
retries: typing.Optional[int] = OMIT,
|
|
440
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
441
|
+
) -> FunctionsV1InvokeAsyncResponse:
|
|
442
|
+
"""
|
|
443
|
+
InvokeAsync queues the invocation and returns its id without waiting.
|
|
444
|
+
The output is dropped. It retries as Invoke does. An idempotency_key
|
|
445
|
+
seen within the window returns the invocation it queued.
|
|
446
|
+
|
|
447
|
+
Parameters
|
|
448
|
+
----------
|
|
449
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
450
|
+
Define the timeout, in ms
|
|
451
|
+
|
|
452
|
+
function_id : typing.Optional[str]
|
|
453
|
+
|
|
454
|
+
version : typing.Optional[str]
|
|
455
|
+
|
|
456
|
+
input : typing.Optional[str]
|
|
457
|
+
|
|
458
|
+
idempotency_key : typing.Optional[str]
|
|
459
|
+
|
|
460
|
+
retries : typing.Optional[int]
|
|
461
|
+
|
|
462
|
+
request_options : typing.Optional[RequestOptions]
|
|
463
|
+
Request-specific configuration.
|
|
464
|
+
|
|
465
|
+
Returns
|
|
466
|
+
-------
|
|
467
|
+
FunctionsV1InvokeAsyncResponse
|
|
468
|
+
Success
|
|
469
|
+
|
|
470
|
+
Examples
|
|
471
|
+
--------
|
|
472
|
+
import asyncio
|
|
473
|
+
|
|
474
|
+
from alchemy import AsyncAlchemy
|
|
475
|
+
|
|
476
|
+
client = AsyncAlchemy(
|
|
477
|
+
client_id="YOUR_CLIENT_ID",
|
|
478
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
async def main() -> None:
|
|
483
|
+
await client.invocation.invoke_async(
|
|
484
|
+
connect_timeout_ms=1000.0,
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
asyncio.run(main())
|
|
489
|
+
"""
|
|
490
|
+
_response = await self._raw_client.invoke_async(
|
|
491
|
+
connect_timeout_ms=connect_timeout_ms,
|
|
492
|
+
function_id=function_id,
|
|
493
|
+
version=version,
|
|
494
|
+
input=input,
|
|
495
|
+
idempotency_key=idempotency_key,
|
|
496
|
+
retries=retries,
|
|
497
|
+
request_options=request_options,
|
|
498
|
+
)
|
|
499
|
+
return _response.data
|
|
500
|
+
|
|
501
|
+
async def list(
|
|
502
|
+
self,
|
|
503
|
+
*,
|
|
504
|
+
connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
|
|
505
|
+
function_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
506
|
+
statuses: typing.Optional[typing.Sequence[FunctionsV1InvocationStatus]] = OMIT,
|
|
507
|
+
start_kinds: typing.Optional[typing.Sequence[FunctionsV1StartKind]] = OMIT,
|
|
508
|
+
pagination: typing.Optional[FunctionsV1PaginationRequest] = OMIT,
|
|
509
|
+
since_ms: typing.Optional[str] = OMIT,
|
|
510
|
+
until_ms: typing.Optional[str] = OMIT,
|
|
511
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
512
|
+
) -> FunctionsV1ListInvocationsResponse:
|
|
513
|
+
"""
|
|
514
|
+
Parameters
|
|
515
|
+
----------
|
|
516
|
+
connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
|
|
517
|
+
Define the timeout, in ms
|
|
518
|
+
|
|
519
|
+
function_ids : typing.Optional[typing.Sequence[str]]
|
|
520
|
+
Empty lists match everything.
|
|
521
|
+
|
|
522
|
+
statuses : typing.Optional[typing.Sequence[FunctionsV1InvocationStatus]]
|
|
523
|
+
|
|
524
|
+
start_kinds : typing.Optional[typing.Sequence[FunctionsV1StartKind]]
|
|
525
|
+
|
|
526
|
+
pagination : typing.Optional[FunctionsV1PaginationRequest]
|
|
527
|
+
|
|
528
|
+
since_ms : typing.Optional[str]
|
|
529
|
+
|
|
530
|
+
until_ms : typing.Optional[str]
|
|
531
|
+
|
|
532
|
+
request_options : typing.Optional[RequestOptions]
|
|
533
|
+
Request-specific configuration.
|
|
534
|
+
|
|
535
|
+
Returns
|
|
536
|
+
-------
|
|
537
|
+
FunctionsV1ListInvocationsResponse
|
|
538
|
+
Success
|
|
539
|
+
|
|
540
|
+
Examples
|
|
541
|
+
--------
|
|
542
|
+
import asyncio
|
|
543
|
+
|
|
544
|
+
from alchemy import AsyncAlchemy
|
|
545
|
+
|
|
546
|
+
client = AsyncAlchemy(
|
|
547
|
+
client_id="YOUR_CLIENT_ID",
|
|
548
|
+
client_secret="YOUR_CLIENT_SECRET",
|
|
549
|
+
)
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
async def main() -> None:
|
|
553
|
+
await client.invocation.list(
|
|
554
|
+
connect_timeout_ms=1000.0,
|
|
555
|
+
)
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
asyncio.run(main())
|
|
559
|
+
"""
|
|
560
|
+
_response = await self._raw_client.list(
|
|
561
|
+
connect_timeout_ms=connect_timeout_ms,
|
|
562
|
+
function_ids=function_ids,
|
|
563
|
+
statuses=statuses,
|
|
564
|
+
start_kinds=start_kinds,
|
|
565
|
+
pagination=pagination,
|
|
566
|
+
since_ms=since_ms,
|
|
567
|
+
until_ms=until_ms,
|
|
568
|
+
request_options=request_options,
|
|
569
|
+
)
|
|
570
|
+
return _response.data
|