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
@@ -14,11 +14,13 @@ from ..errors.conflict_error import ConflictError
14
14
  from ..errors.forbidden_error import ForbiddenError
15
15
  from ..errors.internal_server_error import InternalServerError
16
16
  from ..errors.not_found_error import NotFoundError
17
- from ..types.already_exists_error import AlreadyExistsError
18
- from ..types.http_api_decode_error import HttpApiDecodeError
17
+ from ..errors.service_unavailable_error import ServiceUnavailableError
18
+ from ..errors.too_many_requests_error import TooManyRequestsError
19
19
  from ..types.not_found_error_body import NotFoundErrorBody
20
20
  from ..types.permission_denied_error import PermissionDeniedError
21
+ from ..types.rate_limit_error import RateLimitError
21
22
  from .types.environments_create_response import EnvironmentsCreateResponse
23
+ from .types.environments_get_analytics_response import EnvironmentsGetAnalyticsResponse
22
24
  from .types.environments_get_response import EnvironmentsGetResponse
23
25
  from .types.environments_list_response_item import EnvironmentsListResponseItem
24
26
  from .types.environments_update_response import EnvironmentsUpdateResponse
@@ -32,7 +34,11 @@ class RawEnvironmentsClient:
32
34
  self._client_wrapper = client_wrapper
33
35
 
34
36
  def list(
35
- self, organization_id: str, project_id: str, *, request_options: typing.Optional[RequestOptions] = None
37
+ self,
38
+ organization_id: str,
39
+ project_id: str,
40
+ *,
41
+ request_options: typing.Optional[RequestOptions] = None,
36
42
  ) -> HttpResponse[typing.List[EnvironmentsListResponseItem]]:
37
43
  """
38
44
  Parameters
@@ -68,9 +74,9 @@ class RawEnvironmentsClient:
68
74
  raise BadRequestError(
69
75
  headers=dict(_response.headers),
70
76
  body=typing.cast(
71
- HttpApiDecodeError,
77
+ typing.Optional[typing.Any],
72
78
  parse_obj_as(
73
- type_=HttpApiDecodeError, # type: ignore
79
+ type_=typing.Optional[typing.Any], # type: ignore
74
80
  object_=_response.json(),
75
81
  ),
76
82
  ),
@@ -97,6 +103,17 @@ class RawEnvironmentsClient:
97
103
  ),
98
104
  ),
99
105
  )
106
+ if _response.status_code == 429:
107
+ raise TooManyRequestsError(
108
+ headers=dict(_response.headers),
109
+ body=typing.cast(
110
+ RateLimitError,
111
+ parse_obj_as(
112
+ type_=RateLimitError, # type: ignore
113
+ object_=_response.json(),
114
+ ),
115
+ ),
116
+ )
100
117
  if _response.status_code == 500:
101
118
  raise InternalServerError(
102
119
  headers=dict(_response.headers),
@@ -108,10 +125,29 @@ class RawEnvironmentsClient:
108
125
  ),
109
126
  ),
110
127
  )
128
+ if _response.status_code == 503:
129
+ raise ServiceUnavailableError(
130
+ headers=dict(_response.headers),
131
+ body=typing.cast(
132
+ typing.Optional[typing.Any],
133
+ parse_obj_as(
134
+ type_=typing.Optional[typing.Any], # type: ignore
135
+ object_=_response.json(),
136
+ ),
137
+ ),
138
+ )
111
139
  _response_json = _response.json()
112
140
  except JSONDecodeError:
113
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
114
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
141
+ raise ApiError(
142
+ status_code=_response.status_code,
143
+ headers=dict(_response.headers),
144
+ body=_response.text,
145
+ )
146
+ raise ApiError(
147
+ status_code=_response.status_code,
148
+ headers=dict(_response.headers),
149
+ body=_response_json,
150
+ )
115
151
 
116
152
  def create(
117
153
  self,
@@ -170,9 +206,9 @@ class RawEnvironmentsClient:
170
206
  raise BadRequestError(
171
207
  headers=dict(_response.headers),
172
208
  body=typing.cast(
173
- HttpApiDecodeError,
209
+ typing.Optional[typing.Any],
174
210
  parse_obj_as(
175
- type_=HttpApiDecodeError, # type: ignore
211
+ type_=typing.Optional[typing.Any], # type: ignore
176
212
  object_=_response.json(),
177
213
  ),
178
214
  ),
@@ -203,9 +239,20 @@ class RawEnvironmentsClient:
203
239
  raise ConflictError(
204
240
  headers=dict(_response.headers),
205
241
  body=typing.cast(
206
- AlreadyExistsError,
242
+ typing.Optional[typing.Any],
207
243
  parse_obj_as(
208
- type_=AlreadyExistsError, # type: ignore
244
+ type_=typing.Optional[typing.Any], # type: ignore
245
+ object_=_response.json(),
246
+ ),
247
+ ),
248
+ )
249
+ if _response.status_code == 429:
250
+ raise TooManyRequestsError(
251
+ headers=dict(_response.headers),
252
+ body=typing.cast(
253
+ RateLimitError,
254
+ parse_obj_as(
255
+ type_=RateLimitError, # type: ignore
209
256
  object_=_response.json(),
210
257
  ),
211
258
  ),
@@ -221,10 +268,29 @@ class RawEnvironmentsClient:
221
268
  ),
222
269
  ),
223
270
  )
271
+ if _response.status_code == 503:
272
+ raise ServiceUnavailableError(
273
+ headers=dict(_response.headers),
274
+ body=typing.cast(
275
+ typing.Optional[typing.Any],
276
+ parse_obj_as(
277
+ type_=typing.Optional[typing.Any], # type: ignore
278
+ object_=_response.json(),
279
+ ),
280
+ ),
281
+ )
224
282
  _response_json = _response.json()
225
283
  except JSONDecodeError:
226
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
227
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
284
+ raise ApiError(
285
+ status_code=_response.status_code,
286
+ headers=dict(_response.headers),
287
+ body=_response.text,
288
+ )
289
+ raise ApiError(
290
+ status_code=_response.status_code,
291
+ headers=dict(_response.headers),
292
+ body=_response_json,
293
+ )
228
294
 
229
295
  def get(
230
296
  self,
@@ -270,9 +336,9 @@ class RawEnvironmentsClient:
270
336
  raise BadRequestError(
271
337
  headers=dict(_response.headers),
272
338
  body=typing.cast(
273
- HttpApiDecodeError,
339
+ typing.Optional[typing.Any],
274
340
  parse_obj_as(
275
- type_=HttpApiDecodeError, # type: ignore
341
+ type_=typing.Optional[typing.Any], # type: ignore
276
342
  object_=_response.json(),
277
343
  ),
278
344
  ),
@@ -299,6 +365,17 @@ class RawEnvironmentsClient:
299
365
  ),
300
366
  ),
301
367
  )
368
+ if _response.status_code == 429:
369
+ raise TooManyRequestsError(
370
+ headers=dict(_response.headers),
371
+ body=typing.cast(
372
+ RateLimitError,
373
+ parse_obj_as(
374
+ type_=RateLimitError, # type: ignore
375
+ object_=_response.json(),
376
+ ),
377
+ ),
378
+ )
302
379
  if _response.status_code == 500:
303
380
  raise InternalServerError(
304
381
  headers=dict(_response.headers),
@@ -310,10 +387,29 @@ class RawEnvironmentsClient:
310
387
  ),
311
388
  ),
312
389
  )
390
+ if _response.status_code == 503:
391
+ raise ServiceUnavailableError(
392
+ headers=dict(_response.headers),
393
+ body=typing.cast(
394
+ typing.Optional[typing.Any],
395
+ parse_obj_as(
396
+ type_=typing.Optional[typing.Any], # type: ignore
397
+ object_=_response.json(),
398
+ ),
399
+ ),
400
+ )
313
401
  _response_json = _response.json()
314
402
  except JSONDecodeError:
315
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
316
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
403
+ raise ApiError(
404
+ status_code=_response.status_code,
405
+ headers=dict(_response.headers),
406
+ body=_response.text,
407
+ )
408
+ raise ApiError(
409
+ status_code=_response.status_code,
410
+ headers=dict(_response.headers),
411
+ body=_response_json,
412
+ )
317
413
 
318
414
  def update(
319
415
  self,
@@ -375,9 +471,9 @@ class RawEnvironmentsClient:
375
471
  raise BadRequestError(
376
472
  headers=dict(_response.headers),
377
473
  body=typing.cast(
378
- HttpApiDecodeError,
474
+ typing.Optional[typing.Any],
379
475
  parse_obj_as(
380
- type_=HttpApiDecodeError, # type: ignore
476
+ type_=typing.Optional[typing.Any], # type: ignore
381
477
  object_=_response.json(),
382
478
  ),
383
479
  ),
@@ -408,9 +504,20 @@ class RawEnvironmentsClient:
408
504
  raise ConflictError(
409
505
  headers=dict(_response.headers),
410
506
  body=typing.cast(
411
- AlreadyExistsError,
507
+ typing.Optional[typing.Any],
412
508
  parse_obj_as(
413
- type_=AlreadyExistsError, # type: ignore
509
+ type_=typing.Optional[typing.Any], # type: ignore
510
+ object_=_response.json(),
511
+ ),
512
+ ),
513
+ )
514
+ if _response.status_code == 429:
515
+ raise TooManyRequestsError(
516
+ headers=dict(_response.headers),
517
+ body=typing.cast(
518
+ RateLimitError,
519
+ parse_obj_as(
520
+ type_=RateLimitError, # type: ignore
414
521
  object_=_response.json(),
415
522
  ),
416
523
  ),
@@ -426,10 +533,29 @@ class RawEnvironmentsClient:
426
533
  ),
427
534
  ),
428
535
  )
536
+ if _response.status_code == 503:
537
+ raise ServiceUnavailableError(
538
+ headers=dict(_response.headers),
539
+ body=typing.cast(
540
+ typing.Optional[typing.Any],
541
+ parse_obj_as(
542
+ type_=typing.Optional[typing.Any], # type: ignore
543
+ object_=_response.json(),
544
+ ),
545
+ ),
546
+ )
429
547
  _response_json = _response.json()
430
548
  except JSONDecodeError:
431
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
432
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
549
+ raise ApiError(
550
+ status_code=_response.status_code,
551
+ headers=dict(_response.headers),
552
+ body=_response.text,
553
+ )
554
+ raise ApiError(
555
+ status_code=_response.status_code,
556
+ headers=dict(_response.headers),
557
+ body=_response_json,
558
+ )
433
559
 
434
560
  def delete(
435
561
  self,
@@ -467,9 +593,9 @@ class RawEnvironmentsClient:
467
593
  raise BadRequestError(
468
594
  headers=dict(_response.headers),
469
595
  body=typing.cast(
470
- HttpApiDecodeError,
596
+ typing.Optional[typing.Any],
471
597
  parse_obj_as(
472
- type_=HttpApiDecodeError, # type: ignore
598
+ type_=typing.Optional[typing.Any], # type: ignore
473
599
  object_=_response.json(),
474
600
  ),
475
601
  ),
@@ -496,6 +622,17 @@ class RawEnvironmentsClient:
496
622
  ),
497
623
  ),
498
624
  )
625
+ if _response.status_code == 429:
626
+ raise TooManyRequestsError(
627
+ headers=dict(_response.headers),
628
+ body=typing.cast(
629
+ RateLimitError,
630
+ parse_obj_as(
631
+ type_=RateLimitError, # type: ignore
632
+ object_=_response.json(),
633
+ ),
634
+ ),
635
+ )
499
636
  if _response.status_code == 500:
500
637
  raise InternalServerError(
501
638
  headers=dict(_response.headers),
@@ -507,10 +644,158 @@ class RawEnvironmentsClient:
507
644
  ),
508
645
  ),
509
646
  )
647
+ if _response.status_code == 503:
648
+ raise ServiceUnavailableError(
649
+ headers=dict(_response.headers),
650
+ body=typing.cast(
651
+ typing.Optional[typing.Any],
652
+ parse_obj_as(
653
+ type_=typing.Optional[typing.Any], # type: ignore
654
+ object_=_response.json(),
655
+ ),
656
+ ),
657
+ )
510
658
  _response_json = _response.json()
511
659
  except JSONDecodeError:
512
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
513
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
660
+ raise ApiError(
661
+ status_code=_response.status_code,
662
+ headers=dict(_response.headers),
663
+ body=_response.text,
664
+ )
665
+ raise ApiError(
666
+ status_code=_response.status_code,
667
+ headers=dict(_response.headers),
668
+ body=_response_json,
669
+ )
670
+
671
+ def getanalytics(
672
+ self,
673
+ organization_id: str,
674
+ project_id: str,
675
+ environment_id: str,
676
+ *,
677
+ start_time: str,
678
+ end_time: str,
679
+ request_options: typing.Optional[RequestOptions] = None,
680
+ ) -> HttpResponse[EnvironmentsGetAnalyticsResponse]:
681
+ """
682
+ Parameters
683
+ ----------
684
+ organization_id : str
685
+
686
+ project_id : str
687
+
688
+ environment_id : str
689
+
690
+ start_time : str
691
+
692
+ end_time : str
693
+
694
+ request_options : typing.Optional[RequestOptions]
695
+ Request-specific configuration.
696
+
697
+ Returns
698
+ -------
699
+ HttpResponse[EnvironmentsGetAnalyticsResponse]
700
+ Success
701
+ """
702
+ _response = self._client_wrapper.httpx_client.request(
703
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/analytics",
704
+ method="GET",
705
+ params={
706
+ "startTime": start_time,
707
+ "endTime": end_time,
708
+ },
709
+ request_options=request_options,
710
+ )
711
+ try:
712
+ if 200 <= _response.status_code < 300:
713
+ _data = typing.cast(
714
+ EnvironmentsGetAnalyticsResponse,
715
+ parse_obj_as(
716
+ type_=EnvironmentsGetAnalyticsResponse, # type: ignore
717
+ object_=_response.json(),
718
+ ),
719
+ )
720
+ return HttpResponse(response=_response, data=_data)
721
+ if _response.status_code == 400:
722
+ raise BadRequestError(
723
+ headers=dict(_response.headers),
724
+ body=typing.cast(
725
+ typing.Optional[typing.Any],
726
+ parse_obj_as(
727
+ type_=typing.Optional[typing.Any], # type: ignore
728
+ object_=_response.json(),
729
+ ),
730
+ ),
731
+ )
732
+ if _response.status_code == 403:
733
+ raise ForbiddenError(
734
+ headers=dict(_response.headers),
735
+ body=typing.cast(
736
+ PermissionDeniedError,
737
+ parse_obj_as(
738
+ type_=PermissionDeniedError, # type: ignore
739
+ object_=_response.json(),
740
+ ),
741
+ ),
742
+ )
743
+ if _response.status_code == 404:
744
+ raise NotFoundError(
745
+ headers=dict(_response.headers),
746
+ body=typing.cast(
747
+ NotFoundErrorBody,
748
+ parse_obj_as(
749
+ type_=NotFoundErrorBody, # type: ignore
750
+ object_=_response.json(),
751
+ ),
752
+ ),
753
+ )
754
+ if _response.status_code == 429:
755
+ raise TooManyRequestsError(
756
+ headers=dict(_response.headers),
757
+ body=typing.cast(
758
+ RateLimitError,
759
+ parse_obj_as(
760
+ type_=RateLimitError, # type: ignore
761
+ object_=_response.json(),
762
+ ),
763
+ ),
764
+ )
765
+ if _response.status_code == 500:
766
+ raise InternalServerError(
767
+ headers=dict(_response.headers),
768
+ body=typing.cast(
769
+ typing.Optional[typing.Any],
770
+ parse_obj_as(
771
+ type_=typing.Optional[typing.Any], # type: ignore
772
+ object_=_response.json(),
773
+ ),
774
+ ),
775
+ )
776
+ if _response.status_code == 503:
777
+ raise ServiceUnavailableError(
778
+ headers=dict(_response.headers),
779
+ body=typing.cast(
780
+ typing.Optional[typing.Any],
781
+ parse_obj_as(
782
+ type_=typing.Optional[typing.Any], # type: ignore
783
+ object_=_response.json(),
784
+ ),
785
+ ),
786
+ )
787
+ _response_json = _response.json()
788
+ except JSONDecodeError:
789
+ raise ApiError(
790
+ status_code=_response.status_code,
791
+ headers=dict(_response.headers),
792
+ body=_response.text,
793
+ )
794
+ raise ApiError(
795
+ status_code=_response.status_code,
796
+ headers=dict(_response.headers),
797
+ body=_response_json,
798
+ )
514
799
 
515
800
 
516
801
  class AsyncRawEnvironmentsClient:
@@ -518,7 +803,11 @@ class AsyncRawEnvironmentsClient:
518
803
  self._client_wrapper = client_wrapper
519
804
 
520
805
  async def list(
521
- self, organization_id: str, project_id: str, *, request_options: typing.Optional[RequestOptions] = None
806
+ self,
807
+ organization_id: str,
808
+ project_id: str,
809
+ *,
810
+ request_options: typing.Optional[RequestOptions] = None,
522
811
  ) -> AsyncHttpResponse[typing.List[EnvironmentsListResponseItem]]:
523
812
  """
