mirascope 2.0.0a6__py3-none-any.whl → 2.0.1__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 (226) hide show
  1. mirascope/api/_generated/__init__.py +186 -5
  2. mirascope/api/_generated/annotations/client.py +38 -6
  3. mirascope/api/_generated/annotations/raw_client.py +366 -47
  4. mirascope/api/_generated/annotations/types/annotations_create_response.py +19 -6
  5. mirascope/api/_generated/annotations/types/annotations_get_response.py +19 -6
  6. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item.py +22 -7
  7. mirascope/api/_generated/annotations/types/annotations_update_response.py +19 -6
  8. mirascope/api/_generated/api_keys/__init__.py +12 -2
  9. mirascope/api/_generated/api_keys/client.py +107 -6
  10. mirascope/api/_generated/api_keys/raw_client.py +486 -38
  11. mirascope/api/_generated/api_keys/types/__init__.py +7 -1
  12. mirascope/api/_generated/api_keys/types/api_keys_list_all_for_org_response_item.py +40 -0
  13. mirascope/api/_generated/client.py +36 -0
  14. mirascope/api/_generated/docs/raw_client.py +71 -9
  15. mirascope/api/_generated/environment.py +3 -3
  16. mirascope/api/_generated/environments/__init__.py +6 -0
  17. mirascope/api/_generated/environments/client.py +158 -9
  18. mirascope/api/_generated/environments/raw_client.py +620 -52
  19. mirascope/api/_generated/environments/types/__init__.py +10 -0
  20. mirascope/api/_generated/environments/types/environments_get_analytics_response.py +60 -0
  21. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_functions_item.py +24 -0
  22. mirascope/api/_generated/{organizations/types/organizations_credits_response.py → environments/types/environments_get_analytics_response_top_models_item.py} +6 -3
  23. mirascope/api/_generated/errors/__init__.py +6 -0
  24. mirascope/api/_generated/errors/bad_request_error.py +5 -2
  25. mirascope/api/_generated/errors/conflict_error.py +5 -2
  26. mirascope/api/_generated/errors/payment_required_error.py +15 -0
  27. mirascope/api/_generated/errors/service_unavailable_error.py +14 -0
  28. mirascope/api/_generated/errors/too_many_requests_error.py +15 -0
  29. mirascope/api/_generated/functions/__init__.py +10 -0
  30. mirascope/api/_generated/functions/client.py +222 -8
  31. mirascope/api/_generated/functions/raw_client.py +975 -134
  32. mirascope/api/_generated/functions/types/__init__.py +28 -4
  33. mirascope/api/_generated/functions/types/functions_get_by_env_response.py +53 -0
  34. mirascope/api/_generated/functions/types/functions_get_by_env_response_dependencies_value.py +22 -0
  35. mirascope/api/_generated/functions/types/functions_list_by_env_response.py +25 -0
  36. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item.py +56 -0
  37. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item_dependencies_value.py +22 -0
  38. mirascope/api/_generated/health/raw_client.py +74 -10
  39. mirascope/api/_generated/organization_invitations/__init__.py +33 -0
  40. mirascope/api/_generated/organization_invitations/client.py +546 -0
  41. mirascope/api/_generated/organization_invitations/raw_client.py +1519 -0
  42. mirascope/api/_generated/organization_invitations/types/__init__.py +53 -0
  43. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response.py +34 -0
  44. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response_role.py +7 -0
  45. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_request_role.py +7 -0
  46. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response.py +48 -0
  47. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_role.py +7 -0
  48. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_status.py +7 -0
  49. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response.py +48 -0
  50. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_role.py +7 -0
  51. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_status.py +7 -0
  52. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item.py +48 -0
  53. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_role.py +7 -0
  54. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_status.py +7 -0
  55. mirascope/api/_generated/organization_memberships/__init__.py +19 -0
  56. mirascope/api/_generated/organization_memberships/client.py +302 -0
  57. mirascope/api/_generated/organization_memberships/raw_client.py +736 -0
  58. mirascope/api/_generated/organization_memberships/types/__init__.py +27 -0
  59. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item.py +33 -0
  60. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item_role.py +7 -0
  61. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_request_role.py +7 -0
  62. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response.py +31 -0
  63. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response_role.py +7 -0
  64. mirascope/api/_generated/organizations/__init__.py +26 -2
  65. mirascope/api/_generated/organizations/client.py +442 -20
  66. mirascope/api/_generated/organizations/raw_client.py +1763 -164
  67. mirascope/api/_generated/organizations/types/__init__.py +48 -2
  68. mirascope/api/_generated/organizations/types/organizations_create_payment_intent_response.py +24 -0
  69. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_request_target_plan.py +7 -0
  70. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response.py +47 -0
  71. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item.py +33 -0
  72. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item_resource.py +7 -0
  73. mirascope/api/_generated/organizations/types/organizations_router_balance_response.py +24 -0
  74. mirascope/api/_generated/organizations/types/organizations_subscription_response.py +53 -0
  75. mirascope/api/_generated/organizations/types/organizations_subscription_response_current_plan.py +7 -0
  76. mirascope/api/_generated/organizations/types/organizations_subscription_response_payment_method.py +26 -0
  77. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change.py +34 -0
  78. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change_target_plan.py +7 -0
  79. mirascope/api/_generated/organizations/types/organizations_update_subscription_request_target_plan.py +7 -0
  80. mirascope/api/_generated/organizations/types/organizations_update_subscription_response.py +35 -0
  81. mirascope/api/_generated/project_memberships/__init__.py +25 -0
  82. mirascope/api/_generated/project_memberships/client.py +437 -0
  83. mirascope/api/_generated/project_memberships/raw_client.py +1039 -0
  84. mirascope/api/_generated/project_memberships/types/__init__.py +29 -0
  85. mirascope/api/_generated/project_memberships/types/project_memberships_create_request_role.py +7 -0
  86. mirascope/api/_generated/project_memberships/types/project_memberships_create_response.py +35 -0
  87. mirascope/api/_generated/project_memberships/types/project_memberships_create_response_role.py +7 -0
  88. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item.py +33 -0
  89. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item_role.py +7 -0
  90. mirascope/api/_generated/project_memberships/types/project_memberships_update_request_role.py +7 -0
  91. mirascope/api/_generated/project_memberships/types/project_memberships_update_response.py +35 -0
  92. mirascope/api/_generated/project_memberships/types/project_memberships_update_response_role.py +7 -0
  93. mirascope/api/_generated/projects/raw_client.py +415 -58
  94. mirascope/api/_generated/reference.md +2767 -397
  95. mirascope/api/_generated/tags/__init__.py +19 -0
  96. mirascope/api/_generated/tags/client.py +504 -0
  97. mirascope/api/_generated/tags/raw_client.py +1288 -0
  98. mirascope/api/_generated/tags/types/__init__.py +17 -0
  99. mirascope/api/_generated/tags/types/tags_create_response.py +41 -0
  100. mirascope/api/_generated/tags/types/tags_get_response.py +41 -0
  101. mirascope/api/_generated/tags/types/tags_list_response.py +23 -0
  102. mirascope/api/_generated/tags/types/tags_list_response_tags_item.py +41 -0
  103. mirascope/api/_generated/tags/types/tags_update_response.py +41 -0
  104. mirascope/api/_generated/token_cost/__init__.py +7 -0
  105. mirascope/api/_generated/token_cost/client.py +160 -0
  106. mirascope/api/_generated/token_cost/raw_client.py +264 -0
  107. mirascope/api/_generated/token_cost/types/__init__.py +8 -0
  108. mirascope/api/_generated/token_cost/types/token_cost_calculate_request_usage.py +54 -0
  109. mirascope/api/_generated/token_cost/types/token_cost_calculate_response.py +52 -0
  110. mirascope/api/_generated/traces/__init__.py +20 -0
  111. mirascope/api/_generated/traces/client.py +543 -0
  112. mirascope/api/_generated/traces/raw_client.py +1366 -96
  113. mirascope/api/_generated/traces/types/__init__.py +28 -0
  114. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response.py +6 -0
  115. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response.py +33 -0
  116. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response_spans_item.py +88 -0
  117. mirascope/api/_generated/traces/types/traces_get_trace_detail_response_spans_item.py +0 -2
  118. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response.py +25 -0
  119. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response_traces_item.py +44 -0
  120. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item.py +26 -0
  121. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item_operator.py +7 -0
  122. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_by.py +7 -0
  123. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_order.py +7 -0
  124. mirascope/api/_generated/traces/types/traces_search_by_env_response.py +26 -0
  125. mirascope/api/_generated/traces/types/traces_search_by_env_response_spans_item.py +50 -0
  126. mirascope/api/_generated/traces/types/traces_search_response_spans_item.py +10 -1
  127. mirascope/api/_generated/types/__init__.py +32 -2
  128. mirascope/api/_generated/types/bad_request_error_body.py +50 -0
  129. mirascope/api/_generated/types/date.py +3 -0
  130. mirascope/api/_generated/types/immutable_resource_error.py +22 -0
  131. mirascope/api/_generated/types/internal_server_error_body.py +3 -3
  132. mirascope/api/_generated/types/plan_limit_exceeded_error.py +32 -0
  133. mirascope/api/_generated/types/plan_limit_exceeded_error_tag.py +7 -0
  134. mirascope/api/_generated/types/pricing_unavailable_error.py +23 -0
  135. mirascope/api/_generated/types/rate_limit_error.py +31 -0
  136. mirascope/api/_generated/types/rate_limit_error_tag.py +5 -0
  137. mirascope/api/_generated/types/service_unavailable_error_body.py +24 -0
  138. mirascope/api/_generated/types/service_unavailable_error_tag.py +7 -0
  139. mirascope/api/_generated/types/subscription_past_due_error.py +31 -0
  140. mirascope/api/_generated/types/subscription_past_due_error_tag.py +7 -0
  141. mirascope/api/settings.py +19 -1
  142. mirascope/llm/__init__.py +53 -10
  143. mirascope/llm/calls/__init__.py +2 -1
  144. mirascope/llm/calls/calls.py +3 -1
  145. mirascope/llm/calls/decorator.py +21 -7
  146. mirascope/llm/content/tool_output.py +22 -5
  147. mirascope/llm/exceptions.py +284 -71
  148. mirascope/llm/formatting/__init__.py +17 -0
  149. mirascope/llm/formatting/format.py +112 -35
  150. mirascope/llm/formatting/output_parser.py +178 -0
  151. mirascope/llm/formatting/partial.py +80 -7
  152. mirascope/llm/formatting/primitives.py +192 -0
  153. mirascope/llm/formatting/types.py +20 -8
  154. mirascope/llm/messages/__init__.py +3 -0
  155. mirascope/llm/messages/_utils.py +34 -0
  156. mirascope/llm/models/__init__.py +5 -0
  157. mirascope/llm/models/models.py +137 -69
  158. mirascope/llm/{providers/base → models}/params.py +7 -57
  159. mirascope/llm/models/thinking_config.py +61 -0
  160. mirascope/llm/prompts/_utils.py +0 -32
  161. mirascope/llm/prompts/decorator.py +16 -5
  162. mirascope/llm/prompts/prompts.py +131 -68
  163. mirascope/llm/providers/__init__.py +1 -4
  164. mirascope/llm/providers/anthropic/_utils/__init__.py +2 -0
  165. mirascope/llm/providers/anthropic/_utils/beta_decode.py +18 -9
  166. mirascope/llm/providers/anthropic/_utils/beta_encode.py +62 -13
  167. mirascope/llm/providers/anthropic/_utils/decode.py +18 -9
  168. mirascope/llm/providers/anthropic/_utils/encode.py +26 -7
  169. mirascope/llm/providers/anthropic/_utils/errors.py +2 -2
  170. mirascope/llm/providers/anthropic/beta_provider.py +64 -18
  171. mirascope/llm/providers/anthropic/provider.py +91 -33
  172. mirascope/llm/providers/base/__init__.py +0 -4
  173. mirascope/llm/providers/base/_utils.py +55 -6
  174. mirascope/llm/providers/base/base_provider.py +116 -37
  175. mirascope/llm/providers/google/_utils/__init__.py +2 -0
  176. mirascope/llm/providers/google/_utils/decode.py +20 -7
  177. mirascope/llm/providers/google/_utils/encode.py +26 -7
  178. mirascope/llm/providers/google/_utils/errors.py +3 -2
  179. mirascope/llm/providers/google/provider.py +64 -18
  180. mirascope/llm/providers/mirascope/_utils.py +13 -17
  181. mirascope/llm/providers/mirascope/provider.py +49 -18
  182. mirascope/llm/providers/mlx/_utils.py +7 -2
  183. mirascope/llm/providers/mlx/encoding/base.py +5 -2
  184. mirascope/llm/providers/mlx/encoding/transformers.py +5 -2
  185. mirascope/llm/providers/mlx/mlx.py +23 -6
  186. mirascope/llm/providers/mlx/provider.py +42 -13
  187. mirascope/llm/providers/openai/_utils/errors.py +2 -2
  188. mirascope/llm/providers/openai/completions/_utils/encode.py +20 -16
  189. mirascope/llm/providers/openai/completions/base_provider.py +40 -11
  190. mirascope/llm/providers/openai/provider.py +40 -10
  191. mirascope/llm/providers/openai/responses/_utils/__init__.py +2 -0
  192. mirascope/llm/providers/openai/responses/_utils/decode.py +19 -6
  193. mirascope/llm/providers/openai/responses/_utils/encode.py +22 -10
  194. mirascope/llm/providers/openai/responses/provider.py +56 -18
  195. mirascope/llm/providers/provider_registry.py +93 -19
  196. mirascope/llm/responses/__init__.py +6 -1
  197. mirascope/llm/responses/_utils.py +102 -12
  198. mirascope/llm/responses/base_response.py +5 -2
  199. mirascope/llm/responses/base_stream_response.py +115 -25
  200. mirascope/llm/responses/response.py +2 -1
  201. mirascope/llm/responses/root_response.py +89 -17
  202. mirascope/llm/responses/stream_response.py +6 -9
  203. mirascope/llm/tools/decorator.py +9 -4
  204. mirascope/llm/tools/tool_schema.py +12 -6
  205. mirascope/llm/tools/toolkit.py +35 -27
  206. mirascope/llm/tools/tools.py +45 -20
  207. mirascope/ops/__init__.py +4 -0
  208. mirascope/ops/_internal/configuration.py +82 -31
  209. mirascope/ops/_internal/exporters/exporters.py +64 -11
  210. mirascope/ops/_internal/instrumentation/llm/common.py +530 -0
  211. mirascope/ops/_internal/instrumentation/llm/cost.py +190 -0
  212. mirascope/ops/_internal/instrumentation/llm/encode.py +1 -1
  213. mirascope/ops/_internal/instrumentation/llm/llm.py +116 -1242
  214. mirascope/ops/_internal/instrumentation/llm/model.py +1798 -0
  215. mirascope/ops/_internal/instrumentation/llm/response.py +521 -0
  216. mirascope/ops/_internal/instrumentation/llm/serialize.py +300 -0
  217. mirascope/ops/_internal/protocols.py +83 -1
  218. mirascope/ops/_internal/traced_calls.py +4 -0
  219. mirascope/ops/_internal/traced_functions.py +118 -8
  220. mirascope/ops/_internal/tracing.py +78 -1
  221. mirascope/ops/_internal/utils.py +52 -4
  222. {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/METADATA +12 -11
  223. mirascope-2.0.1.dist-info/RECORD +423 -0
  224. {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/licenses/LICENSE +1 -1
  225. mirascope-2.0.0a6.dist-info/RECORD +0 -316
  226. {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/WHEEL +0 -0
@@ -15,16 +15,21 @@ from ..errors.conflict_error import ConflictError
15
15
  from ..errors.forbidden_error import ForbiddenError
16
16
  from ..errors.internal_server_error import InternalServerError
17
17
  from ..errors.not_found_error import NotFoundError
18
+ from ..errors.service_unavailable_error import ServiceUnavailableError
19
+ from ..errors.too_many_requests_error import TooManyRequestsError
18
20
  from ..errors.unauthorized_error import UnauthorizedError
19
- from ..types.already_exists_error import AlreadyExistsError
20
- from ..types.http_api_decode_error import HttpApiDecodeError
21
21
  from ..types.not_found_error_body import NotFoundErrorBody
22
22
  from ..types.permission_denied_error import PermissionDeniedError
23
+ from ..types.rate_limit_error import RateLimitError
23
24
  from ..types.unauthorized_error_body import UnauthorizedErrorBody
24
- from .types.functions_create_request_dependencies_value import FunctionsCreateRequestDependenciesValue
25
+ from .types.functions_create_request_dependencies_value import (
26
+ FunctionsCreateRequestDependenciesValue,
27
+ )
25
28
  from .types.functions_create_response import FunctionsCreateResponse
26
29
  from .types.functions_find_by_hash_response import FunctionsFindByHashResponse
30
+ from .types.functions_get_by_env_response import FunctionsGetByEnvResponse
27
31
  from .types.functions_get_response import FunctionsGetResponse
32
+ from .types.functions_list_by_env_response import FunctionsListByEnvResponse
28
33
  from .types.functions_list_response import FunctionsListResponse
29
34
 
30
35
  # this is used as the default value for optional parameters
@@ -35,7 +40,9 @@ class RawFunctionsClient:
35
40
  def __init__(self, *, client_wrapper: SyncClientWrapper):
36
41
  self._client_wrapper = client_wrapper
37
42
 
38
- def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[FunctionsListResponse]:
43
+ def list(
44
+ self, *, request_options: typing.Optional[RequestOptions] = None
45
+ ) -> HttpResponse[FunctionsListResponse]:
39
46
  """
40
47
  Parameters
41
48
  ----------
@@ -66,9 +73,9 @@ class RawFunctionsClient:
66
73
  raise BadRequestError(
67
74
  headers=dict(_response.headers),
68
75
  body=typing.cast(
69
- HttpApiDecodeError,
76
+ typing.Optional[typing.Any],
70
77
  parse_obj_as(
71
- type_=HttpApiDecodeError, # type: ignore
78
+ type_=typing.Optional[typing.Any], # type: ignore
72
79
  object_=_response.json(),
73
80
  ),
74
81
  ),
@@ -106,6 +113,17 @@ class RawFunctionsClient:
106
113
  ),
107
114
  ),
108
115
  )
116
+ if _response.status_code == 429:
117
+ raise TooManyRequestsError(
118
+ headers=dict(_response.headers),
119
+ body=typing.cast(
120
+ RateLimitError,
121
+ parse_obj_as(
122
+ type_=RateLimitError, # type: ignore
123
+ object_=_response.json(),
124
+ ),
125
+ ),
126
+ )
109
127
  if _response.status_code == 500:
110
128
  raise InternalServerError(
111
129
  headers=dict(_response.headers),
@@ -117,10 +135,29 @@ class RawFunctionsClient:
117
135
  ),
118
136
  ),
119
137
  )
138
+ if _response.status_code == 503:
139
+ raise ServiceUnavailableError(
140
+ headers=dict(_response.headers),
141
+ body=typing.cast(
142
+ typing.Optional[typing.Any],
143
+ parse_obj_as(
144
+ type_=typing.Optional[typing.Any], # type: ignore
145
+ object_=_response.json(),
146
+ ),
147
+ ),
148
+ )
120
149
  _response_json = _response.json()
121
150
  except JSONDecodeError:
122
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
123
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
151
+ raise ApiError(
152
+ status_code=_response.status_code,
153
+ headers=dict(_response.headers),
154
+ body=_response.text,
155
+ )
156
+ raise ApiError(
157
+ status_code=_response.status_code,
158
+ headers=dict(_response.headers),
159
+ body=_response_json,
160
+ )
124
161
 
125
162
  def create(
126
163
  self,
@@ -182,7 +219,10 @@ class RawFunctionsClient:
182
219
  "dependencies": convert_and_respect_annotation_metadata(
183
220
  object_=dependencies,
184
221
  annotation=typing.Optional[
185
- typing.Dict[str, typing.Optional[FunctionsCreateRequestDependenciesValue]]
222
+ typing.Dict[
223
+ str,
224
+ typing.Optional[FunctionsCreateRequestDependenciesValue],
225
+ ]
186
226
  ],
187
227
  direction="write",
188
228
  ),
@@ -207,9 +247,9 @@ class RawFunctionsClient:
207
247
  raise BadRequestError(
208
248
  headers=dict(_response.headers),
209
249
  body=typing.cast(
210
- HttpApiDecodeError,
250
+ typing.Optional[typing.Any],
211
251
  parse_obj_as(
212
- type_=HttpApiDecodeError, # type: ignore
252
+ type_=typing.Optional[typing.Any], # type: ignore
213
253
  object_=_response.json(),
214
254
  ),
215
255
  ),
@@ -251,9 +291,20 @@ class RawFunctionsClient:
251
291
  raise ConflictError(
252
292
  headers=dict(_response.headers),
253
293
  body=typing.cast(
254
- AlreadyExistsError,
294
+ typing.Optional[typing.Any],
295
+ parse_obj_as(
296
+ type_=typing.Optional[typing.Any], # type: ignore
297
+ object_=_response.json(),
298
+ ),
299
+ ),
300
+ )
301
+ if _response.status_code == 429:
302
+ raise TooManyRequestsError(
303
+ headers=dict(_response.headers),
304
+ body=typing.cast(
305
+ RateLimitError,
255
306
  parse_obj_as(
256
- type_=AlreadyExistsError, # type: ignore
307
+ type_=RateLimitError, # type: ignore
257
308
  object_=_response.json(),
258
309
  ),
259
310
  ),
@@ -269,10 +320,29 @@ class RawFunctionsClient:
269
320
  ),
270
321
  ),
271
322
  )
323
+ if _response.status_code == 503:
324
+ raise ServiceUnavailableError(
325
+ headers=dict(_response.headers),
326
+ body=typing.cast(
327
+ typing.Optional[typing.Any],
328
+ parse_obj_as(
329
+ type_=typing.Optional[typing.Any], # type: ignore
330
+ object_=_response.json(),
331
+ ),
332
+ ),
333
+ )
272
334
  _response_json = _response.json()
273
335
  except JSONDecodeError:
274
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
275
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
336
+ raise ApiError(
337
+ status_code=_response.status_code,
338
+ headers=dict(_response.headers),
339
+ body=_response.text,
340
+ )
341
+ raise ApiError(
342
+ status_code=_response.status_code,
343
+ headers=dict(_response.headers),
344
+ body=_response_json,
345
+ )
276
346
 
277
347
  def get(
278
348
  self, id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -309,9 +379,9 @@ class RawFunctionsClient:
309
379
  raise BadRequestError(
310
380
  headers=dict(_response.headers),
311
381
  body=typing.cast(
312
- HttpApiDecodeError,
382
+ typing.Optional[typing.Any],
313
383
  parse_obj_as(
314
- type_=HttpApiDecodeError, # type: ignore
384
+ type_=typing.Optional[typing.Any], # type: ignore
315
385
  object_=_response.json(),
316
386
  ),
317
387
  ),
@@ -349,6 +419,17 @@ class RawFunctionsClient:
349
419
  ),
350
420
  ),
351
421
  )
422
+ if _response.status_code == 429:
423
+ raise TooManyRequestsError(
424
+ headers=dict(_response.headers),
425
+ body=typing.cast(
426
+ RateLimitError,
427
+ parse_obj_as(
428
+ type_=RateLimitError, # type: ignore
429
+ object_=_response.json(),
430
+ ),
431
+ ),
432
+ )
352
433
  if _response.status_code == 500:
353
434
  raise InternalServerError(
354
435
  headers=dict(_response.headers),
@@ -360,12 +441,33 @@ class RawFunctionsClient:
360
441
  ),
361
442
  ),
362
443
  )
444
+ if _response.status_code == 503:
445
+ raise ServiceUnavailableError(
446
+ headers=dict(_response.headers),
447
+ body=typing.cast(
448
+ typing.Optional[typing.Any],
449
+ parse_obj_as(
450
+ type_=typing.Optional[typing.Any], # type: ignore
451
+ object_=_response.json(),
452
+ ),
453
+ ),
454
+ )
363
455
  _response_json = _response.json()
364
456
  except JSONDecodeError:
365
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
366
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
457
+ raise ApiError(
458
+ status_code=_response.status_code,
459
+ headers=dict(_response.headers),
460
+ body=_response.text,
461
+ )
462
+ raise ApiError(
463
+ status_code=_response.status_code,
464
+ headers=dict(_response.headers),
465
+ body=_response_json,
466
+ )
367
467
 
368
- def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
468
+ def delete(
469
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
470
+ ) -> HttpResponse[None]:
369
471
  """
370
472
  Parameters
371
473
  ----------
@@ -390,9 +492,9 @@ class RawFunctionsClient:
390
492
  raise BadRequestError(
391
493
  headers=dict(_response.headers),
392
494
  body=typing.cast(
393
- HttpApiDecodeError,
495
+ typing.Optional[typing.Any],
394
496
  parse_obj_as(
395
- type_=HttpApiDecodeError, # type: ignore
497
+ type_=typing.Optional[typing.Any], # type: ignore
396
498
  object_=_response.json(),
397
499
  ),
398
500
  ),
@@ -430,6 +532,17 @@ class RawFunctionsClient:
430
532
  ),
431
533
  ),
432
534
  )
535
+ if _response.status_code == 429:
536
+ raise TooManyRequestsError(
537
+ headers=dict(_response.headers),
538
+ body=typing.cast(
539
+ RateLimitError,
540
+ parse_obj_as(
541
+ type_=RateLimitError, # type: ignore
542
+ object_=_response.json(),
543
+ ),
544
+ ),
545
+ )
433
546
  if _response.status_code == 500:
434
547
  raise InternalServerError(
435
548
  headers=dict(_response.headers),
@@ -441,10 +554,29 @@ class RawFunctionsClient:
441
554
  ),
442
555
  ),
