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,490 @@
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 ..types.auth_v1create_service_account_response import AuthV1CreateServiceAccountResponse
13
+ from ..types.auth_v1list_service_accounts_request import AuthV1ListServiceAccountsRequest
14
+ from ..types.auth_v1list_service_accounts_response import AuthV1ListServiceAccountsResponse
15
+ from ..types.auth_v1remove_service_account_response import AuthV1RemoveServiceAccountResponse
16
+ from ..types.auth_v1role import AuthV1Role
17
+ from ..types.auth_v1rotate_service_account_secret_response import AuthV1RotateServiceAccountSecretResponse
18
+ from ..types.connect_timeout_header import ConnectTimeoutHeader
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 RawServiceAccountClient:
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
+ name: typing.Optional[str] = OMIT,
34
+ description: typing.Optional[str] = OMIT,
35
+ role: typing.Optional[AuthV1Role] = OMIT,
36
+ request_options: typing.Optional[RequestOptions] = None,
37
+ ) -> HttpResponse[AuthV1CreateServiceAccountResponse]:
38
+ """
39
+ Parameters
40
+ ----------
41
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
42
+ Define the timeout, in ms
43
+
44
+ name : typing.Optional[str]
45
+
46
+ description : typing.Optional[str]
47
+
48
+ role : typing.Optional[AuthV1Role]
49
+
50
+ request_options : typing.Optional[RequestOptions]
51
+ Request-specific configuration.
52
+
53
+ Returns
54
+ -------
55
+ HttpResponse[AuthV1CreateServiceAccountResponse]
56
+ Success
57
+ """
58
+ _response = self._client_wrapper.httpx_client.request(
59
+ "auth.v1.AuthService/CreateServiceAccount",
60
+ method="POST",
61
+ json={
62
+ "name": name,
63
+ "description": description,
64
+ "role": role,
65
+ },
66
+ headers={
67
+ "content-type": "application/json",
68
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
69
+ },
70
+ request_options=request_options,
71
+ omit=OMIT,
72
+ )
73
+ try:
74
+ if 200 <= _response.status_code < 300:
75
+ _data = typing.cast(
76
+ AuthV1CreateServiceAccountResponse,
77
+ parse_obj_as(
78
+ type_=AuthV1CreateServiceAccountResponse, # type: ignore
79
+ object_=_response.json(),
80
+ ),
81
+ )
82
+ return HttpResponse(response=_response, data=_data)
83
+ _response_json = _response.json()
84
+ except JSONDecodeError:
85
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
86
+ except ValidationError as e:
87
+ raise ParsingError(
88
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
89
+ )
90
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
91
+
92
+ def list(
93
+ self,
94
+ *,
95
+ request: AuthV1ListServiceAccountsRequest,
96
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
97
+ request_options: typing.Optional[RequestOptions] = None,
98
+ ) -> HttpResponse[AuthV1ListServiceAccountsResponse]:
99
+ """
100
+ Service accounts; authenticated tenant administration. Secrets are only
101
+ returned by create and rotate and cannot be retrieved later.
102
+
103
+ Parameters
104
+ ----------
105
+ request : AuthV1ListServiceAccountsRequest
106
+
107
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
108
+ Define the timeout, in ms
109
+
110
+ request_options : typing.Optional[RequestOptions]
111
+ Request-specific configuration.
112
+
113
+ Returns
114
+ -------
115
+ HttpResponse[AuthV1ListServiceAccountsResponse]
116
+ Success
117
+ """
118
+ _response = self._client_wrapper.httpx_client.request(
119
+ "auth.v1.AuthService/ListServiceAccounts",
120
+ method="POST",
121
+ json=request,
122
+ headers={
123
+ "content-type": "application/json",
124
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
125
+ },
126
+ request_options=request_options,
127
+ omit=OMIT,
128
+ )
129
+ try:
130
+ if 200 <= _response.status_code < 300:
131
+ _data = typing.cast(
132
+ AuthV1ListServiceAccountsResponse,
133
+ parse_obj_as(
134
+ type_=AuthV1ListServiceAccountsResponse, # type: ignore
135
+ object_=_response.json(),
136
+ ),
137
+ )
138
+ return HttpResponse(response=_response, data=_data)
139
+ _response_json = _response.json()
140
+ except JSONDecodeError:
141
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
142
+ except ValidationError as e:
143
+ raise ParsingError(
144
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
145
+ )
146
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
147
+
148
+ def remove(
149
+ self,
150
+ *,
151
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
152
+ user_id: typing.Optional[str] = OMIT,
153
+ request_options: typing.Optional[RequestOptions] = None,
154
+ ) -> HttpResponse[AuthV1RemoveServiceAccountResponse]:
155
+ """
156
+ Parameters
157
+ ----------
158
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
159
+ Define the timeout, in ms
160
+
161
+ user_id : typing.Optional[str]
162
+
163
+ request_options : typing.Optional[RequestOptions]
164
+ Request-specific configuration.
165
+
166
+ Returns
167
+ -------
168
+ HttpResponse[AuthV1RemoveServiceAccountResponse]
169
+ Success
170
+ """
171
+ _response = self._client_wrapper.httpx_client.request(
172
+ "auth.v1.AuthService/RemoveServiceAccount",
173
+ method="POST",
174
+ json={
175
+ "userId": user_id,
176
+ },
177
+ headers={
178
+ "content-type": "application/json",
179
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
180
+ },
181
+ request_options=request_options,
182
+ omit=OMIT,
183
+ )
184
+ try:
185
+ if 200 <= _response.status_code < 300:
186
+ _data = typing.cast(
187
+ AuthV1RemoveServiceAccountResponse,
188
+ parse_obj_as(
189
+ type_=AuthV1RemoveServiceAccountResponse, # type: ignore
190
+ object_=_response.json(),
191
+ ),
192
+ )
193
+ return HttpResponse(response=_response, data=_data)
194
+ _response_json = _response.json()
195
+ except JSONDecodeError:
196
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
197
+ except ValidationError as e:
198
+ raise ParsingError(
199
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
200
+ )
201
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
202
+
203
+ def rotate_secret(
204
+ self,
205
+ *,
206
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
207
+ user_id: typing.Optional[str] = OMIT,
208
+ request_options: typing.Optional[RequestOptions] = None,
209
+ ) -> HttpResponse[AuthV1RotateServiceAccountSecretResponse]:
210
+ """
211
+ Parameters
212
+ ----------
213
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
214
+ Define the timeout, in ms
215
+
216
+ user_id : typing.Optional[str]
217
+
218
+ request_options : typing.Optional[RequestOptions]
219
+ Request-specific configuration.
220
+
221
+ Returns
222
+ -------
223
+ HttpResponse[AuthV1RotateServiceAccountSecretResponse]
224
+ Success
225
+ """
226
+ _response = self._client_wrapper.httpx_client.request(
227
+ "auth.v1.AuthService/RotateServiceAccountSecret",
228
+ method="POST",
229
+ json={
230
+ "userId": user_id,
231
+ },
232
+ headers={
233
+ "content-type": "application/json",
234
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
235
+ },
236
+ request_options=request_options,
237
+ omit=OMIT,
238
+ )
239
+ try:
240
+ if 200 <= _response.status_code < 300:
241
+ _data = typing.cast(
242
+ AuthV1RotateServiceAccountSecretResponse,
243
+ parse_obj_as(
244
+ type_=AuthV1RotateServiceAccountSecretResponse, # type: ignore
245
+ object_=_response.json(),
246
+ ),
247
+ )
248
+ return HttpResponse(response=_response, data=_data)
249
+ _response_json = _response.json()
250
+ except JSONDecodeError:
251
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
252
+ except ValidationError as e:
253
+ raise ParsingError(
254
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
255
+ )
256
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
257
+
258
+
259
+ class AsyncRawServiceAccountClient:
260
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
261
+ self._client_wrapper = client_wrapper
262
+
263
+ async def create(
264
+ self,
265
+ *,
266
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
267
+ name: typing.Optional[str] = OMIT,
268
+ description: typing.Optional[str] = OMIT,
269
+ role: typing.Optional[AuthV1Role] = OMIT,
270
+ request_options: typing.Optional[RequestOptions] = None,
271
+ ) -> AsyncHttpResponse[AuthV1CreateServiceAccountResponse]:
272
+ """
273
+ Parameters
274
+ ----------
275
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
276
+ Define the timeout, in ms
277
+
278
+ name : typing.Optional[str]
279
+
280
+ description : typing.Optional[str]
281
+
282
+ role : typing.Optional[AuthV1Role]
283
+
284
+ request_options : typing.Optional[RequestOptions]
285
+ Request-specific configuration.
286
+
287
+ Returns
288
+ -------
289
+ AsyncHttpResponse[AuthV1CreateServiceAccountResponse]
290
+ Success
291
+ """
292
+ _response = await self._client_wrapper.httpx_client.request(
293
+ "auth.v1.AuthService/CreateServiceAccount",
294
+ method="POST",
295
+ json={
296
+ "name": name,
297
+ "description": description,
298
+ "role": role,
299
+ },
300
+ headers={
301
+ "content-type": "application/json",
302
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
303
+ },
304
+ request_options=request_options,
305
+ omit=OMIT,
306
+ )
307
+ try:
308
+ if 200 <= _response.status_code < 300:
309
+ _data = typing.cast(
310
+ AuthV1CreateServiceAccountResponse,
311
+ parse_obj_as(
312
+ type_=AuthV1CreateServiceAccountResponse, # type: ignore
313
+ object_=_response.json(),
314
+ ),
315
+ )
316
+ return AsyncHttpResponse(response=_response, data=_data)
317
+ _response_json = _response.json()
318
+ except JSONDecodeError:
319
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
320
+ except ValidationError as e:
321
+ raise ParsingError(
322
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
323
+ )
324
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
325
+
326
+ async def list(
327
+ self,
328
+ *,
329
+ request: AuthV1ListServiceAccountsRequest,
330
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
331
+ request_options: typing.Optional[RequestOptions] = None,
332
+ ) -> AsyncHttpResponse[AuthV1ListServiceAccountsResponse]:
333
+ """
334
+ Service accounts; authenticated tenant administration. Secrets are only
335
+ returned by create and rotate and cannot be retrieved later.
336
+
337
+ Parameters
338
+ ----------
339
+ request : AuthV1ListServiceAccountsRequest
340
+
341
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
342
+ Define the timeout, in ms
343
+
344
+ request_options : typing.Optional[RequestOptions]
345
+ Request-specific configuration.
346
+
347
+ Returns
348
+ -------
349
+ AsyncHttpResponse[AuthV1ListServiceAccountsResponse]
350
+ Success
351
+ """
352
+ _response = await self._client_wrapper.httpx_client.request(
353
+ "auth.v1.AuthService/ListServiceAccounts",
354
+ method="POST",
355
+ json=request,
356
+ headers={
357
+ "content-type": "application/json",
358
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
359
+ },
360
+ request_options=request_options,
361
+ omit=OMIT,
362
+ )
363
+ try:
364
+ if 200 <= _response.status_code < 300:
365
+ _data = typing.cast(
366
+ AuthV1ListServiceAccountsResponse,
367
+ parse_obj_as(
368
+ type_=AuthV1ListServiceAccountsResponse, # type: ignore
369
+ object_=_response.json(),
370
+ ),
371
+ )
372
+ return AsyncHttpResponse(response=_response, data=_data)
373
+ _response_json = _response.json()
374
+ except JSONDecodeError:
375
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
376
+ except ValidationError as e:
377
+ raise ParsingError(
378
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
379
+ )
380
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
381
+
382
+ async def remove(
383
+ self,
384
+ *,
385
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
386
+ user_id: typing.Optional[str] = OMIT,
387
+ request_options: typing.Optional[RequestOptions] = None,
388
+ ) -> AsyncHttpResponse[AuthV1RemoveServiceAccountResponse]:
389
+ """
390
+ Parameters
391
+ ----------
392
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
393
+ Define the timeout, in ms
394
+
395
+ user_id : typing.Optional[str]
396
+
397
+ request_options : typing.Optional[RequestOptions]
398
+ Request-specific configuration.
399
+
400
+ Returns
401
+ -------
402
+ AsyncHttpResponse[AuthV1RemoveServiceAccountResponse]
403
+ Success
404
+ """
405
+ _response = await self._client_wrapper.httpx_client.request(
406
+ "auth.v1.AuthService/RemoveServiceAccount",
407
+ method="POST",
408
+ json={
409
+ "userId": user_id,
410
+ },
411
+ headers={
412
+ "content-type": "application/json",
413
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
414
+ },
415
+ request_options=request_options,
416
+ omit=OMIT,
417
+ )
418
+ try:
419
+ if 200 <= _response.status_code < 300:
420
+ _data = typing.cast(
421
+ AuthV1RemoveServiceAccountResponse,
422
+ parse_obj_as(
423
+ type_=AuthV1RemoveServiceAccountResponse, # type: ignore
424
+ object_=_response.json(),
425
+ ),
426
+ )
427
+ return AsyncHttpResponse(response=_response, data=_data)
428
+ _response_json = _response.json()
429
+ except JSONDecodeError:
430
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
431
+ except ValidationError as e:
432
+ raise ParsingError(
433
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
434
+ )
435
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
436
+
437
+ async def rotate_secret(
438
+ self,
439
+ *,
440
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
441
+ user_id: typing.Optional[str] = OMIT,
442
+ request_options: typing.Optional[RequestOptions] = None,
443
+ ) -> AsyncHttpResponse[AuthV1RotateServiceAccountSecretResponse]:
444
+ """
445
+ Parameters
446
+ ----------
447
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
448
+ Define the timeout, in ms
449
+
450
+ user_id : typing.Optional[str]
451
+
452
+ request_options : typing.Optional[RequestOptions]
453
+ Request-specific configuration.
454
+
455
+ Returns
456
+ -------
457
+ AsyncHttpResponse[AuthV1RotateServiceAccountSecretResponse]
458
+ Success
459
+ """
460
+ _response = await self._client_wrapper.httpx_client.request(
461
+ "auth.v1.AuthService/RotateServiceAccountSecret",
462
+ method="POST",
463
+ json={
464
+ "userId": user_id,
465
+ },
466
+ headers={
467
+ "content-type": "application/json",
468
+ "Connect-Timeout-Ms": str(connect_timeout_ms) if connect_timeout_ms is not None else None,
469
+ },
470
+ request_options=request_options,
471
+ omit=OMIT,
472
+ )
473
+ try:
474
+ if 200 <= _response.status_code < 300:
475
+ _data = typing.cast(
476
+ AuthV1RotateServiceAccountSecretResponse,
477
+ parse_obj_as(
478
+ type_=AuthV1RotateServiceAccountSecretResponse, # type: ignore
479
+ object_=_response.json(),
480
+ ),
481
+ )
482
+ return AsyncHttpResponse(response=_response, data=_data)
483
+ _response_json = _response.json()
484
+ except JSONDecodeError:
485
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
486
+ except ValidationError as e:
487
+ raise ParsingError(
488
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
489
+ )
490
+ 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
+
@@ -0,0 +1,141 @@
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_v1list_templates_request import FunctionsV1ListTemplatesRequest
9
+ from ..types.functions_v1list_templates_response import FunctionsV1ListTemplatesResponse
10
+ from .raw_client import AsyncRawTemplateClient, RawTemplateClient
11
+
12
+ # this is used as the default value for optional parameters
13
+ OMIT = typing.cast(typing.Any, ...)
14
+
15
+
16
+ class TemplateClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._raw_client = RawTemplateClient(client_wrapper=client_wrapper)
19
+
20
+ @property
21
+ def with_raw_response(self) -> RawTemplateClient:
22
+ """
23
+ Retrieves a raw implementation of this client that returns raw responses.
24
+
25
+ Returns
26
+ -------
27
+ RawTemplateClient
28
+ """
29
+ return self._raw_client
30
+
31
+ def list(
32
+ self,
33
+ *,
34
+ request: FunctionsV1ListTemplatesRequest,
35
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
36
+ request_options: typing.Optional[RequestOptions] = None,
37
+ ) -> FunctionsV1ListTemplatesResponse:
38
+ """
39
+ Templates a function can be built from, each with a handler and a sample
40
+ contract per contract kind.
41
+
42
+ Parameters
43
+ ----------
44
+ request : FunctionsV1ListTemplatesRequest
45
+
46
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
47
+ Define the timeout, in ms
48
+
49
+ request_options : typing.Optional[RequestOptions]
50
+ Request-specific configuration.
51
+
52
+ Returns
53
+ -------
54
+ FunctionsV1ListTemplatesResponse
55
+ Success
56
+
57
+ Examples
58
+ --------
59
+ from alchemy import Alchemy
60
+
61
+ client = Alchemy(
62
+ client_id="YOUR_CLIENT_ID",
63
+ client_secret="YOUR_CLIENT_SECRET",
64
+ )
65
+ client.template.list(
66
+ connect_timeout_ms=1000.0,
67
+ request={"key": "value"},
68
+ )
69
+ """
70
+ _response = self._raw_client.list(
71
+ request=request, connect_timeout_ms=connect_timeout_ms, request_options=request_options
72
+ )
73
+ return _response.data
74
+
75
+
76
+ class AsyncTemplateClient:
77
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
78
+ self._raw_client = AsyncRawTemplateClient(client_wrapper=client_wrapper)
79
+
80
+ @property
81
+ def with_raw_response(self) -> AsyncRawTemplateClient:
82
+ """
83
+ Retrieves a raw implementation of this client that returns raw responses.
84
+
85
+ Returns
86
+ -------
87
+ AsyncRawTemplateClient
88
+ """
89
+ return self._raw_client
90
+
91
+ async def list(
92
+ self,
93
+ *,
94
+ request: FunctionsV1ListTemplatesRequest,
95
+ connect_timeout_ms: typing.Optional[ConnectTimeoutHeader] = None,
96
+ request_options: typing.Optional[RequestOptions] = None,
97
+ ) -> FunctionsV1ListTemplatesResponse:
98
+ """
99
+ Templates a function can be built from, each with a handler and a sample
100
+ contract per contract kind.
101
+
102
+ Parameters
103
+ ----------
104
+ request : FunctionsV1ListTemplatesRequest
105
+
106
+ connect_timeout_ms : typing.Optional[ConnectTimeoutHeader]
107
+ Define the timeout, in ms
108
+
109
+ request_options : typing.Optional[RequestOptions]
110
+ Request-specific configuration.
111
+
112
+ Returns
113
+ -------
114
+ FunctionsV1ListTemplatesResponse
115
+ Success
116
+
117
+ Examples
118
+ --------
119
+ import asyncio
120
+
121
+ from alchemy import AsyncAlchemy
122
+
123
+ client = AsyncAlchemy(
124
+ client_id="YOUR_CLIENT_ID",
125
+ client_secret="YOUR_CLIENT_SECRET",
126
+ )
127
+
128
+
129
+ async def main() -> None:
130
+ await client.template.list(
131
+ connect_timeout_ms=1000.0,
132
+ request={"key": "value"},
133
+ )
134
+
135
+
136
+ asyncio.run(main())
137
+ """
138
+ _response = await self._raw_client.list(
139
+ request=request, connect_timeout_ms=connect_timeout_ms, request_options=request_options
140
+ )
141
+ return _response.data