524
813
  Parameters
@@ -554,9 +843,9 @@ class AsyncRawEnvironmentsClient:
554
843
  raise BadRequestError(
555
844
  headers=dict(_response.headers),
556
845
  body=typing.cast(
557
- HttpApiDecodeError,
846
+ typing.Optional[typing.Any],
558
847
  parse_obj_as(
559
- type_=HttpApiDecodeError, # type: ignore
848
+ type_=typing.Optional[typing.Any], # type: ignore
560
849
  object_=_response.json(),
561
850
  ),
562
851
  ),
@@ -583,6 +872,17 @@ class AsyncRawEnvironmentsClient:
583
872
  ),
584
873
  ),
585
874
  )
875
+ if _response.status_code == 429:
876
+ raise TooManyRequestsError(
877
+ headers=dict(_response.headers),
878
+ body=typing.cast(
879
+ RateLimitError,
880
+ parse_obj_as(
881
+ type_=RateLimitError, # type: ignore
882
+ object_=_response.json(),
883
+ ),
884
+ ),
885
+ )
586
886
  if _response.status_code == 500:
587
887
  raise InternalServerError(
588
888
  headers=dict(_response.headers),
@@ -594,10 +894,29 @@ class AsyncRawEnvironmentsClient:
594
894
  ),
