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.
Files changed (172) hide show
  1. alchemy/.fern/metadata.json +18 -0
  2. alchemy/CONTRIBUTING.md +125 -0
  3. alchemy/__init__.py +380 -0
  4. alchemy/_default_clients.py +30 -0
  5. alchemy/auth/__init__.py +4 -0
  6. alchemy/auth/client.py +767 -0
  7. alchemy/auth/raw_client.py +866 -0
  8. alchemy/client.py +717 -0
  9. alchemy/core/__init__.py +127 -0
  10. alchemy/core/api_error.py +23 -0
  11. alchemy/core/client_wrapper.py +155 -0
  12. alchemy/core/datetime_utils.py +70 -0
  13. alchemy/core/file.py +67 -0
  14. alchemy/core/force_multipart.py +18 -0
  15. alchemy/core/http_client.py +940 -0
  16. alchemy/core/http_response.py +63 -0
  17. alchemy/core/http_sse/__init__.py +42 -0
  18. alchemy/core/http_sse/_api.py +455 -0
  19. alchemy/core/http_sse/_decoders.py +74 -0
  20. alchemy/core/http_sse/_exceptions.py +7 -0
  21. alchemy/core/http_sse/_models.py +17 -0
  22. alchemy/core/jsonable_encoder.py +133 -0
  23. alchemy/core/logging.py +107 -0
  24. alchemy/core/oauth_token_provider.py +73 -0
  25. alchemy/core/parse_error.py +36 -0
  26. alchemy/core/pydantic_utilities.py +486 -0
  27. alchemy/core/query_encoder.py +58 -0
  28. alchemy/core/remove_none_from_dict.py +11 -0
  29. alchemy/core/request_options.py +40 -0
  30. alchemy/core/serialization.py +347 -0
  31. alchemy/environment.py +7 -0
  32. alchemy/function/__init__.py +34 -0
  33. alchemy/function/client.py +808 -0
  34. alchemy/function/raw_client.py +903 -0
  35. alchemy/function/version/__init__.py +4 -0
  36. alchemy/function/version/client.py +364 -0
  37. alchemy/function/version/raw_client.py +410 -0
  38. alchemy/host/__init__.py +4 -0
  39. alchemy/host/client.py +227 -0
  40. alchemy/host/raw_client.py +242 -0
  41. alchemy/instance/__init__.py +4 -0
  42. alchemy/instance/client.py +136 -0
  43. alchemy/instance/raw_client.py +141 -0
  44. alchemy/invocation/__init__.py +4 -0
  45. alchemy/invocation/client.py +570 -0
  46. alchemy/invocation/raw_client.py +636 -0
  47. alchemy/member/__init__.py +4 -0
  48. alchemy/member/client.py +441 -0
  49. alchemy/member/raw_client.py +504 -0
  50. alchemy/metrics/__init__.py +4 -0
  51. alchemy/metrics/client.py +428 -0
  52. alchemy/metrics/raw_client.py +478 -0
  53. alchemy/py.typed +0 -0
  54. alchemy/raw_client.py +138 -0
  55. alchemy/reference.md +3300 -0
  56. alchemy/runtime/__init__.py +4 -0
  57. alchemy/runtime/client.py +141 -0
  58. alchemy/runtime/raw_client.py +140 -0
  59. alchemy/service_account/__init__.py +4 -0
  60. alchemy/service_account/client.py +429 -0
  61. alchemy/service_account/raw_client.py +490 -0
  62. alchemy/template/__init__.py +4 -0
  63. alchemy/template/client.py +141 -0
  64. alchemy/template/raw_client.py +140 -0
  65. alchemy/types/__init__.py +344 -0
  66. alchemy/types/auth_v1accept_invite_response.py +5 -0
  67. alchemy/types/auth_v1create_service_account_response.py +34 -0
  68. alchemy/types/auth_v1get_auth_config_request.py +5 -0
  69. alchemy/types/auth_v1get_auth_config_response.py +53 -0
  70. alchemy/types/auth_v1get_session_request.py +9 -0
  71. alchemy/types/auth_v1get_session_response.py +28 -0
  72. alchemy/types/auth_v1get_token_response.py +29 -0
  73. alchemy/types/auth_v1invite_member_response.py +29 -0
  74. alchemy/types/auth_v1list_members_request.py +5 -0
  75. alchemy/types/auth_v1list_members_response.py +34 -0
  76. alchemy/types/auth_v1list_service_accounts_request.py +5 -0
  77. alchemy/types/auth_v1list_service_accounts_response.py +29 -0
  78. alchemy/types/auth_v1login_response.py +5 -0
  79. alchemy/types/auth_v1logout_request.py +8 -0
  80. alchemy/types/auth_v1logout_response.py +5 -0
  81. alchemy/types/auth_v1member.py +31 -0
  82. alchemy/types/auth_v1register_response.py +23 -0
  83. alchemy/types/auth_v1remove_member_response.py +5 -0
  84. alchemy/types/auth_v1remove_service_account_response.py +5 -0
  85. alchemy/types/auth_v1role.py +5 -0
  86. alchemy/types/auth_v1rotate_service_account_secret_response.py +31 -0
  87. alchemy/types/auth_v1service_account.py +35 -0
  88. alchemy/types/auth_v1set_member_role_response.py +5 -0
  89. alchemy/types/connect_error.py +38 -0
  90. alchemy/types/connect_error_code.py +25 -0
  91. alchemy/types/connect_error_details_any.py +36 -0
  92. alchemy/types/connect_protocol_version.py +5 -0
  93. alchemy/types/connect_timeout_header.py +6 -0
  94. alchemy/types/functions_v1arrow_contract.py +50 -0
  95. alchemy/types/functions_v1contract.py +8 -0
  96. alchemy/types/functions_v1contract_arrow.py +20 -0
  97. alchemy/types/functions_v1contract_json_schema.py +26 -0
  98. alchemy/types/functions_v1contract_violation.py +32 -0
  99. alchemy/types/functions_v1create_function_response.py +22 -0
  100. alchemy/types/functions_v1create_function_version_response.py +20 -0
  101. alchemy/types/functions_v1delete_function_response.py +5 -0
  102. alchemy/types/functions_v1function.py +100 -0
  103. alchemy/types/functions_v1function_error.py +30 -0
  104. alchemy/types/functions_v1function_error_kind.py +15 -0
  105. alchemy/types/functions_v1function_spec.py +58 -0
  106. alchemy/types/functions_v1function_version.py +81 -0
  107. alchemy/types/functions_v1function_version_status.py +13 -0
  108. alchemy/types/functions_v1get_function_response.py +20 -0
  109. alchemy/types/functions_v1get_function_version_response.py +20 -0
  110. alchemy/types/functions_v1get_host_request.py +5 -0
  111. alchemy/types/functions_v1get_host_response.py +20 -0
  112. alchemy/types/functions_v1get_invocation_logs_request.py +31 -0
  113. alchemy/types/functions_v1get_invocation_logs_response.py +24 -0
  114. alchemy/types/functions_v1get_invocation_response.py +20 -0
  115. alchemy/types/functions_v1get_version_request.py +5 -0
  116. alchemy/types/functions_v1get_version_response.py +25 -0
  117. alchemy/types/functions_v1host.py +58 -0
  118. alchemy/types/functions_v1instance.py +54 -0
  119. alchemy/types/functions_v1instance_status.py +14 -0
  120. alchemy/types/functions_v1invocation.py +106 -0
  121. alchemy/types/functions_v1invocation_protocol.py +8 -0
  122. alchemy/types/functions_v1invocation_stats.py +41 -0
  123. alchemy/types/functions_v1invocation_status.py +18 -0
  124. alchemy/types/functions_v1invoke_async_response.py +34 -0
  125. alchemy/types/functions_v1invoke_response.py +8 -0
  126. alchemy/types/functions_v1invoke_response_error.py +20 -0
  127. alchemy/types/functions_v1invoke_response_output.py +19 -0
  128. alchemy/types/functions_v1json_schema_contract.py +28 -0
  129. alchemy/types/functions_v1list_function_versions_response.py +22 -0
  130. alchemy/types/functions_v1list_functions_response.py +22 -0
  131. alchemy/types/functions_v1list_hosts_request.py +5 -0
  132. alchemy/types/functions_v1list_hosts_response.py +23 -0
  133. alchemy/types/functions_v1list_instances_response.py +20 -0
  134. alchemy/types/functions_v1list_invocations_response.py +22 -0
  135. alchemy/types/functions_v1list_runtimes_request.py +5 -0
  136. alchemy/types/functions_v1list_runtimes_response.py +22 -0
  137. alchemy/types/functions_v1list_templates_request.py +5 -0
  138. alchemy/types/functions_v1list_templates_response.py +20 -0
  139. alchemy/types/functions_v1network.py +5 -0
  140. alchemy/types/functions_v1pagination_request.py +31 -0
  141. alchemy/types/functions_v1pagination_response.py +33 -0
  142. alchemy/types/functions_v1resources.py +28 -0
  143. alchemy/types/functions_v1runtime.py +59 -0
  144. alchemy/types/functions_v1runtime_starters.py +29 -0
  145. alchemy/types/functions_v1source.py +31 -0
  146. alchemy/types/functions_v1source_file.py +28 -0
  147. alchemy/types/functions_v1source_layer.py +27 -0
  148. alchemy/types/functions_v1source_limits.py +30 -0
  149. alchemy/types/functions_v1start_kind.py +8 -0
  150. alchemy/types/functions_v1tail_invocations_request.py +32 -0
  151. alchemy/types/functions_v1tail_invocations_response.py +34 -0
  152. alchemy/types/functions_v1template.py +94 -0
  153. alchemy/types/functions_v1template_source.py +27 -0
  154. alchemy/types/functions_v1update_function_response.py +20 -0
  155. alchemy/types/google_protobuf_list_value.py +10 -0
  156. alchemy/types/google_protobuf_null_value.py +5 -0
  157. alchemy/types/google_protobuf_struct.py +10 -0
  158. alchemy/types/google_protobuf_value.py +5 -0
  159. alchemy/types/metrics_v1aggregate_row.py +24 -0
  160. alchemy/types/metrics_v1get_queue_response.py +25 -0
  161. alchemy/types/metrics_v1metric.py +16 -0
  162. alchemy/types/metrics_v1metric_dimension.py +14 -0
  163. alchemy/types/metrics_v1metric_filter.py +26 -0
  164. alchemy/types/metrics_v1metric_granularity.py +13 -0
  165. alchemy/types/metrics_v1query_aggregate_response.py +20 -0
  166. alchemy/types/metrics_v1query_timeseries_response.py +20 -0
  167. alchemy/types/metrics_v1timeseries.py +28 -0
  168. alchemy/types/metrics_v1timeseries_point.py +28 -0
  169. alchemy_python-0.1.0.dist-info/METADATA +196 -0
  170. alchemy_python-0.1.0.dist-info/RECORD +172 -0
  171. alchemy_python-0.1.0.dist-info/WHEEL +4 -0
  172. alchemy_python-0.1.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,903 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import encode_path_param