443
556
  )
557
+ if _response.status_code == 503:
558
+ raise ServiceUnavailableError(
559
+ headers=dict(_response.headers),
560
+ body=typing.cast(
561
+ typing.Optional[typing.Any],
562
+ parse_obj_as(
563
+ type_=typing.Optional[typing.Any], # type: ignore
564
+ object_=_response.json(),
565
+ ),
566
+ ),
567
+ )
444
568
  _response_json = _response.json()
445
569
  except JSONDecodeError:
446
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
447
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
570
+ raise ApiError(
571
+ status_code=_response.status_code,
572
+ headers=dict(_response.headers),
573
+ body=_response.text,
574
+ )
575
+ raise ApiError(
576
+ status_code=_response.status_code,
577
+ headers=dict(_response.headers),
578
+ body=_response_json,
579
+ )
448
580
 
449
581
  def findbyhash(
450
582
  self, hash: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -481,9 +613,9 @@ class RawFunctionsClient:
481
613
  raise BadRequestError(
482
614
  headers=dict(_response.headers),
483
615
  body=typing.cast(
484
- HttpApiDecodeError,
616
+ typing.Optional[typing.Any],
485
617
  parse_obj_as(
486
- type_=HttpApiDecodeError, # type: ignore
618
+ type_=typing.Optional[typing.Any], # type: ignore
487
619
  object_=_response.json(),
488
620
  ),
489
621
  ),
@@ -521,6 +653,17 @@ class RawFunctionsClient:
521
653
  ),
522
654
  ),