595
895
  ),
596
896
  )
897
+ if _response.status_code == 503:
898
+ raise ServiceUnavailableError(
899
+ headers=dict(_response.headers),
900
+ body=typing.cast(
901
+ typing.Optional[typing.Any],
902
+ parse_obj_as(
903
+ type_=typing.Optional[typing.Any], # type: ignore
904
+ object_=_response.json(),
905
+ ),
906
+ ),
907
+ )
597
908
  _response_json = _response.json()
598
909
  except JSONDecodeError:
599
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
600
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
910
+ raise ApiError(
911
+ status_code=_response.status_code,
912
+ headers=dict(_response.headers),
913
+ body=_response.text,
914
+ )
915
+ raise ApiError(
916
+ status_code=_response.status_code,
917
+ headers=dict(_response.headers),
918
+ body=_response_json,
919
+ )
601
920
 
602
921
  async def create(
603
922
  self,
@@ -656,9 +975,9 @@ class AsyncRawEnvironmentsClient:
656
975
  raise BadRequestError(
657
976
  headers=dict(_response.headers),
658
977
  body=typing.cast(
659
- HttpApiDecodeError,
978
+ typing.Optional[typing.Any],
660
979
  parse_obj_as(
661
- type_=HttpApiDecodeError, # type: ignore
980
+ type_=typing.Optional[typing.Any], # type: ignore
662
981
  object_=_response.json(),
663
982
  ),
664
983
  ),
@@ -689,9 +1008,20 @@ class AsyncRawEnvironmentsClient:
689
1008
  raise ConflictError(
690
1009
  headers=dict(_response.headers),
691
1010
  body=typing.cast(
692
- AlreadyExistsError,
1011
+ typing.Optional[typing.Any],
693
1012
  parse_obj_as(
694
- type_=AlreadyExistsError, # type: ignore
1013
+ type_=typing.Optional[typing.Any], # type: ignore
1014
+ object_=_response.json(),
1015
+ ),
1016
+ ),
1017
+ )
1018
+ if _response.status_code == 429:
1019
+ raise TooManyRequestsError(
1020
+ headers=dict(_response.headers),
1021
+ body=typing.cast(
1022
+ RateLimitError,
1023
+ parse_obj_as(
1024
+ type_=RateLimitError, # type: ignore
695
1025
  object_=_response.json(),
696
1026
  ),
697
1027
  ),
@@ -707,10 +1037,29 @@ class AsyncRawEnvironmentsClient:
707
1037
  ),
708
1038
  ),
709
1039
  )