10
+ from ..core.parse_error import ParsingError
11
+ from ..core.pydantic_utilities import parse_obj_as
12
+ from ..core.request_options import RequestOptions
13
+ from ..core.serialization import convert_and_respect_annotation_metadata
14
+ from ..types.connect_timeout_header import ConnectTimeoutHeader
15
+ from ..types.functions_v1create_function_response import FunctionsV1CreateFunctionResponse
16
+ from ..types.functions_v1delete_function_response import FunctionsV1DeleteFunctionResponse
17
+ from ..types.functions_v1function_spec import FunctionsV1FunctionSpec
18
+ from ..types.functions_v1get_function_response import FunctionsV1GetFunctionResponse
19
+ from ..types.functions_v1list_functions_response import FunctionsV1ListFunctionsResponse
20
+ from ..types.functions_v1network import FunctionsV1Network
21
+ from ..types.functions_v1pagination_request import FunctionsV1PaginationRequest
22
+ from ..types.functions_v1resources import FunctionsV1Resources
23
+ from ..types.functions_v1update_function_response import FunctionsV1UpdateFunctionResponse
24
+ from pydantic import ValidationError
25
+
26
+ # this is used as the default value for optional parameters
27
+ OMIT = typing.cast(typing.Any, ...)
28
+
29
+
30
+ class RawFunctionClient:
31
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
32
+ self._client_wrapper = client_wrapper
33
+
34
+ def create(
35
+ self,
36
+ *,
37
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
38
+ name: typing.Optional[str] = OMIT,
39
+ description: typing.Optional[str] = OMIT,
40
+ spec: typing.Optional[FunctionsV1FunctionSpec] = OMIT,
41
+ secret_values: typing.Optional[typing.Dict[str, str]] = OMIT,
42
+ timeout_ms: typing.Optional[str] = OMIT,
43
+ max_concurrency: typing.Optional[int] = OMIT,
44
+ resources: typing.Optional[FunctionsV1Resources] = OMIT,
45
+ retries: typing.Optional[int] = OMIT,
46
+ network: typing.Optional[FunctionsV1Network] = OMIT,
47
+ request_options: typing.Optional[RequestOptions] = None,
48
+ ) -> HttpResponse[FunctionsV1CreateFunctionResponse]:
49
+ """
50
+ Functions; the stable handle callers invoke.
51
+
52
+ Parameters
53
+ ----------
54
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
55
+ Define the timeout, in ms
56
+
57
+ name : typing.Optional[str]
58
+
59
+ description : typing.Optional[str]
60
+
61
+ spec : typing.Optional[FunctionsV1FunctionSpec]
62
+
63
+ secret_values : typing.Optional[typing.Dict[str, str]]
64
+ secret_values are secrets to create for this version, variable name to
65
+ value. Each is stored under the tenant as a new secret of its own, so a
66
+ later version never changes what this one reads, and named in
67
+ spec.secrets.
68
+
69
+ timeout_ms : typing.Optional[str]
70
+ timeout_ms, max_concurrency and resources are as on Function. Zero
71
+ values take the server defaults.
72
+
73
+ max_concurrency : typing.Optional[int]
74
+
75
+ resources : typing.Optional[FunctionsV1Resources]
76
+
77
+ retries : typing.Optional[int]
78
+ retries is as on Function. Unset takes the default of 2.
79
+
80
+ network : typing.Optional[FunctionsV1Network]
81
+
82
+ request_options : typing.Optional[RequestOptions]
83
+ Request-specific configuration.
84
+
85
+ Returns
86
+ -------
87
+ HttpResponse[FunctionsV1CreateFunctionResponse]
88
+ Success
89
+ """
90
+ _response = self._client_wrapper.httpx_client.request(
91
+ "functions.v1.FunctionsService/CreateFunction",
92
+ method="POST",
93
+ json={
94
+ "name": name,
95
+ "description": description,
96
+ "spec": convert_and_respect_annotation_metadata(
97
+ object_=spec, annotation=FunctionsV1FunctionSpec, direction="write"
98
+ ),
99
+ "secretValues": secret_values,
100
+ "timeoutMs": timeout_ms,
101
+ "maxConcurrency": max_concurrency,
102
+ "resources": convert_and_respect_annotation_metadata(
103
+ object_=resources, annotation=FunctionsV1Resources, direction="write"
104
+ ),
105
+ "retries": retries,
106
+ "network": network,
107
+ },
108
+ headers={
109
+ "content-type": "application/json",
110
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
111
+ },
112
+ request_options=request_options,
113
+ omit=OMIT,
114
+ )
115
+ try:
116
+ if 200 <= _response.status_code < 300:
117
+ _data = typing.cast(
118
+ FunctionsV1CreateFunctionResponse,
119
+ parse_obj_as(
120
+ type_=FunctionsV1CreateFunctionResponse, # type: ignore
121
+ object_=_response.json(),
122
+ ),
123
+ )
124
+ return HttpResponse(response=_response, data=_data)
125
+ _response_json = _response.json()
126
+ except JSONDecodeError:
127
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
128
+ except ValidationError as e:
129
+ raise ParsingError(
130
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
131
+ )
132
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
133
+
134
+ def delete(
135
+ self,
136
+ *,
137
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
138
+ id: typing.Optional[str] = OMIT,
139
+ request_options: typing.Optional[RequestOptions] = None,
140
+ ) -> HttpResponse[FunctionsV1DeleteFunctionResponse]:
141
+ """
142
+ Parameters
143
+ ----------
144
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
145
+ Define the timeout, in ms
146
+
147
+ id : typing.Optional[str]
148
+
149
+ request_options : typing.Optional[RequestOptions]
150
+ Request-specific configuration.
151
+
152
+ Returns
153
+ -------
154
+ HttpResponse[FunctionsV1DeleteFunctionResponse]
155
+ Success
156
+ """
157
+ _response = self._client_wrapper.httpx_client.request(
158
+ "functions.v1.FunctionsService/DeleteFunction",
159
+ method="POST",
160
+ json={
161
+ "id": id,
162
+ },
163
+ headers={
164
+ "content-type": "application/json",
165
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
166
+ },
167
+ request_options=request_options,
168
+ omit=OMIT,
169
+ )
170
+ try:
171
+ if 200 <= _response.status_code < 300:
172
+ _data = typing.cast(
173
+ FunctionsV1DeleteFunctionResponse,
174
+ parse_obj_as(
175
+ type_=FunctionsV1DeleteFunctionResponse, # type: ignore
176
+ object_=_response.json(),
177
+ ),
178
+ )
179
+ return HttpResponse(response=_response, data=_data)
180
+ _response_json = _response.json()
181
+ except JSONDecodeError:
182
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
183
+ except ValidationError as e:
184
+ raise ParsingError(
185
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
186
+ )
187
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
188
+
189
+ def get(
190
+ self,
191
+ *,
192
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
193
+ id: typing.Optional[str] = OMIT,
194
+ include_versions: typing.Optional[bool] = OMIT,
195
+ request_options: typing.Optional[RequestOptions] = None,
196
+ ) -> HttpResponse[FunctionsV1GetFunctionResponse]:
197
+ """
198
+ Parameters
199
+ ----------
200
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
201
+ Define the timeout, in ms
202
+
203
+ id : typing.Optional[str]
204
+
205
+ include_versions : typing.Optional[bool]
206
+
207
+ request_options : typing.Optional[RequestOptions]
208
+ Request-specific configuration.
209
+
210
+ Returns
211
+ -------
212
+ HttpResponse[FunctionsV1GetFunctionResponse]
213
+ Success
214
+ """
215
+ _response = self._client_wrapper.httpx_client.request(
216
+ "functions.v1.FunctionsService/GetFunction",
217
+ method="POST",
218
+ json={
219
+ "id": id,
220
+ "includeVersions": include_versions,
221
+ },
222
+ headers={
223
+ "content-type": "application/json",
224
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
225
+ },
226
+ request_options=request_options,
227
+ omit=OMIT,
228
+ )
229
+ try:
230
+ if 200 <= _response.status_code < 300:
231
+ _data = typing.cast(
232
+ FunctionsV1GetFunctionResponse,
233
+ parse_obj_as(
234
+ type_=FunctionsV1GetFunctionResponse, # type: ignore
235
+ object_=_response.json(),
236
+ ),
237
+ )
238
+ return HttpResponse(response=_response, data=_data)
239
+ _response_json = _response.json()
240
+ except JSONDecodeError:
241
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
242
+ except ValidationError as e:
243
+ raise ParsingError(
244
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
245
+ )
246
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
247
+
248
+ def list(
249
+ self,
250
+ *,
251
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
252
+ pagination: typing.Optional[FunctionsV1PaginationRequest] = OMIT,
253
+ search: typing.Optional[str] = OMIT,
254
+ request_options: typing.Optional[RequestOptions] = None,
255
+ ) -> HttpResponse[FunctionsV1ListFunctionsResponse]:
256
+ """
257
+ Parameters
258
+ ----------
259
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
260
+ Define the timeout, in ms
261
+
262
+ pagination : typing.Optional[FunctionsV1PaginationRequest]
263
+
264
+ search : typing.Optional[str]
265
+
266
+ request_options : typing.Optional[RequestOptions]
267
+ Request-specific configuration.
268
+
269
+ Returns
270
+ -------
271
+ HttpResponse[FunctionsV1ListFunctionsResponse]
272
+ Success
273
+ """
274
+ _response = self._client_wrapper.httpx_client.request(
275
+ "functions.v1.FunctionsService/ListFunctions",
276
+ method="POST",
277
+ json={
278
+ "pagination": convert_and_respect_annotation_metadata(
279
+ object_=pagination, annotation=FunctionsV1PaginationRequest, direction="write"
280
+ ),
281
+ "search": search,
282
+ },
283
+ headers={
284
+ "content-type": "application/json",
285
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
286
+ },
287
+ request_options=request_options,
288
+ omit=OMIT,
289
+ )
290
+ try:
291
+ if 200 <= _response.status_code < 300:
292
+ _data = typing.cast(
293
+ FunctionsV1ListFunctionsResponse,
294
+ parse_obj_as(
295
+ type_=FunctionsV1ListFunctionsResponse, # type: ignore
296
+ object_=_response.json(),
297
+ ),
298
+ )
299
+ return HttpResponse(response=_response, data=_data)
300
+ _response_json = _response.json()
301
+ except JSONDecodeError:
302
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
303
+ except ValidationError as e:
304
+ raise ParsingError(
305
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
306
+ )
307
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
308
+
309
+ def update(
310
+ self,
311
+ *,
312
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
313
+ function_id: typing.Optional[str] = OMIT,
314
+ name: typing.Optional[str] = OMIT,
315
+ description: typing.Optional[str] = OMIT,
316
+ timeout_ms: typing.Optional[str] = OMIT,
317
+ max_concurrency: typing.Optional[int] = OMIT,
318
+ resources: typing.Optional[FunctionsV1Resources] = OMIT,
319
+ retries: typing.Optional[int] = OMIT,
320
+ network: typing.Optional[FunctionsV1Network] = OMIT,
321
+ request_options: typing.Optional[RequestOptions] = None,
322
+ ) -> HttpResponse[FunctionsV1UpdateFunctionResponse]:
323
+ """
324
+ Parameters
325
+ ----------
326
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
327
+ Define the timeout, in ms
328
+
329
+ function_id : typing.Optional[str]
330
+
331
+ name : typing.Optional[str]
332
+
333
+ description : typing.Optional[str]
334
+
335
+ timeout_ms : typing.Optional[str]
336
+
337
+ max_concurrency : typing.Optional[int]
338
+
339
+ resources : typing.Optional[FunctionsV1Resources]
340
+
341
+ retries : typing.Optional[int]
342
+
343
+ network : typing.Optional[FunctionsV1Network]
344
+
345
+ request_options : typing.Optional[RequestOptions]
346
+ Request-specific configuration.
347
+
348
+ Returns
349
+ -------
350
+ HttpResponse[FunctionsV1UpdateFunctionResponse]
351
+ Success
352
+ """
353
+ _response = self._client_wrapper.httpx_client.request(
354
+ "functions.v1.FunctionsService/UpdateFunction",
355
+ method="POST",
356
+ json={
357
+ "functionId": function_id,
358
+ "name": name,
359
+ "description": description,
360
+ "timeoutMs": timeout_ms,
361
+ "maxConcurrency": max_concurrency,
362
+ "resources": convert_and_respect_annotation_metadata(
363
+ object_=resources, annotation=FunctionsV1Resources, direction="write"
364
+ ),
365
+ "retries": retries,
366
+ "network": network,
367
+ },
368
+ headers={
369
+ "content-type": "application/json",
370
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
371
+ },
372
+ request_options=request_options,
373
+ omit=OMIT,
374
+ )
375
+ try:
376
+ if 200 <= _response.status_code < 300:
377
+ _data = typing.cast(
378
+ FunctionsV1UpdateFunctionResponse,
379
+ parse_obj_as(
380
+ type_=FunctionsV1UpdateFunctionResponse, # type: ignore
381
+ object_=_response.json(),
382
+ ),
383
+ )
384
+ return HttpResponse(response=_response, data=_data)
385
+ _response_json = _response.json()
386
+ except JSONDecodeError:
387
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
388
+ except ValidationError as e:
389
+ raise ParsingError(
390
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
391
+ )
392
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
393
+
394
+ def invoke(
395
+ self,
396
+ function: str,
397
+ *,
398
+ request: typing.Any,
399
+ version: typing.Optional[int] = None,
400
+ idempotency_key: typing.Optional[str] = None,
401
+ retries: typing.Optional[int] = None,
402
+ request_options: typing.Optional[RequestOptions] = None,
403
+ ) -> HttpResponse[typing.Any]:
404
+ """
405
+ Runs a function that has a JSON Schema contract. The request body is the input and the response body is the output, with no envelope.
406
+
407
+ Parameters
408
+ ----------
409
+ function : str
410
+ The function id.
411
+
412
+ request : typing.Any
413
+
414
+ version : typing.Optional[int]
415
+ Pins a version. Absent runs the function's current version.
416
+
417
+ idempotency_key : typing.Optional[str]
418
+ Makes the call safe to retry.
419
+
420
+ retries : typing.Optional[int]
421
+ This call's retries instead of the function's.
422
+
423
+ request_options : typing.Optional[RequestOptions]
424
+ Request-specific configuration.
425
+
426
+ Returns
427
+ -------
428
+ HttpResponse[typing.Any]
429
+ The function's output.
430
+ """
431
+ _response = self._client_wrapper.httpx_client.request(
432
+ f"functions/{encode_path_param(function)}/invoke",
433
+ method="POST",
434
+ params={
435
+ "version": version,
436
+ },
437
+ json=request,
438
+ headers={
439
+ "content-type": "application/json",
440
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
441
+ "Alchemy-Retries": str(retries) if retries is not None else None,
442
+ },
443
+ request_options=request_options,
444
+ omit=OMIT,
445
+ )
446
+ try:
447
+ if _response is None or not _response.text.strip():
448
+ return HttpResponse(response=_response, data=None)
449
+ if 200 <= _response.status_code < 300:
450
+ _data = typing.cast(
451
+ typing.Any,
452
+ parse_obj_as(
453
+ type_=typing.Any, # type: ignore
454
+ object_=_response.json(),
455
+ ),
456
+ )
457
+ return HttpResponse(response=_response, data=_data)
458
+ _response_json = _response.json()
459
+ except JSONDecodeError:
460
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
461
+ except ValidationError as e:
462
+ raise ParsingError(
463
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
464
+ )
465
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
466
+
467
+
468
+ class AsyncRawFunctionClient:
469
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
470
+ self._client_wrapper = client_wrapper
471
+
472
+ async def create(
473
+ self,
474
+ *,
475
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
476
+ name: typing.Optional[str] = OMIT,
477
+ description: typing.Optional[str] = OMIT,
478
+ spec: typing.Optional[FunctionsV1FunctionSpec] = OMIT,
479
+ secret_values: typing.Optional[typing.Dict[str, str]] = OMIT,
480
+ timeout_ms: typing.Optional[str] = OMIT,
481
+ max_concurrency: typing.Optional[int] = OMIT,
482
+ resources: typing.Optional[FunctionsV1Resources] = OMIT,
483
+ retries: typing.Optional[int] = OMIT,
484
+ network: typing.Optional[FunctionsV1Network] = OMIT,
485
+ request_options: typing.Optional[RequestOptions] = None,
486
+ ) -> AsyncHttpResponse[FunctionsV1CreateFunctionResponse]:
487
+ """
488
+ Functions; the stable handle callers invoke.
489
+
490
+ Parameters
491
+ ----------
492
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
493
+ Define the timeout, in ms
494
+
495
+ name : typing.Optional[str]
496
+
497
+ description : typing.Optional[str]
498
+
499
+ spec : typing.Optional[FunctionsV1FunctionSpec]
500
+
501
+ secret_values : typing.Optional[typing.Dict[str, str]]
502
+ secret_values are secrets to create for this version, variable name to
503
+ value. Each is stored under the tenant as a new secret of its own, so a
504
+ later version never changes what this one reads, and named in
505
+ spec.secrets.
506
+
507
+ timeout_ms : typing.Optional[str]
508
+ timeout_ms, max_concurrency and resources are as on Function. Zero
509
+ values take the server defaults.
510
+
511
+ max_concurrency : typing.Optional[int]
512
+
513
+ resources : typing.Optional[FunctionsV1Resources]
514
+
515
+ retries : typing.Optional[int]
516
+ retries is as on Function. Unset takes the default of 2.
517
+
518
+ network : typing.Optional[FunctionsV1Network]
519
+
520
+ request_options : typing.Optional[RequestOptions]
521
+ Request-specific configuration.
522
+
523
+ Returns
524
+ -------
525
+ AsyncHttpResponse[FunctionsV1CreateFunctionResponse]
526
+ Success
527
+ """
528
+ _response = await self._client_wrapper.httpx_client.request(
529
+ "functions.v1.FunctionsService/CreateFunction",
530
+ method="POST",
531
+ json={
532
+ "name": name,
533
+ "description": description,
534
+ "spec": convert_and_respect_annotation_metadata(
535
+ object_=spec, annotation=FunctionsV1FunctionSpec, direction="write"
536
+ ),
537
+ "secretValues": secret_values,
538
+ "timeoutMs": timeout_ms,
539
+ "maxConcurrency": max_concurrency,
540
+ "resources": convert_and_respect_annotation_metadata(
541
+ object_=resources, annotation=FunctionsV1Resources, direction="write"
542
+ ),
543
+ "retries": retries,
544
+ "network": network,
545
+ },
546
+ headers={
547
+ "content-type": "application/json",
548
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
549
+ },
550
+ request_options=request_options,
551
+ omit=OMIT,
552
+ )
553
+ try:
554
+ if 200 <= _response.status_code < 300:
555
+ _data = typing.cast(
556
+ FunctionsV1CreateFunctionResponse,
557
+ parse_obj_as(
558
+ type_=FunctionsV1CreateFunctionResponse, # type: ignore
559
+ object_=_response.json(),
560
+ ),
561
+ )
562
+ return AsyncHttpResponse(response=_response, data=_data)
563
+ _response_json = _response.json()
564
+ except JSONDecodeError:
565
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
566
+ except ValidationError as e:
567
+ raise ParsingError(
568
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
569
+ )
570
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
571
+
572
+ async def delete(
573
+ self,
574
+ *,
575
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
576
+ id: typing.Optional[str] = OMIT,
577
+ request_options: typing.Optional[RequestOptions] = None,
578
+ ) -> AsyncHttpResponse[FunctionsV1DeleteFunctionResponse]:
579
+ """
580
+ Parameters
581
+ ----------
582
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
583
+ Define the timeout, in ms
584
+
585
+ id : typing.Optional[str]
586
+
587
+ request_options : typing.Optional[RequestOptions]
588
+ Request-specific configuration.
589
+
590
+ Returns
591
+ -------
592
+ AsyncHttpResponse[FunctionsV1DeleteFunctionResponse]
593
+ Success
594
+ """
595
+ _response = await self._client_wrapper.httpx_client.request(
596
+ "functions.v1.FunctionsService/DeleteFunction",
597
+ method="POST",
598
+ json={
599
+ "id": id,
600
+ },
601
+ headers={
602
+ "content-type": "application/json",
603
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
604
+ },
605
+ request_options=request_options,
606
+ omit=OMIT,
607
+ )
608
+ try:
609
+ if 200 <= _response.status_code < 300:
610
+ _data = typing.cast(
611
+ FunctionsV1DeleteFunctionResponse,
612
+ parse_obj_as(
613
+ type_=FunctionsV1DeleteFunctionResponse, # type: ignore
614
+ object_=_response.json(),
615
+ ),
616
+ )
617
+ return AsyncHttpResponse(response=_response, data=_data)
618
+ _response_json = _response.json()
619
+ except JSONDecodeError:
620
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
621
+ except ValidationError as e:
622
+ raise ParsingError(
623
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
624
+ )
625
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
626
+
627
+ async def get(
628
+ self,
629
+ *,
630
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
631
+ id: typing.Optional[str] = OMIT,
632
+ include_versions: typing.Optional[bool] = OMIT,
633
+ request_options: typing.Optional[RequestOptions] = None,
634
+ ) -> AsyncHttpResponse[FunctionsV1GetFunctionResponse]:
635
+ """
636
+ Parameters
637
+ ----------
638
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
639
+ Define the timeout, in ms
640
+
641
+ id : typing.Optional[str]
642
+
643
+ include_versions : typing.Optional[bool]
644
+
645
+ request_options : typing.Optional[RequestOptions]
646
+ Request-specific configuration.
647
+
648
+ Returns
649
+ -------
650
+ AsyncHttpResponse[FunctionsV1GetFunctionResponse]
651
+ Success
652
+ """
653
+ _response = await self._client_wrapper.httpx_client.request(
654
+ "functions.v1.FunctionsService/GetFunction",
655
+ method="POST",
656
+ json={
657
+ "id": id,
658
+ "includeVersions": include_versions,
659
+ },
660
+ headers={
661
+ "content-type": "application/json",
662
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
663
+ },
664
+ request_options=request_options,
665
+ omit=OMIT,
666
+ )
667
+ try:
668
+ if 200 <= _response.status_code < 300:
669
+ _data = typing.cast(
670
+ FunctionsV1GetFunctionResponse,
671
+ parse_obj_as(
672
+ type_=FunctionsV1GetFunctionResponse, # type: ignore
673
+ object_=_response.json(),
674
+ ),
675
+ )
676
+ return AsyncHttpResponse(response=_response, data=_data)
677
+ _response_json = _response.json()
678
+ except JSONDecodeError:
679
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
680
+ except ValidationError as e:
681
+ raise ParsingError(
682
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
683
+ )
684
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
685
+
686
+ async def list(
687
+ self,
688
+ *,
689
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
690
+ pagination: typing.Optional[FunctionsV1PaginationRequest] = OMIT,
691
+ search: typing.Optional[str] = OMIT,
692
+ request_options: typing.Optional[RequestOptions] = None,
693
+ ) -> AsyncHttpResponse[FunctionsV1ListFunctionsResponse]:
694
+ """
695
+ Parameters
696
+ ----------
697
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
698
+ Define the timeout, in ms
699
+
700
+ pagination : typing.Optional[FunctionsV1PaginationRequest]
701
+
702
+ search : typing.Optional[str]
703
+
704
+ request_options : typing.Optional[RequestOptions]
705
+ Request-specific configuration.
706
+
707
+ Returns
708
+ -------
709
+ AsyncHttpResponse[FunctionsV1ListFunctionsResponse]
710
+ Success
711
+ """
712
+ _response = await self._client_wrapper.httpx_client.request(
713
+ "functions.v1.FunctionsService/ListFunctions",
714
+ method="POST",
715
+ json={
716
+ "pagination": convert_and_respect_annotation_metadata(
717
+ object_=pagination, annotation=FunctionsV1PaginationRequest, direction="write"
718
+ ),
719
+ "search": search,
720
+ },
721
+ headers={
722
+ "content-type": "application/json",
723
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
724
+ },
725
+ request_options=request_options,
726
+ omit=OMIT,
727
+ )
728
+ try:
729
+ if 200 <= _response.status_code < 300:
730
+ _data = typing.cast(
731
+ FunctionsV1ListFunctionsResponse,
732
+ parse_obj_as(
733
+ type_=FunctionsV1ListFunctionsResponse, # type: ignore
734
+ object_=_response.json(),
735
+ ),
736
+ )
737
+ return AsyncHttpResponse(response=_response, data=_data)
738
+ _response_json = _response.json()
739
+ except JSONDecodeError:
740
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
741
+ except ValidationError as e:
742
+ raise ParsingError(
743
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
744
+ )
745
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
746
+
747
+ async def update(
748
+ self,
749
+ *,
750
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
751
+ function_id: typing.Optional[str] = OMIT,
752
+ name: typing.Optional[str] = OMIT,
753
+ description: typing.Optional[str] = OMIT,
754
+ timeout_ms: typing.Optional[str] = OMIT,
755
+ max_concurrency: typing.Optional[int] = OMIT,
756
+ resources: typing.Optional[FunctionsV1Resources] = OMIT,
757
+ retries: typing.Optional[int] = OMIT,
758
+ network: typing.Optional[FunctionsV1Network] = OMIT,
759
+ request_options: typing.Optional[RequestOptions] = None,
760
+ ) -> AsyncHttpResponse[FunctionsV1UpdateFunctionResponse]:
761
+ """
762
+ Parameters
763
+ ----------
764
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
765
+ Define the timeout, in ms
766
+
767
+ function_id : typing.Optional[str]
768
+
769
+ name : typing.Optional[str]
770
+
771
+ description : typing.Optional[str]
772
+
773
+ timeout_ms : typing.Optional[str]
774
+
775
+ max_concurrency : typing.Optional[int]
776
+
777
+ resources : typing.Optional[FunctionsV1Resources]
778
+
779
+ retries : typing.Optional[int]
780
+
781
+ network : typing.Optional[FunctionsV1Network]
782
+
783
+ request_options : typing.Optional[RequestOptions]
784
+ Request-specific configuration.
785
+
786
+ Returns
787
+ -------
788
+ AsyncHttpResponse[FunctionsV1UpdateFunctionResponse]
789
+ Success
790
+ """
791
+ _response = await self._client_wrapper.httpx_client.request(
792
+ "functions.v1.FunctionsService/UpdateFunction",
793
+ method="POST",
794
+ json={
795
+ "functionId": function_id,
796
+ "name": name,
797
+ "description": description,
798
+ "timeoutMs": timeout_ms,
799
+ "maxConcurrency": max_concurrency,
800
+ "resources": convert_and_respect_annotation_metadata(
801
+ object_=resources, annotation=FunctionsV1Resources, direction="write"
802
+ ),
803
+ "retries": retries,
804
+ "network": network,
805
+ },
806
+ headers={
807
+ "content-type": "application/json",
808
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
809
+ },
810
+ request_options=request_options,
811
+ omit=OMIT,
812
+ )
813
+ try:
814
+ if 200 <= _response.status_code < 300:
815
+ _data = typing.cast(
816
+ FunctionsV1UpdateFunctionResponse,
817
+ parse_obj_as(
818
+ type_=FunctionsV1UpdateFunctionResponse, # type: ignore
819
+ object_=_response.json(),
820
+ ),
821
+ )
822
+ return AsyncHttpResponse(response=_response, data=_data)
823
+ _response_json = _response.json()
824
+ except JSONDecodeError:
825
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
826
+ except ValidationError as e:
827
+ raise ParsingError(
828
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
829
+ )
830
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
831
+
832
+ async def invoke(
833
+ self,
834
+ function: str,
835
+ *,
836
+ request: typing.Any,
837
+ version: typing.Optional[int] = None,
838
+ idempotency_key: typing.Optional[str] = None,
839
+ retries: typing.Optional[int] = None,
840
+ request_options: typing.Optional[RequestOptions] = None,
841
+ ) -> AsyncHttpResponse[typing.Any]:
842
+ """
843
+ Runs a function that has a JSON Schema contract. The request body is the input and the response body is the output, with no envelope.
844
+
845
+ Parameters
846
+ ----------
847
+ function : str
848
+ The function id.
849
+
850
+ request : typing.Any
851
+
852
+ version : typing.Optional[int]
853
+ Pins a version. Absent runs the function's current version.
854
+
855
+ idempotency_key : typing.Optional[str]
856
+ Makes the call safe to retry.
857
+
858
+ retries : typing.Optional[int]
859
+ This call's retries instead of the function's.
860
+
861
+ request_options : typing.Optional[RequestOptions]
862
+ Request-specific configuration.
863
+
864
+ Returns
865
+ -------
866
+ AsyncHttpResponse[typing.Any]
867
+ The function's output.
868
+ """
869
+ _response = await self._client_wrapper.httpx_client.request(
870
+ f"functions/{encode_path_param(function)}/invoke",
871
+ method="POST",
872
+ params={
873
+ "version": version,
874
+ },
875
+ json=request,
876
+ headers={
877
+ "content-type": "application/json",
878
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
879
+ "Alchemy-Retries": str(retries) if retries is not None else None,
880
+ },
881
+ request_options=request_options,
882
+ omit=OMIT,
883
+ )
884
+ try:
885
+ if _response is None or not _response.text.strip():
886
+ return AsyncHttpResponse(response=_response, data=None)
887
+ if 200 <= _response.status_code < 300:
888
+ _data = typing.cast(
889
+ typing.Any,
890
+ parse_obj_as(
891
+ type_=typing.Any, # type: ignore
892
+ object_=_response.json(),
893
+ ),
894
+ )
895
+ return AsyncHttpResponse(response=_response, data=_data)
896
+ _response_json = _response.json()
897
+ except JSONDecodeError:
898
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
899
+ except ValidationError as e:
900
+ raise ParsingError(
901
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
902
+ )
903
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)