523
655
  )
656
+ if _response.status_code == 429:
657
+ raise TooManyRequestsError(
658
+ headers=dict(_response.headers),
659
+ body=typing.cast(
660
+ RateLimitError,
661
+ parse_obj_as(
662
+ type_=RateLimitError, # type: ignore
663
+ object_=_response.json(),
664
+ ),
665
+ ),
666
+ )
524
667
  if _response.status_code == 500:
525
668
  raise InternalServerError(
526
669
  headers=dict(_response.headers),
@@ -532,52 +675,80 @@ class RawFunctionsClient:
532
675
  ),
533
676
  ),
534
677
  )
678
+ if _response.status_code == 503:
679
+ raise ServiceUnavailableError(
680
+ headers=dict(_response.headers),
681
+ body=typing.cast(
682
+ typing.Optional[typing.Any],
683
+ parse_obj_as(
684
+ type_=typing.Optional[typing.Any], # type: ignore
685
+ object_=_response.json(),
686
+ ),
687
+ ),
688
+ )
535
689
  _response_json = _response.json()
536
690
  except JSONDecodeError:
537
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
538
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
539
-
540
-
541
- class AsyncRawFunctionsClient:
542
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
543
- self._client_wrapper = client_wrapper
691
+ raise ApiError(
692
+ status_code=_response.status_code,
693
+ headers=dict(_response.headers),
694
+ body=_response.text,
695
+ )
696
+ raise ApiError(
697
+ status_code=_response.status_code,
698
+ headers=dict(_response.headers),
699
+ body=_response_json,
700
+ )
544
701
 