1040
+ if _response.status_code == 503:
1041
+ raise ServiceUnavailableError(
1042
+ headers=dict(_response.headers),
1043
+ body=typing.cast(
1044
+ typing.Optional[typing.Any],
1045
+ parse_obj_as(
1046
+ type_=typing.Optional[typing.Any], # type: ignore
1047
+ object_=_response.json(),
1048
+ ),
1049
+ ),
1050
+ )
710
1051
  _response_json = _response.json()
711
1052
  except JSONDecodeError:
712
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
713
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1053
+ raise ApiError(
1054
+ status_code=_response.status_code,
1055
+ headers=dict(_response.headers),
1056
+ body=_response.text,
1057
+ )
1058
+ raise ApiError(
1059
+ status_code=_response.status_code,
1060
+ headers=dict(_response.headers),
1061
+ body=_response_json,
1062
+ )
714
1063
 
715
1064
  async def get(
716
1065
  self,
@@ -756,9 +1105,9 @@ class AsyncRawEnvironmentsClient:
756
1105
  raise BadRequestError(
757
1106
  headers=dict(_response.headers),
758
1107
  body=typing.cast(
759
- HttpApiDecodeError,
1108
+ typing.Optional[typing.Any],
760
1109
  parse_obj_as(
761
- type_=HttpApiDecodeError, # type: ignore
1110
+ type_=typing.Optional[typing.Any], # type: ignore
762
1111
  object_=_response.json(),
763
1112
  ),
764
1113
  ),
@@ -785,6 +1134,17 @@ class AsyncRawEnvironmentsClient:
785
1134
  ),
786
1135
  ),
