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,410 @@
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.parse_error import ParsingError
10
+ from ...core.pydantic_utilities import parse_obj_as
11
+ from ...core.request_options import RequestOptions
12
+ from ...core.serialization import convert_and_respect_annotation_metadata
13
+ from ...types.connect_timeout_header import ConnectTimeoutHeader
14
+ from ...types.functions_v1create_function_version_response import FunctionsV1CreateFunctionVersionResponse
15
+ from ...types.functions_v1function_spec import FunctionsV1FunctionSpec
16
+ from ...types.functions_v1get_function_version_response import FunctionsV1GetFunctionVersionResponse
17
+ from ...types.functions_v1list_function_versions_response import FunctionsV1ListFunctionVersionsResponse
18
+ from ...types.functions_v1pagination_request import FunctionsV1PaginationRequest
19
+ from pydantic import ValidationError
20
+
21
+ # this is used as the default value for optional parameters
22
+ OMIT = typing.cast(typing.Any, ...)
23
+
24
+
25
+ class RawVersionClient:
26
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
27
+ self._client_wrapper = client_wrapper
28
+
29
+ def create(
30
+ self,
31
+ *,
32
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
33
+ function_id: typing.Optional[str] = OMIT,
34
+ spec: typing.Optional[FunctionsV1FunctionSpec] = OMIT,
35
+ secret_values: typing.Optional[typing.Dict[str, str]] = OMIT,
36
+ request_options: typing.Optional[RequestOptions] = None,
37
+ ) -> HttpResponse[FunctionsV1CreateFunctionVersionResponse]:
38
+ """
39
+ Function versions; immutable image + contract + resources. Builds are
40
+ asynchronous: poll GetFunctionVersion until status leaves BUILDING.
41
+
42
+ Parameters
43
+ ----------
44
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
45
+ Define the timeout, in ms
46
+
47
+ function_id : typing.Optional[str]
48
+
49
+ spec : typing.Optional[FunctionsV1FunctionSpec]
50
+
51
+ secret_values : typing.Optional[typing.Dict[str, str]]
52
+ secret_values are as in CreateFunctionRequest.
53
+
54
+ request_options : typing.Optional[RequestOptions]
55
+ Request-specific configuration.
56
+
57
+ Returns
58
+ -------
59
+ HttpResponse[FunctionsV1CreateFunctionVersionResponse]
60
+ Success
61
+ """
62
+ _response = self._client_wrapper.httpx_client.request(
63
+ "functions.v1.FunctionsService/CreateFunctionVersion",
64
+ method="POST",
65
+ json={
66
+ "functionId": function_id,
67
+ "spec": convert_and_respect_annotation_metadata(
68
+ object_=spec, annotation=FunctionsV1FunctionSpec, direction="write"
69
+ ),
70
+ "secretValues": secret_values,
71
+ },
72
+ headers={
73
+ "content-type": "application/json",
74
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
75
+ },
76
+ request_options=request_options,
77
+ omit=OMIT,
78
+ )
79
+ try:
80
+ if 200 <= _response.status_code < 300:
81
+ _data = typing.cast(
82
+ FunctionsV1CreateFunctionVersionResponse,
83
+ parse_obj_as(
84
+ type_=FunctionsV1CreateFunctionVersionResponse, # type: ignore
85
+ object_=_response.json(),
86
+ ),
87
+ )
88
+ return HttpResponse(response=_response, data=_data)
89
+ _response_json = _response.json()
90
+ except JSONDecodeError:
91
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
92
+ except ValidationError as e:
93
+ raise ParsingError(
94
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
95
+ )
96
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
97
+
98
+ def get(
99
+ self,
100
+ *,
101
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
102
+ function_id: typing.Optional[str] = OMIT,
103
+ version: typing.Optional[str] = OMIT,
104
+ request_options: typing.Optional[RequestOptions] = None,
105
+ ) -> HttpResponse[FunctionsV1GetFunctionVersionResponse]:
106
+ """
107
+ Parameters
108
+ ----------
109
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
110
+ Define the timeout, in ms
111
+
112
+ function_id : typing.Optional[str]
113
+
114
+ version : typing.Optional[str]
115
+
116
+ request_options : typing.Optional[RequestOptions]
117
+ Request-specific configuration.
118
+
119
+ Returns
120
+ -------
121
+ HttpResponse[FunctionsV1GetFunctionVersionResponse]
122
+ Success
123
+ """
124
+ _response = self._client_wrapper.httpx_client.request(
125
+ "functions.v1.FunctionsService/GetFunctionVersion",
126
+ method="POST",
127
+ json={
128
+ "functionId": function_id,
129
+ "version": version,
130
+ },
131
+ headers={
132
+ "content-type": "application/json",
133
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
134
+ },
135
+ request_options=request_options,
136
+ omit=OMIT,
137
+ )
138
+ try:
139
+ if 200 <= _response.status_code < 300:
140
+ _data = typing.cast(
141
+ FunctionsV1GetFunctionVersionResponse,
142
+ parse_obj_as(
143
+ type_=FunctionsV1GetFunctionVersionResponse, # type: ignore
144
+ object_=_response.json(),
145
+ ),
146
+ )
147
+ return HttpResponse(response=_response, data=_data)
148
+ _response_json = _response.json()
149
+ except JSONDecodeError:
150
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
151
+ except ValidationError as e:
152
+ raise ParsingError(
153
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
154
+ )
155
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
156
+
157
+ def list(
158
+ self,
159
+ *,
160
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
161
+ function_id: typing.Optional[str] = OMIT,
162
+ pagination: typing.Optional[FunctionsV1PaginationRequest] = OMIT,
163
+ request_options: typing.Optional[RequestOptions] = None,
164
+ ) -> HttpResponse[FunctionsV1ListFunctionVersionsResponse]:
165
+ """
166
+ Parameters
167
+ ----------
168
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
169
+ Define the timeout, in ms
170
+
171
+ function_id : typing.Optional[str]
172
+
173
+ pagination : typing.Optional[FunctionsV1PaginationRequest]
174
+
175
+ request_options : typing.Optional[RequestOptions]
176
+ Request-specific configuration.
177
+
178
+ Returns
179
+ -------
180
+ HttpResponse[FunctionsV1ListFunctionVersionsResponse]
181
+ Success
182
+ """
183
+ _response = self._client_wrapper.httpx_client.request(
184
+ "functions.v1.FunctionsService/ListFunctionVersions",
185
+ method="POST",
186
+ json={
187
+ "functionId": function_id,
188
+ "pagination": convert_and_respect_annotation_metadata(
189
+ object_=pagination, annotation=FunctionsV1PaginationRequest, direction="write"
190
+ ),
191
+ },
192
+ headers={
193
+ "content-type": "application/json",
194
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
195
+ },
196
+ request_options=request_options,
197
+ omit=OMIT,
198
+ )
199
+ try:
200
+ if 200 <= _response.status_code < 300:
201
+ _data = typing.cast(
202
+ FunctionsV1ListFunctionVersionsResponse,
203
+ parse_obj_as(
204
+ type_=FunctionsV1ListFunctionVersionsResponse, # type: ignore
205
+ object_=_response.json(),
206
+ ),
207
+ )
208
+ return HttpResponse(response=_response, data=_data)
209
+ _response_json = _response.json()
210
+ except JSONDecodeError:
211
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
212
+ except ValidationError as e:
213
+ raise ParsingError(
214
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
215
+ )
216
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
217
+
218
+
219
+ class AsyncRawVersionClient:
220
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
221
+ self._client_wrapper = client_wrapper
222
+
223
+ async def create(
224
+ self,
225
+ *,
226
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
227
+ function_id: typing.Optional[str] = OMIT,
228
+ spec: typing.Optional[FunctionsV1FunctionSpec] = OMIT,
229
+ secret_values: typing.Optional[typing.Dict[str, str]] = OMIT,
230
+ request_options: typing.Optional[RequestOptions] = None,
231
+ ) -> AsyncHttpResponse[FunctionsV1CreateFunctionVersionResponse]:
232
+ """
233
+ Function versions; immutable image + contract + resources. Builds are
234
+ asynchronous: poll GetFunctionVersion until status leaves BUILDING.
235
+
236
+ Parameters
237
+ ----------
238
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
239
+ Define the timeout, in ms
240
+
241
+ function_id : typing.Optional[str]
242
+
243
+ spec : typing.Optional[FunctionsV1FunctionSpec]
244
+
245
+ secret_values : typing.Optional[typing.Dict[str, str]]
246
+ secret_values are as in CreateFunctionRequest.
247
+
248
+ request_options : typing.Optional[RequestOptions]
249
+ Request-specific configuration.
250
+
251
+ Returns
252
+ -------
253
+ AsyncHttpResponse[FunctionsV1CreateFunctionVersionResponse]
254
+ Success
255
+ """
256
+ _response = await self._client_wrapper.httpx_client.request(
257
+ "functions.v1.FunctionsService/CreateFunctionVersion",
258
+ method="POST",
259
+ json={
260
+ "functionId": function_id,
261
+ "spec": convert_and_respect_annotation_metadata(
262
+ object_=spec, annotation=FunctionsV1FunctionSpec, direction="write"
263
+ ),
264
+ "secretValues": secret_values,
265
+ },
266
+ headers={
267
+ "content-type": "application/json",
268
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
269
+ },
270
+ request_options=request_options,
271
+ omit=OMIT,
272
+ )
273
+ try:
274
+ if 200 <= _response.status_code < 300:
275
+ _data = typing.cast(
276
+ FunctionsV1CreateFunctionVersionResponse,
277
+ parse_obj_as(
278
+ type_=FunctionsV1CreateFunctionVersionResponse, # type: ignore
279
+ object_=_response.json(),
280
+ ),
281
+ )
282
+ return AsyncHttpResponse(response=_response, data=_data)
283
+ _response_json = _response.json()
284
+ except JSONDecodeError:
285
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
286
+ except ValidationError as e:
287
+ raise ParsingError(
288
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
289
+ )
290
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
291
+
292
+ async def get(
293
+ self,
294
+ *,
295
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
296
+ function_id: typing.Optional[str] = OMIT,
297
+ version: typing.Optional[str] = OMIT,
298
+ request_options: typing.Optional[RequestOptions] = None,
299
+ ) -> AsyncHttpResponse[FunctionsV1GetFunctionVersionResponse]:
300
+ """
301
+ Parameters
302
+ ----------
303
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
304
+ Define the timeout, in ms
305
+
306
+ function_id : typing.Optional[str]
307
+
308
+ version : typing.Optional[str]
309
+
310
+ request_options : typing.Optional[RequestOptions]
311
+ Request-specific configuration.
312
+
313
+ Returns
314
+ -------
315
+ AsyncHttpResponse[FunctionsV1GetFunctionVersionResponse]
316
+ Success
317
+ """
318
+ _response = await self._client_wrapper.httpx_client.request(
319
+ "functions.v1.FunctionsService/GetFunctionVersion",
320
+ method="POST",
321
+ json={
322
+ "functionId": function_id,
323
+ "version": version,
324
+ },
325
+ headers={
326
+ "content-type": "application/json",
327
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
328
+ },
329
+ request_options=request_options,
330
+ omit=OMIT,
331
+ )
332
+ try:
333
+ if 200 <= _response.status_code < 300:
334
+ _data = typing.cast(
335
+ FunctionsV1GetFunctionVersionResponse,
336
+ parse_obj_as(
337
+ type_=FunctionsV1GetFunctionVersionResponse, # type: ignore
338
+ object_=_response.json(),
339
+ ),
340
+ )
341
+ return AsyncHttpResponse(response=_response, data=_data)
342
+ _response_json = _response.json()
343
+ except JSONDecodeError:
344
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
345
+ except ValidationError as e:
346
+ raise ParsingError(
347
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
348
+ )
349
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
350
+
351
+ async def list(
352
+ self,
353
+ *,
354
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
355
+ function_id: typing.Optional[str] = OMIT,
356
+ pagination: typing.Optional[FunctionsV1PaginationRequest] = OMIT,
357
+ request_options: typing.Optional[RequestOptions] = None,
358
+ ) -> AsyncHttpResponse[FunctionsV1ListFunctionVersionsResponse]:
359
+ """
360
+ Parameters
361
+ ----------
362
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
363
+ Define the timeout, in ms
364
+
365
+ function_id : typing.Optional[str]
366
+
367
+ pagination : typing.Optional[FunctionsV1PaginationRequest]
368
+
369
+ request_options : typing.Optional[RequestOptions]
370
+ Request-specific configuration.
371
+
372
+ Returns
373
+ -------
374
+ AsyncHttpResponse[FunctionsV1ListFunctionVersionsResponse]
375
+ Success
376
+ """
377
+ _response = await self._client_wrapper.httpx_client.request(
378
+ "functions.v1.FunctionsService/ListFunctionVersions",
379
+ method="POST",
380
+ json={
381
+ "functionId": function_id,
382
+ "pagination": convert_and_respect_annotation_metadata(
383
+ object_=pagination, annotation=FunctionsV1PaginationRequest, direction="write"
384
+ ),
385
+ },
386
+ headers={
387
+ "content-type": "application/json",
388
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
389
+ },
390
+ request_options=request_options,
391
+ omit=OMIT,
392
+ )
393
+ try:
394
+ if 200 <= _response.status_code < 300:
395
+ _data = typing.cast(
396
+ FunctionsV1ListFunctionVersionsResponse,
397
+ parse_obj_as(
398
+ type_=FunctionsV1ListFunctionVersionsResponse, # type: ignore
399
+ object_=_response.json(),
400
+ ),
401
+ )
402
+ return AsyncHttpResponse(response=_response, data=_data)
403
+ _response_json = _response.json()
404
+ except JSONDecodeError:
405
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
406
+ except ValidationError as e:
407
+ raise ParsingError(
408
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
409
+ )
410
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -0,0 +1,4 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
alchemy/host/client.py ADDED
@@ -0,0 +1,227 @@
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_host_request import FunctionsV1GetHostRequest
9
+ from ..types.functions_v1get_host_response import FunctionsV1GetHostResponse
10
+ from ..types.functions_v1list_hosts_request import FunctionsV1ListHostsRequest
11
+ from ..types.functions_v1list_hosts_response import FunctionsV1ListHostsResponse
12
+ from .raw_client import AsyncRawHostClient, RawHostClient
13
+
14
+ # this is used as the default value for optional parameters
15
+ OMIT = typing.cast(typing.Any, ...)
16
+
17
+
18
+ class HostClient:
19
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
20
+ self._raw_client = RawHostClient(client_wrapper=client_wrapper)
21
+
22
+ @property
23
+ def with_raw_response(self) -> RawHostClient:
24
+ """
25
+ Retrieves a raw implementation of this client that returns raw responses.
26
+
27
+ Returns
28
+ -------
29
+ RawHostClient
30
+ """
31
+ return self._raw_client
32
+
33
+ def get(
34
+ self,
35
+ *,
36
+ request: FunctionsV1GetHostRequest,
37
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
38
+ request_options: typing.Optional[RequestOptions] = None,
39
+ ) -> FunctionsV1GetHostResponse:
40
+ """
41
+ Parameters
42
+ ----------
43
+ request : FunctionsV1GetHostRequest
44
+
45
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
46
+ Define the timeout, in ms
47
+
48
+ request_options : typing.Optional[RequestOptions]
49
+ Request-specific configuration.
50
+
51
+ Returns
52
+ -------
53
+ FunctionsV1GetHostResponse
54
+ Success
55
+
56
+ Examples
57
+ --------
58
+ from alchemy import Alchemy
59
+
60
+ client = Alchemy(
61
+ client_id="YOUR_CLIENT_ID",
62
+ client_secret="YOUR_CLIENT_SECRET",
63
+ )
64
+ client.host.get(
65
+ connect_timeout_ms=1000.0,
66
+ request={"key": "value"},
67
+ )
68
+ """
69
+ _response = self._raw_client.get(
70
+ request=request, connect_timeout_ms=connect_timeout_ms, request_options=request_options
71
+ )
72
+ return _response.data
73
+
74
+ def list(
75
+ self,
76
+ *,
77
+ request: FunctionsV1ListHostsRequest,
78
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
79
+ request_options: typing.Optional[RequestOptions] = None,
80
+ ) -> FunctionsV1ListHostsResponse:
81
+ """
82
+ Parameters
83
+ ----------
84
+ request : FunctionsV1ListHostsRequest
85
+
86
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
87
+ Define the timeout, in ms
88
+
89
+ request_options : typing.Optional[RequestOptions]
90
+ Request-specific configuration.
91
+
92
+ Returns
93
+ -------
94
+ FunctionsV1ListHostsResponse
95
+ Success
96
+
97
+ Examples
98
+ --------
99
+ from alchemy import Alchemy
100
+
101
+ client = Alchemy(
102
+ client_id="YOUR_CLIENT_ID",
103
+ client_secret="YOUR_CLIENT_SECRET",
104
+ )
105
+ client.host.list(
106
+ connect_timeout_ms=1000.0,
107
+ request={"key": "value"},
108
+ )
109
+ """
110
+ _response = self._raw_client.list(
111
+ request=request, connect_timeout_ms=connect_timeout_ms, request_options=request_options
112
+ )
113
+ return _response.data
114
+
115
+
116
+ class AsyncHostClient:
117
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
118
+ self._raw_client = AsyncRawHostClient(client_wrapper=client_wrapper)
119
+
120
+ @property
121
+ def with_raw_response(self) -> AsyncRawHostClient:
122
+ """
123
+ Retrieves a raw implementation of this client that returns raw responses.
124
+
125
+ Returns
126
+ -------
127
+ AsyncRawHostClient
128
+ """
129
+ return self._raw_client
130
+
131
+ async def get(
132
+ self,
133
+ *,
134
+ request: FunctionsV1GetHostRequest,
135
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
136
+ request_options: typing.Optional[RequestOptions] = None,
137
+ ) -> FunctionsV1GetHostResponse:
138
+ """
139
+ Parameters
140
+ ----------
141
+ request : FunctionsV1GetHostRequest
142
+
143
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
144
+ Define the timeout, in ms
145
+
146
+ request_options : typing.Optional[RequestOptions]
147
+ Request-specific configuration.
148
+
149
+ Returns
150
+ -------
151
+ FunctionsV1GetHostResponse
152
+ Success
153
+
154
+ Examples
155
+ --------
156
+ import asyncio
157
+
158
+ from alchemy import AsyncAlchemy
159
+
160
+ client = AsyncAlchemy(
161
+ client_id="YOUR_CLIENT_ID",
162
+ client_secret="YOUR_CLIENT_SECRET",
163
+ )
164
+
165
+
166
+ async def main() -> None:
167
+ await client.host.get(
168
+ connect_timeout_ms=1000.0,
169
+ request={"key": "value"},
170
+ )
171
+
172
+
173
+ asyncio.run(main())
174
+ """
175
+ _response = await self._raw_client.get(
176
+ request=request, connect_timeout_ms=connect_timeout_ms, request_options=request_options
177
+ )
178
+ return _response.data
179
+
180
+ async def list(
181
+ self,
182
+ *,
183
+ request: FunctionsV1ListHostsRequest,
184
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
185
+ request_options: typing.Optional[RequestOptions] = None,
186
+ ) -> FunctionsV1ListHostsResponse:
187
+ """
188
+ Parameters
189
+ ----------
190
+ request : FunctionsV1ListHostsRequest
191
+
192
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
193
+ Define the timeout, in ms
194
+
195
+ request_options : typing.Optional[RequestOptions]
196
+ Request-specific configuration.
197
+
198
+ Returns
199
+ -------
200
+ FunctionsV1ListHostsResponse
201
+ Success
202
+
203
+ Examples
204
+ --------
205
+ import asyncio
206
+
207
+ from alchemy import AsyncAlchemy
208
+
209
+ client = AsyncAlchemy(
210
+ client_id="YOUR_CLIENT_ID",
211
+ client_secret="YOUR_CLIENT_SECRET",
212
+ )
213
+
214
+
215
+ async def main() -> None:
216
+ await client.host.list(
217
+ connect_timeout_ms=1000.0,
218
+ request={"key": "value"},
219
+ )
220
+
221
+
222
+ asyncio.run(main())
223
+ """
224
+ _response = await self._raw_client.list(
225
+ request=request, connect_timeout_ms=connect_timeout_ms, request_options=request_options
226
+ )
227
+ return _response.data