545
- async def list(
546
- self, *, request_options: typing.Optional[RequestOptions] = None
547
- ) -> AsyncHttpResponse[FunctionsListResponse]:
702
+ def getbyenv(
703
+ self,
704
+ organization_id: str,
705
+ project_id: str,
706
+ environment_id: str,
707
+ function_id: str,
708
+ *,
709
+ request_options: typing.Optional[RequestOptions] = None,
710
+ ) -> HttpResponse[FunctionsGetByEnvResponse]:
548
711
  """
549
712
  Parameters
550
713
  ----------
714
+ organization_id : str
715
+
716
+ project_id : str
717
+
718
+ environment_id : str
719
+
720
+ function_id : str
721
+
551
722
  request_options : typing.Optional[RequestOptions]
552
723
  Request-specific configuration.
553
724
 
554
725
  Returns
555
726
  -------
556
- AsyncHttpResponse[FunctionsListResponse]
727
+ HttpResponse[FunctionsGetByEnvResponse]
557
728
  Success
558
729
  """
559
- _response = await self._client_wrapper.httpx_client.request(
560
- "functions",
730
+ _response = self._client_wrapper.httpx_client.request(
731
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/functions/{jsonable_encoder(function_id)}",
561
732
  method="GET",
562
733
  request_options=request_options,
563
734
  )
564
735
  try:
565
736
  if 200 <= _response.status_code < 300:
566
737
  _data = typing.cast(
567
- FunctionsListResponse,
738
+ FunctionsGetByEnvResponse,
568
739
  parse_obj_as(
569
- type_=FunctionsListResponse, # type: ignore
740
+ type_=FunctionsGetByEnvResponse, # type: ignore
570
741
  object_=_response.json(),
571
742
  ),
572
743
  )
573
- return AsyncHttpResponse(response=_response, data=_data)
744
+ return HttpResponse(response=_response, data=_data)
574
745
  if _response.status_code == 400:
575
746
  raise BadRequestError(
576
747
  headers=dict(_response.headers),
577
748
  body=typing.cast(
578
- HttpApiDecodeError,
749
+ typing.Optional[typing.Any],
579
750
  parse_obj_as(
580
- type_=HttpApiDecodeError, # type: ignore
751
+ type_=typing.Optional[typing.Any], # type: ignore
581
752
  object_=_response.json(),
582
753
  ),
583
754
  ),
@@ -615,6 +786,17 @@ class AsyncRawFunctionsClient:
615
786
  ),
616
787
  ),
617
788
  )
789
+ if _response.status_code == 429:
790
+ raise TooManyRequestsError(
791
+ headers=dict(_response.headers),
792
+ body=typing.cast(
793
+ RateLimitError,
794
+ parse_obj_as(
795
+ type_=RateLimitError, # type: ignore
796
+ object_=_response.json(),
797
+ ),
798
+ ),
799
+ )
618
800
  if _response.status_code == 500:
619
801
  raise InternalServerError(
620
802
  headers=dict(_response.headers),
@@ -626,99 +808,77 @@ class AsyncRawFunctionsClient:
626
808
  ),
627
809
  ),
628
810
  )
811
+ if _response.status_code == 503:
812
+ raise ServiceUnavailableError(
813
+ headers=dict(_response.headers),
814
+ body=typing.cast(
815
+ typing.Optional[typing.Any],
816
+ parse_obj_as(
817
+ type_=typing.Optional[typing.Any], # type: ignore
818
+ object_=_response.json(),
819
+ ),
820
+ ),
821
+ )
629
822
  _response_json = _response.json()
630
823
  except JSONDecodeError:
631
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
632
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
824
+ raise ApiError(
825
+ status_code=_response.status_code,
826
+ headers=dict(_response.headers),
827
+ body=_response.text,
828
+ )
829
+ raise ApiError(
830
+ status_code=_response.status_code,
831
+ headers=dict(_response.headers),
832
+ body=_response_json,
833
+ )
633
834
 