787
1136
  )
1137
+ if _response.status_code == 429:
1138
+ raise TooManyRequestsError(
1139
+ headers=dict(_response.headers),
1140
+ body=typing.cast(
1141
+ RateLimitError,
1142
+ parse_obj_as(
1143
+ type_=RateLimitError, # type: ignore
1144
+ object_=_response.json(),
1145
+ ),
1146
+ ),
1147
+ )
788
1148
  if _response.status_code == 500:
789
1149
  raise InternalServerError(
790
1150
  headers=dict(_response.headers),
@@ -796,10 +1156,29 @@ class AsyncRawEnvironmentsClient:
796
1156
  ),
797
1157
  ),
798
1158
  )
1159
+ if _response.status_code == 503:
1160
+ raise ServiceUnavailableError(
1161
+ headers=dict(_response.headers),
1162
+ body=typing.cast(
1163
+ typing.Optional[typing.Any],
1164
+ parse_obj_as(
1165
+ type_=typing.Optional[typing.Any], # type: ignore
1166
+ object_=_response.json(),
1167
+ ),
1168
+ ),
1169
+ )
799
1170
  _response_json = _response.json()
800
1171
  except JSONDecodeError:
801
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
802
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1172
+ raise ApiError(
1173
+ status_code=_response.status_code,
1174
+ headers=dict(_response.headers),
1175
+ body=_response.text,
1176
+ )
1177
+ raise ApiError(
1178
+ status_code=_response.status_code,
1179
+ headers=dict(_response.headers),
1180
+ body=_response_json,
1181
+ )
803
1182
 