634
- async def create(
835
+ def listbyenv(
635
836
  self,
837
+ organization_id: str,
838
+ project_id: str,
839
+ environment_id: str,
636
840
  *,
637
- code: str,
638
- hash: str,
639
- signature: str,
640
- signature_hash: str,
641
- name: str,
642
- description: typing.Optional[str] = OMIT,
643
- tags: typing.Optional[typing.Sequence[str]] = OMIT,
644
- metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
645
- dependencies: typing.Optional[
646
- typing.Dict[str, typing.Optional[FunctionsCreateRequestDependenciesValue]]
647
- ] = OMIT,
648
841
  request_options: typing.Optional[RequestOptions] = None,
649
- ) -> AsyncHttpResponse[FunctionsCreateResponse]:
842
+ ) -> HttpResponse[FunctionsListByEnvResponse]:
650
843
  """
651
844
  Parameters
652
845
  ----------
653
- code : str
654
-
655
- hash : str
656
-
657
- signature : str
658
-
659
- signature_hash : str
660
-
661
- name : str
662
-
663
- description : typing.Optional[str]
664
-
665
- tags : typing.Optional[typing.Sequence[str]]
846
+ organization_id : str
666
847
 
667
- metadata : typing.Optional[typing.Dict[str, typing.Optional[str]]]
848
+ project_id : str
668
849
 
669
- dependencies : typing.Optional[typing.Dict[str, typing.Optional[FunctionsCreateRequestDependenciesValue]]]
850
+ environment_id : str
670
851
 
671
852
  request_options : typing.Optional[RequestOptions]
672
853
  Request-specific configuration.
673
854
 
674
855
  Returns
675
856
  -------
676
- AsyncHttpResponse[FunctionsCreateResponse]
857
+ HttpResponse[FunctionsListByEnvResponse]
677
858
  Success
678
859
  """
679
- _response = await self._client_wrapper.httpx_client.request(
680
- "functions",
681
- method="POST",
682
- json={
683
- "code": code,
684
- "hash": hash,
685
- "signature": signature,
686
- "signatureHash": signature_hash,
687
- "name": name,
688
- "description": description,
689
- "tags": tags,
690
- "metadata": metadata,
691
- "dependencies": convert_and_respect_annotation_metadata(
692
- object_=dependencies,
693
- annotation=typing.Optional[
694
- typing.Dict[str, typing.Optional[FunctionsCreateRequestDependenciesValue]]
695
- ],
696
- direction="write",
697
- ),
698
- },
699
- headers={
700
- "content-type": "application/json",
701
- },
860
+ _response = self._client_wrapper.httpx_client.request(
861
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/functions",
862
+ method="GET",
702
863
  request_options=request_options,
703
- omit=OMIT,
704
864
  )
705
865
  try:
706
866
  if 200 <= _response.status_code < 300:
707
867
  _data = typing.cast(
708
- FunctionsCreateResponse,
868
+ FunctionsListByEnvResponse,
709
869
  parse_obj_as(
710
- type_=FunctionsCreateResponse, # type: ignore
870
+ type_=FunctionsListByEnvResponse, # type: ignore
711
871
  object_=_response.json(),
712
872
  ),
713
873
  )
714
- return AsyncHttpResponse(response=_response, data=_data)
874
+ return HttpResponse(response=_response, data=_data)
715
875
  if _response.status_code == 400:
716
876
  raise BadRequestError(
717
877
  headers=dict(_response.headers),
718
878
  body=typing.cast(
719
- HttpApiDecodeError,
879
+ typing.Optional[typing.Any],
720
880
  parse_obj_as(
721
- type_=HttpApiDecodeError, # type: ignore
881
+ type_=typing.Optional[typing.Any], # type: ignore
722
882
  object_=_response.json(),
723
883
  ),
724
884
  ),
@@ -756,13 +916,13 @@ class AsyncRawFunctionsClient:
756
916
  ),
757
917
  ),
758
918
  )
759
- if _response.status_code == 409:
760
- raise ConflictError(
919
+ if _response.status_code == 429:
920
+ raise TooManyRequestsError(
761
921
  headers=dict(_response.headers),
762
922
  body=typing.cast(
763
- AlreadyExistsError,
923
+ RateLimitError,
764
924
  parse_obj_as(
765
- type_=AlreadyExistsError, # type: ignore
925
+ type_=RateLimitError, # type: ignore
766
926
  object_=_response.json(),
767
927
  ),
768
928
  ),
@@ -778,38 +938,60 @@ class AsyncRawFunctionsClient:
778
938
  ),
779
939
  ),
780
940
  )
941
+ if _response.status_code == 503:
942
+ raise ServiceUnavailableError(
943
+ headers=dict(_response.headers),
944
+ body=typing.cast(
945
+ typing.Optional[typing.Any],
946
+ parse_obj_as(
947
+ type_=typing.Optional[typing.Any], # type: ignore
948
+ object_=_response.json(),
949
+ ),
950
+ ),
951
+ )
781
952
  _response_json = _response.json()
782
953
  except JSONDecodeError:
783
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
784
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
954
+ raise ApiError(
955
+ status_code=_response.status_code,
956
+ headers=dict(_response.headers),
957
+ body=_response.text,
958
+ )
959
+ raise ApiError(
960
+ status_code=_response.status_code,
961
+ headers=dict(_response.headers),
962
+ body=_response_json,
963
+ )
785
964
 
786
- async def get(
787
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
788
- ) -> AsyncHttpResponse[FunctionsGetResponse]:
965
+
966
+ class AsyncRawFunctionsClient:
967
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
968
+ self._client_wrapper = client_wrapper
969
+
970
+ async def list(
971
+ self, *, request_options: typing.Optional[RequestOptions] = None
972
+ ) -> AsyncHttpResponse[FunctionsListResponse]:
789
973
  """
790
974
  Parameters
791
975
  ----------
792
- id : str
793
-
794
976
  request_options : typing.Optional[RequestOptions]
795
977
  Request-specific configuration.
796
978
 
797
979
  Returns
798
980
  -------
799
- AsyncHttpResponse[FunctionsGetResponse]
981
+ AsyncHttpResponse[FunctionsListResponse]
800
982
  Success
801
983
  """
802
984
  _response = await self._client_wrapper.httpx_client.request(
803
- f"functions/{jsonable_encoder(id)}",
985
+ "functions",
804
986
  method="GET",
805
987
  request_options=request_options,
806
988
  )
807
989
  try:
808
990
  if 200 <= _response.status_code < 300:
809
991
  _data = typing.cast(
810
- FunctionsGetResponse,
992
+ FunctionsListResponse,
811
993
  parse_obj_as(
812
- type_=FunctionsGetResponse, # type: ignore
994
+ type_=FunctionsListResponse, # type: ignore
813
995
  object_=_response.json(),
814
996
  ),
815
997
  )
@@ -818,9 +1000,9 @@ class AsyncRawFunctionsClient:
818
1000
  raise BadRequestError(
819
1001
  headers=dict(_response.headers),
820
1002
  body=typing.cast(
821
- HttpApiDecodeError,
1003
+ typing.Optional[typing.Any],
822
1004
  parse_obj_as(
823
- type_=HttpApiDecodeError, # type: ignore
1005
+ type_=typing.Optional[typing.Any], # type: ignore
824
1006
  object_=_response.json(),
825
1007
  ),
826
1008
  ),
@@ -858,6 +1040,17 @@ class AsyncRawFunctionsClient:
858
1040
  ),
859
1041
  ),
860
1042
  )
1043
+ if _response.status_code == 429:
1044
+ raise TooManyRequestsError(
1045
+ headers=dict(_response.headers),
1046
+ body=typing.cast(
1047
+ RateLimitError,
1048
+ parse_obj_as(
1049
+ type_=RateLimitError, # type: ignore
1050
+ object_=_response.json(),
1051
+ ),
1052
+ ),
1053
+ )
861
1054
  if _response.status_code == 500:
862
1055
  raise InternalServerError(
863
1056
  headers=dict(_response.headers),
@@ -869,14 +1062,339 @@ class AsyncRawFunctionsClient:
869
1062
  ),
870
1063
  ),
871
1064
  )
1065
+ if _response.status_code == 503:
1066
+ raise ServiceUnavailableError(
1067
+ headers=dict(_response.headers),
1068
+ body=typing.cast(
1069
+ typing.Optional[typing.Any],
1070
+ parse_obj_as(
1071
+ type_=typing.Optional[typing.Any], # type: ignore
1072
+ object_=_response.json(),
1073
+ ),
1074
+ ),
1075
+ )
872
1076
  _response_json = _response.json()
873
1077
  except JSONDecodeError:
874
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
875
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1078
+ raise ApiError(
1079
+ status_code=_response.status_code,
1080
+ headers=dict(_response.headers),
1081
+ body=_response.text,
1082
+ )
1083
+ raise ApiError(
1084
+ status_code=_response.status_code,
1085
+ headers=dict(_response.headers),
1086
+ body=_response_json,
1087
+ )
876
1088
 
877
- async def delete(
878
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
879
- ) -> AsyncHttpResponse[None]:
1089
+ async def create(
1090
+ self,
1091
+ *,
1092
+ code: str,
1093
+ hash: str,
1094
+ signature: str,
1095
+ signature_hash: str,
1096
+ name: str,
1097
+ description: typing.Optional[str] = OMIT,
1098
+ tags: typing.Optional[typing.Sequence[str]] = OMIT,
1099
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
1100
+ dependencies: typing.Optional[
1101
+ typing.Dict[str, typing.Optional[FunctionsCreateRequestDependenciesValue]]
1102
+ ] = OMIT,
1103
+ request_options: typing.Optional[RequestOptions] = None,
1104
+ ) -> AsyncHttpResponse[FunctionsCreateResponse]:
1105
+ """
1106
+ Parameters
1107
+ ----------
1108
+ code : str
1109
+
1110
+ hash : str
1111
+
1112
+ signature : str
1113
+
1114
+ signature_hash : str
1115
+
1116
+ name : str
1117
+
1118
+ description : typing.Optional[str]
1119
+
1120
+ tags : typing.Optional[typing.Sequence[str]]
1121
+
1122
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[str]]]
1123
+
1124
+ dependencies : typing.Optional[typing.Dict[str, typing.Optional[FunctionsCreateRequestDependenciesValue]]]
1125
+
1126
+ request_options : typing.Optional[RequestOptions]
1127
+ Request-specific configuration.
1128
+
1129
+ Returns
1130
+ -------
1131
+ AsyncHttpResponse[FunctionsCreateResponse]
1132
+ Success
1133
+ """
1134
+ _response = await self._client_wrapper.httpx_client.request(
1135
+ "functions",
1136
+ method="POST",
1137
+ json={
1138
+ "code": code,
1139
+ "hash": hash,
1140
+ "signature": signature,
1141
+ "signatureHash": signature_hash,
1142
+ "name": name,
1143
+ "description": description,
1144
+ "tags": tags,
1145
+ "metadata": metadata,
1146
+ "dependencies": convert_and_respect_annotation_metadata(
1147
+ object_=dependencies,
1148
+ annotation=typing.Optional[
1149
+ typing.Dict[
1150
+ str,
1151
+ typing.Optional[FunctionsCreateRequestDependenciesValue],
1152
+ ]
1153
+ ],
1154
+ direction="write",
1155
+ ),
1156
+ },
1157
+ headers={
1158
+ "content-type": "application/json",
1159
+ },
1160
+ request_options=request_options,
1161
+ omit=OMIT,
1162
+ )
1163
+ try:
1164
+ if 200 <= _response.status_code < 300:
1165
+ _data = typing.cast(
1166
+ FunctionsCreateResponse,
1167
+ parse_obj_as(
1168
+ type_=FunctionsCreateResponse, # type: ignore
1169
+ object_=_response.json(),
1170
+ ),
1171
+ )
1172
+ return AsyncHttpResponse(response=_response, data=_data)
1173
+ if _response.status_code == 400:
1174
+ raise BadRequestError(
1175
+ headers=dict(_response.headers),
1176
+ body=typing.cast(
1177
+ typing.Optional[typing.Any],
1178
+ parse_obj_as(
1179
+ type_=typing.Optional[typing.Any], # type: ignore
1180
+ object_=_response.json(),
1181
+ ),
1182
+ ),
1183
+ )
1184
+ if _response.status_code == 401:
1185
+ raise UnauthorizedError(
1186
+ headers=dict(_response.headers),
1187
+ body=typing.cast(
1188
+ UnauthorizedErrorBody,
1189
+ parse_obj_as(
1190
+ type_=UnauthorizedErrorBody, # type: ignore
1191
+ object_=_response.json(),
1192
+ ),
1193
+ ),
1194
+ )
1195
+ if _response.status_code == 403:
1196
+ raise ForbiddenError(
1197
+ headers=dict(_response.headers),
1198
+ body=typing.cast(
1199
+ PermissionDeniedError,
1200
+ parse_obj_as(
1201
+ type_=PermissionDeniedError, # type: ignore
1202
+ object_=_response.json(),
1203
+ ),
1204
+ ),
1205
+ )
1206
+ if _response.status_code == 404:
1207
+ raise NotFoundError(
1208
+ headers=dict(_response.headers),
1209
+ body=typing.cast(
1210
+ NotFoundErrorBody,
1211
+ parse_obj_as(
1212
+ type_=NotFoundErrorBody, # type: ignore
1213
+ object_=_response.json(),
1214
+ ),
1215
+ ),
1216
+ )
1217
+ if _response.status_code == 409:
1218
+ raise ConflictError(
1219
+ headers=dict(_response.headers),
1220
+ body=typing.cast(
1221
+ typing.Optional[typing.Any],
1222
+ parse_obj_as(
1223
+ type_=typing.Optional[typing.Any], # type: ignore
1224
+ object_=_response.json(),
1225
+ ),
1226
+ ),
1227
+ )
1228
+ if _response.status_code == 429:
1229
+ raise TooManyRequestsError(
1230
+ headers=dict(_response.headers),
1231
+ body=typing.cast(
1232
+ RateLimitError,
1233
+ parse_obj_as(
1234
+ type_=RateLimitError, # type: ignore
1235
+ object_=_response.json(),
1236
+ ),
1237
+ ),
1238
+ )
1239
+ if _response.status_code == 500:
1240
+ raise InternalServerError(
1241
+ headers=dict(_response.headers),
1242
+ body=typing.cast(
1243
+ typing.Optional[typing.Any],
1244
+ parse_obj_as(
1245
+ type_=typing.Optional[typing.Any], # type: ignore
1246
+ object_=_response.json(),
1247
+ ),
1248
+ ),
1249
+ )
1250
+ if _response.status_code == 503:
1251
+ raise ServiceUnavailableError(
1252
+ headers=dict(_response.headers),
1253
+ body=typing.cast(
1254
+ typing.Optional[typing.Any],
1255
+ parse_obj_as(
1256
+ type_=typing.Optional[typing.Any], # type: ignore
1257
+ object_=_response.json(),
1258
+ ),
1259
+ ),
1260
+ )
1261
+ _response_json = _response.json()
1262
+ except JSONDecodeError:
1263
+ raise ApiError(
1264
+ status_code=_response.status_code,
1265
+ headers=dict(_response.headers),
1266
+ body=_response.text,
1267
+ )
1268
+ raise ApiError(
1269
+ status_code=_response.status_code,
1270
+ headers=dict(_response.headers),
1271
+ body=_response_json,
1272
+ )
1273
+
1274
+ async def get(
1275
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1276
+ ) -> AsyncHttpResponse[FunctionsGetResponse]:
1277
+ """
1278
+ Parameters
1279
+ ----------
1280
+ id : str
1281
+
1282
+ request_options : typing.Optional[RequestOptions]
1283
+ Request-specific configuration.
1284
+
1285
+ Returns
1286
+ -------
1287
+ AsyncHttpResponse[FunctionsGetResponse]
1288
+ Success
1289
+ """
1290
+ _response = await self._client_wrapper.httpx_client.request(
1291
+ f"functions/{jsonable_encoder(id)}",
1292
+ method="GET",
1293
+ request_options=request_options,
1294
+ )
1295
+ try:
1296
+ if 200 <= _response.status_code < 300:
1297
+ _data = typing.cast(
1298
+ FunctionsGetResponse,
1299
+ parse_obj_as(
1300
+ type_=FunctionsGetResponse, # type: ignore
1301
+ object_=_response.json(),
1302
+ ),
1303
+ )
1304
+ return AsyncHttpResponse(response=_response, data=_data)
1305
+ if _response.status_code == 400:
1306
+ raise BadRequestError(
1307
+ headers=dict(_response.headers),
1308
+ body=typing.cast(
1309
+ typing.Optional[typing.Any],
1310
+ parse_obj_as(
1311
+ type_=typing.Optional[typing.Any], # type: ignore
1312
+ object_=_response.json(),
1313
+ ),
1314
+ ),
1315
+ )
1316
+ if _response.status_code == 401:
1317
+ raise UnauthorizedError(
1318
+ headers=dict(_response.headers),
1319
+ body=typing.cast(
1320
+ UnauthorizedErrorBody,
1321
+ parse_obj_as(
1322
+ type_=UnauthorizedErrorBody, # type: ignore
1323
+ object_=_response.json(),
1324
+ ),
1325
+ ),
1326
+ )
1327
+ if _response.status_code == 403:
1328
+ raise ForbiddenError(
1329
+ headers=dict(_response.headers),
1330
+ body=typing.cast(
1331
+ PermissionDeniedError,
1332
+ parse_obj_as(
1333
+ type_=PermissionDeniedError, # type: ignore
1334
+ object_=_response.json(),
1335
+ ),
1336
+ ),
1337
+ )
1338
+ if _response.status_code == 404:
1339
+ raise NotFoundError(
1340
+ headers=dict(_response.headers),
1341
+ body=typing.cast(
1342
+ NotFoundErrorBody,
1343
+ parse_obj_as(
1344
+ type_=NotFoundErrorBody, # type: ignore
1345
+ object_=_response.json(),
1346
+ ),
1347
+ ),
1348
+ )
1349
+ if _response.status_code == 429:
1350
+ raise TooManyRequestsError(
1351
+ headers=dict(_response.headers),
1352
+ body=typing.cast(
1353
+ RateLimitError,
1354
+ parse_obj_as(
1355
+ type_=RateLimitError, # type: ignore
1356
+ object_=_response.json(),
1357
+ ),
1358
+ ),
1359
+ )
1360
+ if _response.status_code == 500:
1361
+ raise InternalServerError(
1362
+ headers=dict(_response.headers),
1363
+ body=typing.cast(
1364
+ typing.Optional[typing.Any],
1365
+ parse_obj_as(
1366
+ type_=typing.Optional[typing.Any], # type: ignore
1367
+ object_=_response.json(),
1368
+ ),
1369
+ ),
1370
+ )
1371
+ if _response.status_code == 503:
1372
+ raise ServiceUnavailableError(
1373
+ headers=dict(_response.headers),
1374
+ body=typing.cast(
1375
+ typing.Optional[typing.Any],
1376
+ parse_obj_as(
1377
+ type_=typing.Optional[typing.Any], # type: ignore
1378
+ object_=_response.json(),
1379
+ ),
1380
+ ),
1381
+ )
1382
+ _response_json = _response.json()
1383
+ except JSONDecodeError:
1384
+ raise ApiError(
1385
+ status_code=_response.status_code,
1386
+ headers=dict(_response.headers),
1387
+ body=_response.text,
1388
+ )
1389
+ raise ApiError(
1390
+ status_code=_response.status_code,
1391
+ headers=dict(_response.headers),
1392
+ body=_response_json,
1393
+ )
1394
+
1395
+ async def delete(
1396
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1397
+ ) -> AsyncHttpResponse[None]:
880
1398
  """
881
1399
  Parameters
882
1400
  ----------
@@ -901,9 +1419,9 @@ class AsyncRawFunctionsClient:
901
1419
  raise BadRequestError(
902
1420
  headers=dict(_response.headers),
903
1421
  body=typing.cast(
904
- HttpApiDecodeError,
1422
+ typing.Optional[typing.Any],
905
1423
  parse_obj_as(
906
- type_=HttpApiDecodeError, # type: ignore
1424
+ type_=typing.Optional[typing.Any], # type: ignore
907
1425
  object_=_response.json(),
908
1426
  ),
909
1427
  ),
@@ -941,6 +1459,17 @@ class AsyncRawFunctionsClient:
941
1459
  ),
942
1460
  ),
943
1461
  )
1462
+ if _response.status_code == 429:
1463
+ raise TooManyRequestsError(
1464
+ headers=dict(_response.headers),
1465
+ body=typing.cast(
1466
+ RateLimitError,
1467
+ parse_obj_as(
1468
+ type_=RateLimitError, # type: ignore
1469
+ object_=_response.json(),
1470
+ ),
1471
+ ),
1472
+ )
944
1473
  if _response.status_code == 500:
945
1474
  raise InternalServerError(
946
1475
  headers=dict(_response.headers),
@@ -952,10 +1481,29 @@ class AsyncRawFunctionsClient:
952
1481
  ),
953
1482
  ),
954
1483
  )
1484
+ if _response.status_code == 503:
1485
+ raise ServiceUnavailableError(
1486
+ headers=dict(_response.headers),
1487
+ body=typing.cast(
1488
+ typing.Optional[typing.Any],
1489
+ parse_obj_as(
1490
+ type_=typing.Optional[typing.Any], # type: ignore
1491
+ object_=_response.json(),
1492
+ ),
1493
+ ),
1494
+ )
955
1495
  _response_json = _response.json()
956
1496
  except JSONDecodeError:
957
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
958
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1497
+ raise ApiError(
1498
+ status_code=_response.status_code,
1499
+ headers=dict(_response.headers),
1500
+ body=_response.text,
1501
+ )
1502
+ raise ApiError(
1503
+ status_code=_response.status_code,
1504
+ headers=dict(_response.headers),
1505
+ body=_response_json,
1506
+ )
959
1507
 
960
1508
  async def findbyhash(
961
1509
  self, hash: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -992,9 +1540,272 @@ class AsyncRawFunctionsClient:
992
1540
  raise BadRequestError(
993
1541
  headers=dict(_response.headers),
994
1542
  body=typing.cast(
995
- HttpApiDecodeError,
1543
+ typing.Optional[typing.Any],
1544
+ parse_obj_as(
1545
+ type_=typing.Optional[typing.Any], # type: ignore
1546
+ object_=_response.json(),
1547
+ ),
1548
+ ),
1549
+ )
1550
+ if _response.status_code == 401:
1551
+ raise UnauthorizedError(
1552
+ headers=dict(_response.headers),
1553
+ body=typing.cast(
1554
+ UnauthorizedErrorBody,
1555
+ parse_obj_as(
1556
+ type_=UnauthorizedErrorBody, # type: ignore
1557
+ object_=_response.json(),
1558
+ ),
1559
+ ),
1560
+ )
1561
+ if _response.status_code == 403:
1562
+ raise ForbiddenError(
1563
+ headers=dict(_response.headers),
1564
+ body=typing.cast(
1565
+ PermissionDeniedError,
1566
+ parse_obj_as(
1567
+ type_=PermissionDeniedError, # type: ignore
1568
+ object_=_response.json(),
1569
+ ),
1570
+ ),
1571
+ )
1572
+ if _response.status_code == 404:
1573
+ raise NotFoundError(
1574
+ headers=dict(_response.headers),
1575
+ body=typing.cast(
1576
+ NotFoundErrorBody,
1577
+ parse_obj_as(
1578
+ type_=NotFoundErrorBody, # type: ignore
1579
+ object_=_response.json(),
1580
+ ),
1581
+ ),
1582
+ )
1583
+ if _response.status_code == 429:
1584
+ raise TooManyRequestsError(
1585
+ headers=dict(_response.headers),
1586
+ body=typing.cast(
1587
+ RateLimitError,
1588
+ parse_obj_as(
1589
+ type_=RateLimitError, # type: ignore
1590
+ object_=_response.json(),
1591
+ ),
1592
+ ),
1593
+ )
1594
+ if _response.status_code == 500:
1595
+ raise InternalServerError(
1596
+ headers=dict(_response.headers),
1597
+ body=typing.cast(
1598
+ typing.Optional[typing.Any],
1599
+ parse_obj_as(
1600
+ type_=typing.Optional[typing.Any], # type: ignore
1601
+ object_=_response.json(),
1602
+ ),
1603
+ ),
1604
+ )
1605
+ if _response.status_code == 503:
1606
+ raise ServiceUnavailableError(
1607
+ headers=dict(_response.headers),
1608
+ body=typing.cast(
1609
+ typing.Optional[typing.Any],
1610
+ parse_obj_as(
1611
+ type_=typing.Optional[typing.Any], # type: ignore
1612
+ object_=_response.json(),
1613
+ ),
1614
+ ),
1615
+ )
1616
+ _response_json = _response.json()
1617
+ except JSONDecodeError:
1618
+ raise ApiError(
1619
+ status_code=_response.status_code,
1620
+ headers=dict(_response.headers),
1621
+ body=_response.text,
1622
+ )
1623
+ raise ApiError(
1624
+ status_code=_response.status_code,
1625
+ headers=dict(_response.headers),
1626
+ body=_response_json,
1627
+ )
1628
+
1629
+ async def getbyenv(
1630
+ self,
1631
+ organization_id: str,
1632
+ project_id: str,
1633
+ environment_id: str,
1634
+ function_id: str,
1635
+ *,
1636
+ request_options: typing.Optional[RequestOptions] = None,
1637
+ ) -> AsyncHttpResponse[FunctionsGetByEnvResponse]:
1638
+ """
1639
+ Parameters
1640
+ ----------
1641
+ organization_id : str
1642
+
1643
+ project_id : str
1644
+
1645
+ environment_id : str
1646
+
1647
+ function_id : str
1648
+
1649
+ request_options : typing.Optional[RequestOptions]
1650
+ Request-specific configuration.
1651
+
1652
+ Returns
1653
+ -------
1654
+ AsyncHttpResponse[FunctionsGetByEnvResponse]
1655
+ Success
1656
+ """
1657
+ _response = await self._client_wrapper.httpx_client.request(
1658
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/functions/{jsonable_encoder(function_id)}",
1659
+ method="GET",
1660
+ request_options=request_options,
1661
+ )
1662
+ try:
1663
+ if 200 <= _response.status_code < 300:
1664
+ _data = typing.cast(
1665
+ FunctionsGetByEnvResponse,
1666
+ parse_obj_as(
1667
+ type_=FunctionsGetByEnvResponse, # type: ignore
1668
+ object_=_response.json(),
1669
+ ),
1670
+ )
1671
+ return AsyncHttpResponse(response=_response, data=_data)
1672
+ if _response.status_code == 400:
1673
+ raise BadRequestError(
1674
+ headers=dict(_response.headers),
1675
+ body=typing.cast(
1676
+ typing.Optional[typing.Any],
1677
+ parse_obj_as(
1678
+ type_=typing.Optional[typing.Any], # type: ignore
1679
+ object_=_response.json(),
1680
+ ),
1681
+ ),
1682
+ )
1683
+ if _response.status_code == 401:
1684
+ raise UnauthorizedError(
1685
+ headers=dict(_response.headers),
1686
+ body=typing.cast(
1687
+ UnauthorizedErrorBody,
1688
+ parse_obj_as(
1689
+ type_=UnauthorizedErrorBody, # type: ignore
1690
+ object_=_response.json(),
1691
+ ),
1692
+ ),
1693
+ )
1694
+ if _response.status_code == 403:
1695
+ raise ForbiddenError(
1696
+ headers=dict(_response.headers),
1697
+ body=typing.cast(
1698
+ PermissionDeniedError,
1699
+ parse_obj_as(
1700
+ type_=PermissionDeniedError, # type: ignore
1701
+ object_=_response.json(),
1702
+ ),
1703
+ ),
1704
+ )
1705
+ if _response.status_code == 404:
1706
+ raise NotFoundError(
1707
+ headers=dict(_response.headers),
1708
+ body=typing.cast(
1709
+ NotFoundErrorBody,
1710
+ parse_obj_as(
1711
+ type_=NotFoundErrorBody, # type: ignore
1712
+ object_=_response.json(),
1713
+ ),
1714
+ ),
1715
+ )
1716
+ if _response.status_code == 429:
1717
+ raise TooManyRequestsError(
1718
+ headers=dict(_response.headers),
1719
+ body=typing.cast(
1720
+ RateLimitError,
1721
+ parse_obj_as(
1722
+ type_=RateLimitError, # type: ignore
1723
+ object_=_response.json(),
1724
+ ),
1725
+ ),
1726
+ )
1727
+ if _response.status_code == 500:
1728
+ raise InternalServerError(
1729
+ headers=dict(_response.headers),
1730
+ body=typing.cast(
1731
+ typing.Optional[typing.Any],
1732
+ parse_obj_as(
1733
+ type_=typing.Optional[typing.Any], # type: ignore
1734
+ object_=_response.json(),
1735
+ ),
1736
+ ),
1737
+ )
1738
+ if _response.status_code == 503:
1739
+ raise ServiceUnavailableError(
1740
+ headers=dict(_response.headers),
1741
+ body=typing.cast(
1742
+ typing.Optional[typing.Any],
1743
+ parse_obj_as(
1744
+ type_=typing.Optional[typing.Any], # type: ignore
1745
+ object_=_response.json(),
1746
+ ),
1747
+ ),
1748
+ )
1749
+ _response_json = _response.json()
1750
+ except JSONDecodeError:
1751
+ raise ApiError(
1752
+ status_code=_response.status_code,
1753
+ headers=dict(_response.headers),
1754
+ body=_response.text,
1755
+ )
1756
+ raise ApiError(
1757
+ status_code=_response.status_code,
1758
+ headers=dict(_response.headers),
1759
+ body=_response_json,
1760
+ )
1761
+
1762
+ async def listbyenv(
1763
+ self,
1764
+ organization_id: str,
1765
+ project_id: str,
1766
+ environment_id: str,
1767
+ *,
1768
+ request_options: typing.Optional[RequestOptions] = None,
1769
+ ) -> AsyncHttpResponse[FunctionsListByEnvResponse]:
1770
+ """
1771
+ Parameters
1772
+ ----------
1773
+ organization_id : str
1774
+
1775
+ project_id : str
1776
+
1777
+ environment_id : str
1778
+
1779
+ request_options : typing.Optional[RequestOptions]
1780
+ Request-specific configuration.
1781
+
1782
+ Returns
1783
+ -------
1784
+ AsyncHttpResponse[FunctionsListByEnvResponse]
1785
+ Success
1786
+ """
1787
+ _response = await self._client_wrapper.httpx_client.request(
1788
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/functions",
1789
+ method="GET",
1790
+ request_options=request_options,
1791
+ )
1792
+ try:
1793
+ if 200 <= _response.status_code < 300:
1794
+ _data = typing.cast(
1795
+ FunctionsListByEnvResponse,
1796
+ parse_obj_as(
1797
+ type_=FunctionsListByEnvResponse, # type: ignore
1798
+ object_=_response.json(),
1799
+ ),
1800
+ )
1801
+ return AsyncHttpResponse(response=_response, data=_data)
1802
+ if _response.status_code == 400:
1803
+ raise BadRequestError(
1804
+ headers=dict(_response.headers),
1805
+ body=typing.cast(
1806
+ typing.Optional[typing.Any],
996
1807
  parse_obj_as(
997
- type_=HttpApiDecodeError, # type: ignore
1808
+ type_=typing.Optional[typing.Any], # type: ignore
998
1809
  object_=_response.json(),
999
1810
  ),
1000
1811
  ),
@@ -1032,6 +1843,17 @@ class AsyncRawFunctionsClient:
1032
1843
  ),
1033
1844
  ),
1034
1845
  )
1846
+ if _response.status_code == 429:
1847
+ raise TooManyRequestsError(
1848
+ headers=dict(_response.headers),
1849
+ body=typing.cast(
1850
+ RateLimitError,
1851
+ parse_obj_as(
1852
+ type_=RateLimitError, # type: ignore
1853
+ object_=_response.json(),
1854
+ ),
1855
+ ),
1856
+ )
1035
1857
  if _response.status_code == 500:
1036
1858
  raise InternalServerError(
1037
1859
  headers=dict(_response.headers),
@@ -1043,7 +1865,26 @@ class AsyncRawFunctionsClient:
1043
1865
  ),
1044
1866
  ),
1045
1867
  )
1868
+ if _response.status_code == 503:
1869
+ raise ServiceUnavailableError(
1870
+ headers=dict(_response.headers),
1871
+ body=typing.cast(
1872
+ typing.Optional[typing.Any],
1873
+ parse_obj_as(
1874
+ type_=typing.Optional[typing.Any], # type: ignore
1875
+ object_=_response.json(),
1876
+ ),
1877
+ ),
1878
+ )
1046
1879
  _response_json = _response.json()
1047
1880
  except JSONDecodeError:
1048
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1049
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1881
+ raise ApiError(
1882
+ status_code=_response.status_code,
1883
+ headers=dict(_response.headers),
1884
+ body=_response.text,
1885
+ )
1886
+ raise ApiError(
1887
+ status_code=_response.status_code,
1888
+ headers=dict(_response.headers),
1889
+ body=_response_json,
1890
+ )