804
1183
  async def update(
805
1184
  self,
@@ -861,9 +1240,9 @@ class AsyncRawEnvironmentsClient:
861
1240
  raise BadRequestError(
862
1241
  headers=dict(_response.headers),
863
1242
  body=typing.cast(
864
- HttpApiDecodeError,
1243
+ typing.Optional[typing.Any],
865
1244
  parse_obj_as(
866
- type_=HttpApiDecodeError, # type: ignore
1245
+ type_=typing.Optional[typing.Any], # type: ignore
867
1246
  object_=_response.json(),
868
1247
  ),
869
1248
  ),
@@ -894,9 +1273,20 @@ class AsyncRawEnvironmentsClient:
894
1273
  raise ConflictError(
895
1274
  headers=dict(_response.headers),
896
1275
  body=typing.cast(
897
- AlreadyExistsError,
1276
+ typing.Optional[typing.Any],
898
1277
  parse_obj_as(
899
- type_=AlreadyExistsError, # type: ignore
1278
+ type_=typing.Optional[typing.Any], # type: ignore
1279
+ object_=_response.json(),
1280
+ ),
1281
+ ),
1282
+ )
1283
+ if _response.status_code == 429:
1284
+ raise TooManyRequestsError(
1285
+ headers=dict(_response.headers),
1286
+ body=typing.cast(
1287
+ RateLimitError,
1288
+ parse_obj_as(
1289
+ type_=RateLimitError, # type: ignore
900
1290
  object_=_response.json(),
901
1291
  ),
902
1292
  ),
@@ -912,10 +1302,29 @@ class AsyncRawEnvironmentsClient:
912
1302
  ),
913
1303
  ),
914
1304
  )
1305
+ if _response.status_code == 503:
1306
+ raise ServiceUnavailableError(
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
+ )
915
1316
  _response_json = _response.json()
916
1317
  except JSONDecodeError:
917
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
918
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1318
+ raise ApiError(
1319
+ status_code=_response.status_code,
1320
+ headers=dict(_response.headers),
1321
+ body=_response.text,
1322
+ )
1323
+ raise ApiError(
1324
+ status_code=_response.status_code,
1325
+ headers=dict(_response.headers),
1326
+ body=_response_json,
1327
+ )
919
1328
 
920
1329
  async def delete(
921
1330
  self,
@@ -953,9 +1362,9 @@ class AsyncRawEnvironmentsClient:
953
1362
  raise BadRequestError(
954
1363
  headers=dict(_response.headers),
955
1364
  body=typing.cast(
956
- HttpApiDecodeError,
1365
+ typing.Optional[typing.Any],
957
1366
  parse_obj_as(
958
- type_=HttpApiDecodeError, # type: ignore
1367
+ type_=typing.Optional[typing.Any], # type: ignore
959
1368
  object_=_response.json(),
960
1369
  ),
961
1370
  ),
@@ -982,6 +1391,17 @@ class AsyncRawEnvironmentsClient:
982
1391
  ),
983
1392
  ),
984
1393
  )
1394
+ if _response.status_code == 429:
1395
+ raise TooManyRequestsError(
1396
+ headers=dict(_response.headers),
1397
+ body=typing.cast(
1398
+ RateLimitError,
1399
+ parse_obj_as(
1400
+ type_=RateLimitError, # type: ignore
1401
+ object_=_response.json(),
1402
+ ),
1403
+ ),
1404
+ )
985
1405
  if _response.status_code == 500:
986
1406
  raise InternalServerError(
987
1407
  headers=dict(_response.headers),
@@ -993,7 +1413,155 @@ class AsyncRawEnvironmentsClient:
993
1413
  ),
994
1414
  ),
995
1415
  )
1416
+ if _response.status_code == 503:
1417
+ raise ServiceUnavailableError(
1418
+ headers=dict(_response.headers),
1419
+ body=typing.cast(
1420
+ typing.Optional[typing.Any],
1421
+ parse_obj_as(
1422
+ type_=typing.Optional[typing.Any], # type: ignore
1423
+ object_=_response.json(),
1424
+ ),
1425
+ ),
1426
+ )
996
1427
  _response_json = _response.json()
997
1428
  except JSONDecodeError:
998
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
999
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1429
+ raise ApiError(
1430
+ status_code=_response.status_code,
1431
+ headers=dict(_response.headers),
1432
+ body=_response.text,
1433
+ )
1434
+ raise ApiError(
1435
+ status_code=_response.status_code,
1436
+ headers=dict(_response.headers),
1437
+ body=_response_json,
1438
+ )
1439
+
1440
+ async def getanalytics(
1441
+ self,
1442
+ organization_id: str,
1443
+ project_id: str,
1444
+ environment_id: str,
1445
+ *,
1446
+ start_time: str,
1447
+ end_time: str,
1448
+ request_options: typing.Optional[RequestOptions] = None,
1449
+ ) -> AsyncHttpResponse[EnvironmentsGetAnalyticsResponse]:
1450
+ """
1451
+ Parameters
1452
+ ----------
1453
+ organization_id : str
1454
+
1455
+ project_id : str
1456
+
1457
+ environment_id : str
1458
+
1459
+ start_time : str
1460
+
1461
+ end_time : str
1462
+
1463
+ request_options : typing.Optional[RequestOptions]
1464
+ Request-specific configuration.
1465
+
1466
+ Returns
1467
+ -------
1468
+ AsyncHttpResponse[EnvironmentsGetAnalyticsResponse]
1469
+ Success
1470
+ """
1471
+ _response = await self._client_wrapper.httpx_client.request(
1472
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/environments/{jsonable_encoder(environment_id)}/analytics",
1473
+ method="GET",
1474
+ params={
1475
+ "startTime": start_time,
1476
+ "endTime": end_time,
1477
+ },
1478
+ request_options=request_options,
1479
+ )
1480
+ try:
1481
+ if 200 <= _response.status_code < 300:
1482
+ _data = typing.cast(
1483
+ EnvironmentsGetAnalyticsResponse,
1484
+ parse_obj_as(
1485
+ type_=EnvironmentsGetAnalyticsResponse, # type: ignore
1486
+ object_=_response.json(),
1487
+ ),
1488
+ )
1489
+ return AsyncHttpResponse(response=_response, data=_data)
1490
+ if _response.status_code == 400:
1491
+ raise BadRequestError(
1492
+ headers=dict(_response.headers),
1493
+ body=typing.cast(
1494
+ typing.Optional[typing.Any],
1495
+ parse_obj_as(
1496
+ type_=typing.Optional[typing.Any], # type: ignore
1497
+ object_=_response.json(),
1498
+ ),
1499
+ ),
1500
+ )
1501
+ if _response.status_code == 403:
1502
+ raise ForbiddenError(
1503
+ headers=dict(_response.headers),
1504
+ body=typing.cast(
1505
+ PermissionDeniedError,
1506
+ parse_obj_as(
1507
+ type_=PermissionDeniedError, # type: ignore
1508
+ object_=_response.json(),
1509
+ ),
1510
+ ),
1511
+ )
1512
+ if _response.status_code == 404:
1513
+ raise NotFoundError(
1514
+ headers=dict(_response.headers),
1515
+ body=typing.cast(
1516
+ NotFoundErrorBody,
1517
+ parse_obj_as(
1518
+ type_=NotFoundErrorBody, # type: ignore
1519
+ object_=_response.json(),
1520
+ ),
1521
+ ),
1522
+ )
1523
+ if _response.status_code == 429:
1524
+ raise TooManyRequestsError(
1525
+ headers=dict(_response.headers),
1526
+ body=typing.cast(
1527
+ RateLimitError,
1528
+ parse_obj_as(
1529
+ type_=RateLimitError, # type: ignore
1530
+ object_=_response.json(),
1531
+ ),
1532
+ ),
1533
+ )
1534
+ if _response.status_code == 500:
1535
+ raise InternalServerError(
1536
+ headers=dict(_response.headers),
1537
+ body=typing.cast(
1538
+ typing.Optional[typing.Any],
1539
+ parse_obj_as(
1540
+ type_=typing.Optional[typing.Any], # type: ignore
1541
+ object_=_response.json(),
1542
+ ),
1543
+ ),
1544
+ )
1545
+ if _response.status_code == 503:
1546
+ raise ServiceUnavailableError(
1547
+ headers=dict(_response.headers),
1548
+ body=typing.cast(
1549
+ typing.Optional[typing.Any],
1550
+ parse_obj_as(
1551
+ type_=typing.Optional[typing.Any], # type: ignore
1552
+ object_=_response.json(),
1553
+ ),
1554
+ ),
1555
+ )
1556
+ _response_json = _response.json()
1557
+ except JSONDecodeError:
1558
+ raise ApiError(
1559
+ status_code=_response.status_code,
1560
+ headers=dict(_response.headers),
1561
+ body=_response.text,
1562
+ )
1563
+ raise ApiError(
1564
+ status_code=_response.status_code,
1565
+ headers=dict(_response.headers),
1566
+ body=_response_json,
1567
+ )