aeri-python 4.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. aeri/__init__.py +72 -0
  2. aeri/_client/_validation.py +204 -0
  3. aeri/_client/attributes.py +188 -0
  4. aeri/_client/client.py +3761 -0
  5. aeri/_client/constants.py +65 -0
  6. aeri/_client/datasets.py +302 -0
  7. aeri/_client/environment_variables.py +158 -0
  8. aeri/_client/get_client.py +149 -0
  9. aeri/_client/observe.py +661 -0
  10. aeri/_client/propagation.py +475 -0
  11. aeri/_client/resource_manager.py +510 -0
  12. aeri/_client/span.py +1519 -0
  13. aeri/_client/span_filter.py +76 -0
  14. aeri/_client/span_processor.py +206 -0
  15. aeri/_client/utils.py +132 -0
  16. aeri/_task_manager/media_manager.py +331 -0
  17. aeri/_task_manager/media_upload_consumer.py +44 -0
  18. aeri/_task_manager/media_upload_queue.py +12 -0
  19. aeri/_task_manager/score_ingestion_consumer.py +208 -0
  20. aeri/_task_manager/task_manager.py +475 -0
  21. aeri/_utils/__init__.py +19 -0
  22. aeri/_utils/environment.py +34 -0
  23. aeri/_utils/error_logging.py +47 -0
  24. aeri/_utils/parse_error.py +99 -0
  25. aeri/_utils/prompt_cache.py +188 -0
  26. aeri/_utils/request.py +137 -0
  27. aeri/_utils/serializer.py +205 -0
  28. aeri/api/.fern/metadata.json +14 -0
  29. aeri/api/__init__.py +836 -0
  30. aeri/api/annotation_queues/__init__.py +82 -0
  31. aeri/api/annotation_queues/client.py +1111 -0
  32. aeri/api/annotation_queues/raw_client.py +2288 -0
  33. aeri/api/annotation_queues/types/__init__.py +84 -0
  34. aeri/api/annotation_queues/types/annotation_queue.py +28 -0
  35. aeri/api/annotation_queues/types/annotation_queue_assignment_request.py +16 -0
  36. aeri/api/annotation_queues/types/annotation_queue_item.py +34 -0
  37. aeri/api/annotation_queues/types/annotation_queue_object_type.py +26 -0
  38. aeri/api/annotation_queues/types/annotation_queue_status.py +22 -0
  39. aeri/api/annotation_queues/types/create_annotation_queue_assignment_response.py +18 -0
  40. aeri/api/annotation_queues/types/create_annotation_queue_item_request.py +25 -0
  41. aeri/api/annotation_queues/types/create_annotation_queue_request.py +20 -0
  42. aeri/api/annotation_queues/types/delete_annotation_queue_assignment_response.py +14 -0
  43. aeri/api/annotation_queues/types/delete_annotation_queue_item_response.py +15 -0
  44. aeri/api/annotation_queues/types/paginated_annotation_queue_items.py +17 -0
  45. aeri/api/annotation_queues/types/paginated_annotation_queues.py +17 -0
  46. aeri/api/annotation_queues/types/update_annotation_queue_item_request.py +15 -0
  47. aeri/api/blob_storage_integrations/__init__.py +73 -0
  48. aeri/api/blob_storage_integrations/client.py +550 -0
  49. aeri/api/blob_storage_integrations/raw_client.py +976 -0
  50. aeri/api/blob_storage_integrations/types/__init__.py +77 -0
  51. aeri/api/blob_storage_integrations/types/blob_storage_export_frequency.py +26 -0
  52. aeri/api/blob_storage_integrations/types/blob_storage_export_mode.py +26 -0
  53. aeri/api/blob_storage_integrations/types/blob_storage_integration_deletion_response.py +14 -0
  54. aeri/api/blob_storage_integrations/types/blob_storage_integration_file_type.py +26 -0
  55. aeri/api/blob_storage_integrations/types/blob_storage_integration_response.py +64 -0
  56. aeri/api/blob_storage_integrations/types/blob_storage_integration_status_response.py +50 -0
  57. aeri/api/blob_storage_integrations/types/blob_storage_integration_type.py +26 -0
  58. aeri/api/blob_storage_integrations/types/blob_storage_integrations_response.py +15 -0
  59. aeri/api/blob_storage_integrations/types/blob_storage_sync_status.py +47 -0
  60. aeri/api/blob_storage_integrations/types/create_blob_storage_integration_request.py +91 -0
  61. aeri/api/client.py +679 -0
  62. aeri/api/comments/__init__.py +44 -0
  63. aeri/api/comments/client.py +407 -0
  64. aeri/api/comments/raw_client.py +750 -0
  65. aeri/api/comments/types/__init__.py +46 -0
  66. aeri/api/comments/types/create_comment_request.py +47 -0
  67. aeri/api/comments/types/create_comment_response.py +17 -0
  68. aeri/api/comments/types/get_comments_response.py +17 -0
  69. aeri/api/commons/__init__.py +210 -0
  70. aeri/api/commons/errors/__init__.py +56 -0
  71. aeri/api/commons/errors/access_denied_error.py +12 -0
  72. aeri/api/commons/errors/error.py +12 -0
  73. aeri/api/commons/errors/method_not_allowed_error.py +12 -0
  74. aeri/api/commons/errors/not_found_error.py +12 -0
  75. aeri/api/commons/errors/unauthorized_error.py +12 -0
  76. aeri/api/commons/types/__init__.py +190 -0
  77. aeri/api/commons/types/base_score.py +90 -0
  78. aeri/api/commons/types/base_score_v1.py +70 -0
  79. aeri/api/commons/types/boolean_score.py +26 -0
  80. aeri/api/commons/types/boolean_score_v1.py +26 -0
  81. aeri/api/commons/types/categorical_score.py +26 -0
  82. aeri/api/commons/types/categorical_score_v1.py +26 -0
  83. aeri/api/commons/types/comment.py +36 -0
  84. aeri/api/commons/types/comment_object_type.py +30 -0
  85. aeri/api/commons/types/config_category.py +15 -0
  86. aeri/api/commons/types/correction_score.py +26 -0
  87. aeri/api/commons/types/create_score_value.py +5 -0
  88. aeri/api/commons/types/dataset.py +49 -0
  89. aeri/api/commons/types/dataset_item.py +58 -0
  90. aeri/api/commons/types/dataset_run.py +63 -0
  91. aeri/api/commons/types/dataset_run_item.py +40 -0
  92. aeri/api/commons/types/dataset_run_with_items.py +19 -0
  93. aeri/api/commons/types/dataset_status.py +22 -0
  94. aeri/api/commons/types/map_value.py +11 -0
  95. aeri/api/commons/types/model.py +125 -0
  96. aeri/api/commons/types/model_price.py +14 -0
  97. aeri/api/commons/types/model_usage_unit.py +42 -0
  98. aeri/api/commons/types/numeric_score.py +17 -0
  99. aeri/api/commons/types/numeric_score_v1.py +17 -0
  100. aeri/api/commons/types/observation.py +142 -0
  101. aeri/api/commons/types/observation_level.py +30 -0
  102. aeri/api/commons/types/observation_v2.py +235 -0
  103. aeri/api/commons/types/observations_view.py +89 -0
  104. aeri/api/commons/types/pricing_tier.py +91 -0
  105. aeri/api/commons/types/pricing_tier_condition.py +68 -0
  106. aeri/api/commons/types/pricing_tier_input.py +76 -0
  107. aeri/api/commons/types/pricing_tier_operator.py +42 -0
  108. aeri/api/commons/types/score.py +201 -0
  109. aeri/api/commons/types/score_config.py +66 -0
  110. aeri/api/commons/types/score_config_data_type.py +26 -0
  111. aeri/api/commons/types/score_data_type.py +30 -0
  112. aeri/api/commons/types/score_source.py +26 -0
  113. aeri/api/commons/types/score_v1.py +131 -0
  114. aeri/api/commons/types/session.py +25 -0
  115. aeri/api/commons/types/session_with_traces.py +15 -0
  116. aeri/api/commons/types/trace.py +84 -0
  117. aeri/api/commons/types/trace_with_details.py +43 -0
  118. aeri/api/commons/types/trace_with_full_details.py +45 -0
  119. aeri/api/commons/types/usage.py +59 -0
  120. aeri/api/core/__init__.py +111 -0
  121. aeri/api/core/api_error.py +23 -0
  122. aeri/api/core/client_wrapper.py +141 -0
  123. aeri/api/core/datetime_utils.py +30 -0
  124. aeri/api/core/enum.py +20 -0
  125. aeri/api/core/file.py +70 -0
  126. aeri/api/core/force_multipart.py +18 -0
  127. aeri/api/core/http_client.py +711 -0
  128. aeri/api/core/http_response.py +55 -0
  129. aeri/api/core/http_sse/__init__.py +48 -0
  130. aeri/api/core/http_sse/_api.py +114 -0
  131. aeri/api/core/http_sse/_decoders.py +66 -0
  132. aeri/api/core/http_sse/_exceptions.py +7 -0
  133. aeri/api/core/http_sse/_models.py +17 -0
  134. aeri/api/core/jsonable_encoder.py +102 -0
  135. aeri/api/core/pydantic_utilities.py +310 -0
  136. aeri/api/core/query_encoder.py +60 -0
  137. aeri/api/core/remove_none_from_dict.py +11 -0
  138. aeri/api/core/request_options.py +35 -0
  139. aeri/api/core/serialization.py +282 -0
  140. aeri/api/dataset_items/__init__.py +52 -0
  141. aeri/api/dataset_items/client.py +499 -0
  142. aeri/api/dataset_items/raw_client.py +973 -0
  143. aeri/api/dataset_items/types/__init__.py +50 -0
  144. aeri/api/dataset_items/types/create_dataset_item_request.py +37 -0
  145. aeri/api/dataset_items/types/delete_dataset_item_response.py +17 -0
  146. aeri/api/dataset_items/types/paginated_dataset_items.py +17 -0
  147. aeri/api/dataset_run_items/__init__.py +43 -0
  148. aeri/api/dataset_run_items/client.py +323 -0
  149. aeri/api/dataset_run_items/raw_client.py +547 -0
  150. aeri/api/dataset_run_items/types/__init__.py +44 -0
  151. aeri/api/dataset_run_items/types/create_dataset_run_item_request.py +51 -0
  152. aeri/api/dataset_run_items/types/paginated_dataset_run_items.py +17 -0
  153. aeri/api/datasets/__init__.py +55 -0
  154. aeri/api/datasets/client.py +661 -0
  155. aeri/api/datasets/raw_client.py +1368 -0
  156. aeri/api/datasets/types/__init__.py +53 -0
  157. aeri/api/datasets/types/create_dataset_request.py +31 -0
  158. aeri/api/datasets/types/delete_dataset_run_response.py +14 -0
  159. aeri/api/datasets/types/paginated_dataset_runs.py +17 -0
  160. aeri/api/datasets/types/paginated_datasets.py +17 -0
  161. aeri/api/health/__init__.py +44 -0
  162. aeri/api/health/client.py +112 -0
  163. aeri/api/health/errors/__init__.py +42 -0
  164. aeri/api/health/errors/service_unavailable_error.py +13 -0
  165. aeri/api/health/raw_client.py +227 -0
  166. aeri/api/health/types/__init__.py +40 -0
  167. aeri/api/health/types/health_response.py +30 -0
  168. aeri/api/ingestion/__init__.py +169 -0
  169. aeri/api/ingestion/client.py +221 -0
  170. aeri/api/ingestion/raw_client.py +293 -0
  171. aeri/api/ingestion/types/__init__.py +169 -0
  172. aeri/api/ingestion/types/base_event.py +27 -0
  173. aeri/api/ingestion/types/create_event_body.py +14 -0
  174. aeri/api/ingestion/types/create_event_event.py +15 -0
  175. aeri/api/ingestion/types/create_generation_body.py +40 -0
  176. aeri/api/ingestion/types/create_generation_event.py +15 -0
  177. aeri/api/ingestion/types/create_observation_event.py +15 -0
  178. aeri/api/ingestion/types/create_span_body.py +19 -0
  179. aeri/api/ingestion/types/create_span_event.py +15 -0
  180. aeri/api/ingestion/types/ingestion_error.py +17 -0
  181. aeri/api/ingestion/types/ingestion_event.py +155 -0
  182. aeri/api/ingestion/types/ingestion_response.py +17 -0
  183. aeri/api/ingestion/types/ingestion_success.py +15 -0
  184. aeri/api/ingestion/types/ingestion_usage.py +8 -0
  185. aeri/api/ingestion/types/observation_body.py +53 -0
  186. aeri/api/ingestion/types/observation_type.py +54 -0
  187. aeri/api/ingestion/types/open_ai_completion_usage_schema.py +26 -0
  188. aeri/api/ingestion/types/open_ai_response_usage_schema.py +24 -0
  189. aeri/api/ingestion/types/open_ai_usage.py +28 -0
  190. aeri/api/ingestion/types/optional_observation_body.py +36 -0
  191. aeri/api/ingestion/types/score_body.py +75 -0
  192. aeri/api/ingestion/types/score_event.py +15 -0
  193. aeri/api/ingestion/types/sdk_log_body.py +14 -0
  194. aeri/api/ingestion/types/sdk_log_event.py +15 -0
  195. aeri/api/ingestion/types/trace_body.py +36 -0
  196. aeri/api/ingestion/types/trace_event.py +15 -0
  197. aeri/api/ingestion/types/update_event_body.py +14 -0
  198. aeri/api/ingestion/types/update_generation_body.py +40 -0
  199. aeri/api/ingestion/types/update_generation_event.py +15 -0
  200. aeri/api/ingestion/types/update_observation_event.py +15 -0
  201. aeri/api/ingestion/types/update_span_body.py +19 -0
  202. aeri/api/ingestion/types/update_span_event.py +15 -0
  203. aeri/api/ingestion/types/usage_details.py +10 -0
  204. aeri/api/legacy/__init__.py +61 -0
  205. aeri/api/legacy/client.py +105 -0
  206. aeri/api/legacy/metrics_v1/__init__.py +40 -0
  207. aeri/api/legacy/metrics_v1/client.py +214 -0
  208. aeri/api/legacy/metrics_v1/raw_client.py +322 -0
  209. aeri/api/legacy/metrics_v1/types/__init__.py +40 -0
  210. aeri/api/legacy/metrics_v1/types/metrics_response.py +19 -0
  211. aeri/api/legacy/observations_v1/__init__.py +43 -0
  212. aeri/api/legacy/observations_v1/client.py +523 -0
  213. aeri/api/legacy/observations_v1/raw_client.py +759 -0
  214. aeri/api/legacy/observations_v1/types/__init__.py +44 -0
  215. aeri/api/legacy/observations_v1/types/observations.py +17 -0
  216. aeri/api/legacy/observations_v1/types/observations_views.py +17 -0
  217. aeri/api/legacy/raw_client.py +13 -0
  218. aeri/api/legacy/score_v1/__init__.py +43 -0
  219. aeri/api/legacy/score_v1/client.py +329 -0
  220. aeri/api/legacy/score_v1/raw_client.py +545 -0
  221. aeri/api/legacy/score_v1/types/__init__.py +44 -0
  222. aeri/api/legacy/score_v1/types/create_score_request.py +75 -0
  223. aeri/api/legacy/score_v1/types/create_score_response.py +17 -0
  224. aeri/api/llm_connections/__init__.py +55 -0
  225. aeri/api/llm_connections/client.py +311 -0
  226. aeri/api/llm_connections/raw_client.py +541 -0
  227. aeri/api/llm_connections/types/__init__.py +53 -0
  228. aeri/api/llm_connections/types/llm_adapter.py +38 -0
  229. aeri/api/llm_connections/types/llm_connection.py +77 -0
  230. aeri/api/llm_connections/types/paginated_llm_connections.py +17 -0
  231. aeri/api/llm_connections/types/upsert_llm_connection_request.py +69 -0
  232. aeri/api/media/__init__.py +58 -0
  233. aeri/api/media/client.py +427 -0
  234. aeri/api/media/raw_client.py +739 -0
  235. aeri/api/media/types/__init__.py +56 -0
  236. aeri/api/media/types/get_media_response.py +55 -0
  237. aeri/api/media/types/get_media_upload_url_request.py +51 -0
  238. aeri/api/media/types/get_media_upload_url_response.py +28 -0
  239. aeri/api/media/types/media_content_type.py +232 -0
  240. aeri/api/media/types/patch_media_body.py +43 -0
  241. aeri/api/metrics/__init__.py +40 -0
  242. aeri/api/metrics/client.py +422 -0
  243. aeri/api/metrics/raw_client.py +530 -0
  244. aeri/api/metrics/types/__init__.py +40 -0
  245. aeri/api/metrics/types/metrics_v2response.py +19 -0
  246. aeri/api/models/__init__.py +43 -0
  247. aeri/api/models/client.py +523 -0
  248. aeri/api/models/raw_client.py +993 -0
  249. aeri/api/models/types/__init__.py +44 -0
  250. aeri/api/models/types/create_model_request.py +103 -0
  251. aeri/api/models/types/paginated_models.py +17 -0
  252. aeri/api/observations/__init__.py +43 -0
  253. aeri/api/observations/client.py +522 -0
  254. aeri/api/observations/raw_client.py +641 -0
  255. aeri/api/observations/types/__init__.py +44 -0
  256. aeri/api/observations/types/observations_v2meta.py +21 -0
  257. aeri/api/observations/types/observations_v2response.py +28 -0
  258. aeri/api/opentelemetry/__init__.py +67 -0
  259. aeri/api/opentelemetry/client.py +276 -0
  260. aeri/api/opentelemetry/raw_client.py +291 -0
  261. aeri/api/opentelemetry/types/__init__.py +65 -0
  262. aeri/api/opentelemetry/types/otel_attribute.py +27 -0
  263. aeri/api/opentelemetry/types/otel_attribute_value.py +46 -0
  264. aeri/api/opentelemetry/types/otel_resource.py +24 -0
  265. aeri/api/opentelemetry/types/otel_resource_span.py +32 -0
  266. aeri/api/opentelemetry/types/otel_scope.py +34 -0
  267. aeri/api/opentelemetry/types/otel_scope_span.py +28 -0
  268. aeri/api/opentelemetry/types/otel_span.py +76 -0
  269. aeri/api/opentelemetry/types/otel_trace_response.py +16 -0
  270. aeri/api/organizations/__init__.py +73 -0
  271. aeri/api/organizations/client.py +756 -0
  272. aeri/api/organizations/raw_client.py +1707 -0
  273. aeri/api/organizations/types/__init__.py +71 -0
  274. aeri/api/organizations/types/delete_membership_request.py +16 -0
  275. aeri/api/organizations/types/membership_deletion_response.py +17 -0
  276. aeri/api/organizations/types/membership_request.py +18 -0
  277. aeri/api/organizations/types/membership_response.py +20 -0
  278. aeri/api/organizations/types/membership_role.py +30 -0
  279. aeri/api/organizations/types/memberships_response.py +15 -0
  280. aeri/api/organizations/types/organization_api_key.py +31 -0
  281. aeri/api/organizations/types/organization_api_keys_response.py +19 -0
  282. aeri/api/organizations/types/organization_project.py +25 -0
  283. aeri/api/organizations/types/organization_projects_response.py +15 -0
  284. aeri/api/projects/__init__.py +67 -0
  285. aeri/api/projects/client.py +760 -0
  286. aeri/api/projects/raw_client.py +1577 -0
  287. aeri/api/projects/types/__init__.py +65 -0
  288. aeri/api/projects/types/api_key_deletion_response.py +18 -0
  289. aeri/api/projects/types/api_key_list.py +23 -0
  290. aeri/api/projects/types/api_key_response.py +30 -0
  291. aeri/api/projects/types/api_key_summary.py +35 -0
  292. aeri/api/projects/types/organization.py +22 -0
  293. aeri/api/projects/types/project.py +34 -0
  294. aeri/api/projects/types/project_deletion_response.py +15 -0
  295. aeri/api/projects/types/projects.py +15 -0
  296. aeri/api/prompt_version/__init__.py +4 -0
  297. aeri/api/prompt_version/client.py +157 -0
  298. aeri/api/prompt_version/raw_client.py +264 -0
  299. aeri/api/prompts/__init__.py +100 -0
  300. aeri/api/prompts/client.py +550 -0
  301. aeri/api/prompts/raw_client.py +987 -0
  302. aeri/api/prompts/types/__init__.py +96 -0
  303. aeri/api/prompts/types/base_prompt.py +42 -0
  304. aeri/api/prompts/types/chat_message.py +17 -0
  305. aeri/api/prompts/types/chat_message_type.py +15 -0
  306. aeri/api/prompts/types/chat_message_with_placeholders.py +8 -0
  307. aeri/api/prompts/types/chat_prompt.py +15 -0
  308. aeri/api/prompts/types/create_chat_prompt_request.py +37 -0
  309. aeri/api/prompts/types/create_chat_prompt_type.py +15 -0
  310. aeri/api/prompts/types/create_prompt_request.py +8 -0
  311. aeri/api/prompts/types/create_text_prompt_request.py +36 -0
  312. aeri/api/prompts/types/create_text_prompt_type.py +15 -0
  313. aeri/api/prompts/types/placeholder_message.py +16 -0
  314. aeri/api/prompts/types/placeholder_message_type.py +15 -0
  315. aeri/api/prompts/types/prompt.py +58 -0
  316. aeri/api/prompts/types/prompt_meta.py +35 -0
  317. aeri/api/prompts/types/prompt_meta_list_response.py +17 -0
  318. aeri/api/prompts/types/prompt_type.py +20 -0
  319. aeri/api/prompts/types/text_prompt.py +14 -0
  320. aeri/api/scim/__init__.py +94 -0
  321. aeri/api/scim/client.py +686 -0
  322. aeri/api/scim/raw_client.py +1528 -0
  323. aeri/api/scim/types/__init__.py +92 -0
  324. aeri/api/scim/types/authentication_scheme.py +20 -0
  325. aeri/api/scim/types/bulk_config.py +22 -0
  326. aeri/api/scim/types/empty_response.py +16 -0
  327. aeri/api/scim/types/filter_config.py +17 -0
  328. aeri/api/scim/types/resource_meta.py +17 -0
  329. aeri/api/scim/types/resource_type.py +27 -0
  330. aeri/api/scim/types/resource_types_response.py +21 -0
  331. aeri/api/scim/types/schema_extension.py +17 -0
  332. aeri/api/scim/types/schema_resource.py +19 -0
  333. aeri/api/scim/types/schemas_response.py +21 -0
  334. aeri/api/scim/types/scim_email.py +16 -0
  335. aeri/api/scim/types/scim_feature_support.py +14 -0
  336. aeri/api/scim/types/scim_name.py +14 -0
  337. aeri/api/scim/types/scim_user.py +24 -0
  338. aeri/api/scim/types/scim_users_list_response.py +25 -0
  339. aeri/api/scim/types/service_provider_config.py +36 -0
  340. aeri/api/scim/types/user_meta.py +20 -0
  341. aeri/api/score_configs/__init__.py +44 -0
  342. aeri/api/score_configs/client.py +526 -0
  343. aeri/api/score_configs/raw_client.py +1012 -0
  344. aeri/api/score_configs/types/__init__.py +46 -0
  345. aeri/api/score_configs/types/create_score_config_request.py +46 -0
  346. aeri/api/score_configs/types/score_configs.py +17 -0
  347. aeri/api/score_configs/types/update_score_config_request.py +53 -0
  348. aeri/api/scores/__init__.py +76 -0
  349. aeri/api/scores/client.py +420 -0
  350. aeri/api/scores/raw_client.py +656 -0
  351. aeri/api/scores/types/__init__.py +76 -0
  352. aeri/api/scores/types/get_scores_response.py +17 -0
  353. aeri/api/scores/types/get_scores_response_data.py +211 -0
  354. aeri/api/scores/types/get_scores_response_data_boolean.py +15 -0
  355. aeri/api/scores/types/get_scores_response_data_categorical.py +15 -0
  356. aeri/api/scores/types/get_scores_response_data_correction.py +15 -0
  357. aeri/api/scores/types/get_scores_response_data_numeric.py +15 -0
  358. aeri/api/scores/types/get_scores_response_trace_data.py +38 -0
  359. aeri/api/sessions/__init__.py +40 -0
  360. aeri/api/sessions/client.py +262 -0
  361. aeri/api/sessions/raw_client.py +500 -0
  362. aeri/api/sessions/types/__init__.py +40 -0
  363. aeri/api/sessions/types/paginated_sessions.py +17 -0
  364. aeri/api/trace/__init__.py +44 -0
  365. aeri/api/trace/client.py +728 -0
  366. aeri/api/trace/raw_client.py +1208 -0
  367. aeri/api/trace/types/__init__.py +46 -0
  368. aeri/api/trace/types/delete_trace_response.py +14 -0
  369. aeri/api/trace/types/sort.py +14 -0
  370. aeri/api/trace/types/traces.py +17 -0
  371. aeri/api/utils/__init__.py +44 -0
  372. aeri/api/utils/pagination/__init__.py +40 -0
  373. aeri/api/utils/pagination/types/__init__.py +40 -0
  374. aeri/api/utils/pagination/types/meta_response.py +38 -0
  375. aeri/batch_evaluation.py +1643 -0
  376. aeri/experiment.py +1044 -0
  377. aeri/langchain/CallbackHandler.py +1377 -0
  378. aeri/langchain/__init__.py +5 -0
  379. aeri/langchain/utils.py +212 -0
  380. aeri/logger.py +28 -0
  381. aeri/media.py +352 -0
  382. aeri/model.py +477 -0
  383. aeri/openai.py +1124 -0
  384. aeri/py.typed +0 -0
  385. aeri/span_filter.py +17 -0
  386. aeri/types.py +79 -0
  387. aeri/version.py +3 -0
  388. aeri_python-4.0.0.dist-info/METADATA +51 -0
  389. aeri_python-4.0.0.dist-info/RECORD +391 -0
  390. aeri_python-4.0.0.dist-info/WHEEL +4 -0
  391. aeri_python-4.0.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1528 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..commons.errors.access_denied_error import AccessDeniedError
7
+ from ..commons.errors.error import Error
8
+ from ..commons.errors.method_not_allowed_error import MethodNotAllowedError
9
+ from ..commons.errors.not_found_error import NotFoundError
10
+ from ..commons.errors.unauthorized_error import UnauthorizedError
11
+ from ..core.api_error import ApiError
12
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
13
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
14
+ from ..core.jsonable_encoder import jsonable_encoder
15
+ from ..core.pydantic_utilities import parse_obj_as
16
+ from ..core.request_options import RequestOptions
17
+ from ..core.serialization import convert_and_respect_annotation_metadata
18
+ from .types.empty_response import EmptyResponse
19
+ from .types.resource_types_response import ResourceTypesResponse
20
+ from .types.schemas_response import SchemasResponse
21
+ from .types.scim_email import ScimEmail
22
+ from .types.scim_name import ScimName
23
+ from .types.scim_user import ScimUser
24
+ from .types.scim_users_list_response import ScimUsersListResponse
25
+ from .types.service_provider_config import ServiceProviderConfig
26
+
27
+ # this is used as the default value for optional parameters
28
+ OMIT = typing.cast(typing.Any, ...)
29
+
30
+
31
+ class RawScimClient:
32
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
33
+ self._client_wrapper = client_wrapper
34
+
35
+ def get_service_provider_config(
36
+ self, *, request_options: typing.Optional[RequestOptions] = None
37
+ ) -> HttpResponse[ServiceProviderConfig]:
38
+ """
39
+ Get SCIM Service Provider Configuration (requires organization-scoped API key)
40
+
41
+ Parameters
42
+ ----------
43
+ request_options : typing.Optional[RequestOptions]
44
+ Request-specific configuration.
45
+
46
+ Returns
47
+ -------
48
+ HttpResponse[ServiceProviderConfig]
49
+ """
50
+ _response = self._client_wrapper.httpx_client.request(
51
+ "api/public/scim/ServiceProviderConfig",
52
+ method="GET",
53
+ request_options=request_options,
54
+ )
55
+ try:
56
+ if 200 <= _response.status_code < 300:
57
+ _data = typing.cast(
58
+ ServiceProviderConfig,
59
+ parse_obj_as(
60
+ type_=ServiceProviderConfig, # type: ignore
61
+ object_=_response.json(),
62
+ ),
63
+ )
64
+ return HttpResponse(response=_response, data=_data)
65
+ if _response.status_code == 400:
66
+ raise Error(
67
+ headers=dict(_response.headers),
68
+ body=typing.cast(
69
+ typing.Any,
70
+ parse_obj_as(
71
+ type_=typing.Any, # type: ignore
72
+ object_=_response.json(),
73
+ ),
74
+ ),
75
+ )
76
+ if _response.status_code == 401:
77
+ raise UnauthorizedError(
78
+ headers=dict(_response.headers),
79
+ body=typing.cast(
80
+ typing.Any,
81
+ parse_obj_as(
82
+ type_=typing.Any, # type: ignore
83
+ object_=_response.json(),
84
+ ),
85
+ ),
86
+ )
87
+ if _response.status_code == 403:
88
+ raise AccessDeniedError(
89
+ headers=dict(_response.headers),
90
+ body=typing.cast(
91
+ typing.Any,
92
+ parse_obj_as(
93
+ type_=typing.Any, # type: ignore
94
+ object_=_response.json(),
95
+ ),
96
+ ),
97
+ )
98
+ if _response.status_code == 405:
99
+ raise MethodNotAllowedError(
100
+ headers=dict(_response.headers),
101
+ body=typing.cast(
102
+ typing.Any,
103
+ parse_obj_as(
104
+ type_=typing.Any, # type: ignore
105
+ object_=_response.json(),
106
+ ),
107
+ ),
108
+ )
109
+ if _response.status_code == 404:
110
+ raise NotFoundError(
111
+ headers=dict(_response.headers),
112
+ body=typing.cast(
113
+ typing.Any,
114
+ parse_obj_as(
115
+ type_=typing.Any, # type: ignore
116
+ object_=_response.json(),
117
+ ),
118
+ ),
119
+ )
120
+ _response_json = _response.json()
121
+ except JSONDecodeError:
122
+ raise ApiError(
123
+ status_code=_response.status_code,
124
+ headers=dict(_response.headers),
125
+ body=_response.text,
126
+ )
127
+ raise ApiError(
128
+ status_code=_response.status_code,
129
+ headers=dict(_response.headers),
130
+ body=_response_json,
131
+ )
132
+
133
+ def get_resource_types(
134
+ self, *, request_options: typing.Optional[RequestOptions] = None
135
+ ) -> HttpResponse[ResourceTypesResponse]:
136
+ """
137
+ Get SCIM Resource Types (requires organization-scoped API key)
138
+
139
+ Parameters
140
+ ----------
141
+ request_options : typing.Optional[RequestOptions]
142
+ Request-specific configuration.
143
+
144
+ Returns
145
+ -------
146
+ HttpResponse[ResourceTypesResponse]
147
+ """
148
+ _response = self._client_wrapper.httpx_client.request(
149
+ "api/public/scim/ResourceTypes",
150
+ method="GET",
151
+ request_options=request_options,
152
+ )
153
+ try:
154
+ if 200 <= _response.status_code < 300:
155
+ _data = typing.cast(
156
+ ResourceTypesResponse,
157
+ parse_obj_as(
158
+ type_=ResourceTypesResponse, # type: ignore
159
+ object_=_response.json(),
160
+ ),
161
+ )
162
+ return HttpResponse(response=_response, data=_data)
163
+ if _response.status_code == 400:
164
+ raise Error(
165
+ headers=dict(_response.headers),
166
+ body=typing.cast(
167
+ typing.Any,
168
+ parse_obj_as(
169
+ type_=typing.Any, # type: ignore
170
+ object_=_response.json(),
171
+ ),
172
+ ),
173
+ )
174
+ if _response.status_code == 401:
175
+ raise UnauthorizedError(
176
+ headers=dict(_response.headers),
177
+ body=typing.cast(
178
+ typing.Any,
179
+ parse_obj_as(
180
+ type_=typing.Any, # type: ignore
181
+ object_=_response.json(),
182
+ ),
183
+ ),
184
+ )
185
+ if _response.status_code == 403:
186
+ raise AccessDeniedError(
187
+ headers=dict(_response.headers),
188
+ body=typing.cast(
189
+ typing.Any,
190
+ parse_obj_as(
191
+ type_=typing.Any, # type: ignore
192
+ object_=_response.json(),
193
+ ),
194
+ ),
195
+ )
196
+ if _response.status_code == 405:
197
+ raise MethodNotAllowedError(
198
+ headers=dict(_response.headers),
199
+ body=typing.cast(
200
+ typing.Any,
201
+ parse_obj_as(
202
+ type_=typing.Any, # type: ignore
203
+ object_=_response.json(),
204
+ ),
205
+ ),
206
+ )
207
+ if _response.status_code == 404:
208
+ raise NotFoundError(
209
+ headers=dict(_response.headers),
210
+ body=typing.cast(
211
+ typing.Any,
212
+ parse_obj_as(
213
+ type_=typing.Any, # type: ignore
214
+ object_=_response.json(),
215
+ ),
216
+ ),
217
+ )
218
+ _response_json = _response.json()
219
+ except JSONDecodeError:
220
+ raise ApiError(
221
+ status_code=_response.status_code,
222
+ headers=dict(_response.headers),
223
+ body=_response.text,
224
+ )
225
+ raise ApiError(
226
+ status_code=_response.status_code,
227
+ headers=dict(_response.headers),
228
+ body=_response_json,
229
+ )
230
+
231
+ def get_schemas(
232
+ self, *, request_options: typing.Optional[RequestOptions] = None
233
+ ) -> HttpResponse[SchemasResponse]:
234
+ """
235
+ Get SCIM Schemas (requires organization-scoped API key)
236
+
237
+ Parameters
238
+ ----------
239
+ request_options : typing.Optional[RequestOptions]
240
+ Request-specific configuration.
241
+
242
+ Returns
243
+ -------
244
+ HttpResponse[SchemasResponse]
245
+ """
246
+ _response = self._client_wrapper.httpx_client.request(
247
+ "api/public/scim/Schemas",
248
+ method="GET",
249
+ request_options=request_options,
250
+ )
251
+ try:
252
+ if 200 <= _response.status_code < 300:
253
+ _data = typing.cast(
254
+ SchemasResponse,
255
+ parse_obj_as(
256
+ type_=SchemasResponse, # type: ignore
257
+ object_=_response.json(),
258
+ ),
259
+ )
260
+ return HttpResponse(response=_response, data=_data)
261
+ if _response.status_code == 400:
262
+ raise Error(
263
+ headers=dict(_response.headers),
264
+ body=typing.cast(
265
+ typing.Any,
266
+ parse_obj_as(
267
+ type_=typing.Any, # type: ignore
268
+ object_=_response.json(),
269
+ ),
270
+ ),
271
+ )
272
+ if _response.status_code == 401:
273
+ raise UnauthorizedError(
274
+ headers=dict(_response.headers),
275
+ body=typing.cast(
276
+ typing.Any,
277
+ parse_obj_as(
278
+ type_=typing.Any, # type: ignore
279
+ object_=_response.json(),
280
+ ),
281
+ ),
282
+ )
283
+ if _response.status_code == 403:
284
+ raise AccessDeniedError(
285
+ headers=dict(_response.headers),
286
+ body=typing.cast(
287
+ typing.Any,
288
+ parse_obj_as(
289
+ type_=typing.Any, # type: ignore
290
+ object_=_response.json(),
291
+ ),
292
+ ),
293
+ )
294
+ if _response.status_code == 405:
295
+ raise MethodNotAllowedError(
296
+ headers=dict(_response.headers),
297
+ body=typing.cast(
298
+ typing.Any,
299
+ parse_obj_as(
300
+ type_=typing.Any, # type: ignore
301
+ object_=_response.json(),
302
+ ),
303
+ ),
304
+ )
305
+ if _response.status_code == 404:
306
+ raise NotFoundError(
307
+ headers=dict(_response.headers),
308
+ body=typing.cast(
309
+ typing.Any,
310
+ parse_obj_as(
311
+ type_=typing.Any, # type: ignore
312
+ object_=_response.json(),
313
+ ),
314
+ ),
315
+ )
316
+ _response_json = _response.json()
317
+ except JSONDecodeError:
318
+ raise ApiError(
319
+ status_code=_response.status_code,
320
+ headers=dict(_response.headers),
321
+ body=_response.text,
322
+ )
323
+ raise ApiError(
324
+ status_code=_response.status_code,
325
+ headers=dict(_response.headers),
326
+ body=_response_json,
327
+ )
328
+
329
+ def list_users(
330
+ self,
331
+ *,
332
+ filter: typing.Optional[str] = None,
333
+ start_index: typing.Optional[int] = None,
334
+ count: typing.Optional[int] = None,
335
+ request_options: typing.Optional[RequestOptions] = None,
336
+ ) -> HttpResponse[ScimUsersListResponse]:
337
+ """
338
+ List users in the organization (requires organization-scoped API key)
339
+
340
+ Parameters
341
+ ----------
342
+ filter : typing.Optional[str]
343
+ Filter expression (e.g. userName eq "value")
344
+
345
+ start_index : typing.Optional[int]
346
+ 1-based index of the first result to return (default 1)
347
+
348
+ count : typing.Optional[int]
349
+ Maximum number of results to return (default 100)
350
+
351
+ request_options : typing.Optional[RequestOptions]
352
+ Request-specific configuration.
353
+
354
+ Returns
355
+ -------
356
+ HttpResponse[ScimUsersListResponse]
357
+ """
358
+ _response = self._client_wrapper.httpx_client.request(
359
+ "api/public/scim/Users",
360
+ method="GET",
361
+ params={
362
+ "filter": filter,
363
+ "startIndex": start_index,
364
+ "count": count,
365
+ },
366
+ request_options=request_options,
367
+ )
368
+ try:
369
+ if 200 <= _response.status_code < 300:
370
+ _data = typing.cast(
371
+ ScimUsersListResponse,
372
+ parse_obj_as(
373
+ type_=ScimUsersListResponse, # type: ignore
374
+ object_=_response.json(),
375
+ ),
376
+ )
377
+ return HttpResponse(response=_response, data=_data)
378
+ if _response.status_code == 400:
379
+ raise Error(
380
+ headers=dict(_response.headers),
381
+ body=typing.cast(
382
+ typing.Any,
383
+ parse_obj_as(
384
+ type_=typing.Any, # type: ignore
385
+ object_=_response.json(),
386
+ ),
387
+ ),
388
+ )
389
+ if _response.status_code == 401:
390
+ raise UnauthorizedError(
391
+ headers=dict(_response.headers),
392
+ body=typing.cast(
393
+ typing.Any,
394
+ parse_obj_as(
395
+ type_=typing.Any, # type: ignore
396
+ object_=_response.json(),
397
+ ),
398
+ ),
399
+ )
400
+ if _response.status_code == 403:
401
+ raise AccessDeniedError(
402
+ headers=dict(_response.headers),
403
+ body=typing.cast(
404
+ typing.Any,
405
+ parse_obj_as(
406
+ type_=typing.Any, # type: ignore
407
+ object_=_response.json(),
408
+ ),
409
+ ),
410
+ )
411
+ if _response.status_code == 405:
412
+ raise MethodNotAllowedError(
413
+ headers=dict(_response.headers),
414
+ body=typing.cast(
415
+ typing.Any,
416
+ parse_obj_as(
417
+ type_=typing.Any, # type: ignore
418
+ object_=_response.json(),
419
+ ),
420
+ ),
421
+ )
422
+ if _response.status_code == 404:
423
+ raise NotFoundError(
424
+ headers=dict(_response.headers),
425
+ body=typing.cast(
426
+ typing.Any,
427
+ parse_obj_as(
428
+ type_=typing.Any, # type: ignore
429
+ object_=_response.json(),
430
+ ),
431
+ ),
432
+ )
433
+ _response_json = _response.json()
434
+ except JSONDecodeError:
435
+ raise ApiError(
436
+ status_code=_response.status_code,
437
+ headers=dict(_response.headers),
438
+ body=_response.text,
439
+ )
440
+ raise ApiError(
441
+ status_code=_response.status_code,
442
+ headers=dict(_response.headers),
443
+ body=_response_json,
444
+ )
445
+
446
+ def create_user(
447
+ self,
448
+ *,
449
+ user_name: str,
450
+ name: ScimName,
451
+ emails: typing.Optional[typing.Sequence[ScimEmail]] = OMIT,
452
+ active: typing.Optional[bool] = OMIT,
453
+ password: typing.Optional[str] = OMIT,
454
+ request_options: typing.Optional[RequestOptions] = None,
455
+ ) -> HttpResponse[ScimUser]:
456
+ """
457
+ Create a new user in the organization (requires organization-scoped API key)
458
+
459
+ Parameters
460
+ ----------
461
+ user_name : str
462
+ User's email address (required)
463
+
464
+ name : ScimName
465
+ User's name information
466
+
467
+ emails : typing.Optional[typing.Sequence[ScimEmail]]
468
+ User's email addresses
469
+
470
+ active : typing.Optional[bool]
471
+ Whether the user is active
472
+
473
+ password : typing.Optional[str]
474
+ Initial password for the user
475
+
476
+ request_options : typing.Optional[RequestOptions]
477
+ Request-specific configuration.
478
+
479
+ Returns
480
+ -------
481
+ HttpResponse[ScimUser]
482
+ """
483
+ _response = self._client_wrapper.httpx_client.request(
484
+ "api/public/scim/Users",
485
+ method="POST",
486
+ json={
487
+ "userName": user_name,
488
+ "name": convert_and_respect_annotation_metadata(
489
+ object_=name, annotation=ScimName, direction="write"
490
+ ),
491
+ "emails": convert_and_respect_annotation_metadata(
492
+ object_=emails,
493
+ annotation=typing.Sequence[ScimEmail],
494
+ direction="write",
495
+ ),
496
+ "active": active,
497
+ "password": password,
498
+ },
499
+ request_options=request_options,
500
+ omit=OMIT,
501
+ )
502
+ try:
503
+ if 200 <= _response.status_code < 300:
504
+ _data = typing.cast(
505
+ ScimUser,
506
+ parse_obj_as(
507
+ type_=ScimUser, # type: ignore
508
+ object_=_response.json(),
509
+ ),
510
+ )
511
+ return HttpResponse(response=_response, data=_data)
512
+ if _response.status_code == 400:
513
+ raise Error(
514
+ headers=dict(_response.headers),
515
+ body=typing.cast(
516
+ typing.Any,
517
+ parse_obj_as(
518
+ type_=typing.Any, # type: ignore
519
+ object_=_response.json(),
520
+ ),
521
+ ),
522
+ )
523
+ if _response.status_code == 401:
524
+ raise UnauthorizedError(
525
+ headers=dict(_response.headers),
526
+ body=typing.cast(
527
+ typing.Any,
528
+ parse_obj_as(
529
+ type_=typing.Any, # type: ignore
530
+ object_=_response.json(),
531
+ ),
532
+ ),
533
+ )
534
+ if _response.status_code == 403:
535
+ raise AccessDeniedError(
536
+ headers=dict(_response.headers),
537
+ body=typing.cast(
538
+ typing.Any,
539
+ parse_obj_as(
540
+ type_=typing.Any, # type: ignore
541
+ object_=_response.json(),
542
+ ),
543
+ ),
544
+ )
545
+ if _response.status_code == 405:
546
+ raise MethodNotAllowedError(
547
+ headers=dict(_response.headers),
548
+ body=typing.cast(
549
+ typing.Any,
550
+ parse_obj_as(
551
+ type_=typing.Any, # type: ignore
552
+ object_=_response.json(),
553
+ ),
554
+ ),
555
+ )
556
+ if _response.status_code == 404:
557
+ raise NotFoundError(
558
+ headers=dict(_response.headers),
559
+ body=typing.cast(
560
+ typing.Any,
561
+ parse_obj_as(
562
+ type_=typing.Any, # type: ignore
563
+ object_=_response.json(),
564
+ ),
565
+ ),
566
+ )
567
+ _response_json = _response.json()
568
+ except JSONDecodeError:
569
+ raise ApiError(
570
+ status_code=_response.status_code,
571
+ headers=dict(_response.headers),
572
+ body=_response.text,
573
+ )
574
+ raise ApiError(
575
+ status_code=_response.status_code,
576
+ headers=dict(_response.headers),
577
+ body=_response_json,
578
+ )
579
+
580
+ def get_user(
581
+ self, user_id: str, *, request_options: typing.Optional[RequestOptions] = None
582
+ ) -> HttpResponse[ScimUser]:
583
+ """
584
+ Get a specific user by ID (requires organization-scoped API key)
585
+
586
+ Parameters
587
+ ----------
588
+ user_id : str
589
+
590
+ request_options : typing.Optional[RequestOptions]
591
+ Request-specific configuration.
592
+
593
+ Returns
594
+ -------
595
+ HttpResponse[ScimUser]
596
+ """
597
+ _response = self._client_wrapper.httpx_client.request(
598
+ f"api/public/scim/Users/{jsonable_encoder(user_id)}",
599
+ method="GET",
600
+ request_options=request_options,
601
+ )
602
+ try:
603
+ if 200 <= _response.status_code < 300:
604
+ _data = typing.cast(
605
+ ScimUser,
606
+ parse_obj_as(
607
+ type_=ScimUser, # type: ignore
608
+ object_=_response.json(),
609
+ ),
610
+ )
611
+ return HttpResponse(response=_response, data=_data)
612
+ if _response.status_code == 400:
613
+ raise Error(
614
+ headers=dict(_response.headers),
615
+ body=typing.cast(
616
+ typing.Any,
617
+ parse_obj_as(
618
+ type_=typing.Any, # type: ignore
619
+ object_=_response.json(),
620
+ ),
621
+ ),
622
+ )
623
+ if _response.status_code == 401:
624
+ raise UnauthorizedError(
625
+ headers=dict(_response.headers),
626
+ body=typing.cast(
627
+ typing.Any,
628
+ parse_obj_as(
629
+ type_=typing.Any, # type: ignore
630
+ object_=_response.json(),
631
+ ),
632
+ ),
633
+ )
634
+ if _response.status_code == 403:
635
+ raise AccessDeniedError(
636
+ headers=dict(_response.headers),
637
+ body=typing.cast(
638
+ typing.Any,
639
+ parse_obj_as(
640
+ type_=typing.Any, # type: ignore
641
+ object_=_response.json(),
642
+ ),
643
+ ),
644
+ )
645
+ if _response.status_code == 405:
646
+ raise MethodNotAllowedError(
647
+ headers=dict(_response.headers),
648
+ body=typing.cast(
649
+ typing.Any,
650
+ parse_obj_as(
651
+ type_=typing.Any, # type: ignore
652
+ object_=_response.json(),
653
+ ),
654
+ ),
655
+ )
656
+ if _response.status_code == 404:
657
+ raise NotFoundError(
658
+ headers=dict(_response.headers),
659
+ body=typing.cast(
660
+ typing.Any,
661
+ parse_obj_as(
662
+ type_=typing.Any, # type: ignore
663
+ object_=_response.json(),
664
+ ),
665
+ ),
666
+ )
667
+ _response_json = _response.json()
668
+ except JSONDecodeError:
669
+ raise ApiError(
670
+ status_code=_response.status_code,
671
+ headers=dict(_response.headers),
672
+ body=_response.text,
673
+ )
674
+ raise ApiError(
675
+ status_code=_response.status_code,
676
+ headers=dict(_response.headers),
677
+ body=_response_json,
678
+ )
679
+
680
+ def delete_user(
681
+ self, user_id: str, *, request_options: typing.Optional[RequestOptions] = None
682
+ ) -> HttpResponse[EmptyResponse]:
683
+ """
684
+ Remove a user from the organization (requires organization-scoped API key). Note that this only removes the user from the organization but does not delete the user entity itself.
685
+
686
+ Parameters
687
+ ----------
688
+ user_id : str
689
+
690
+ request_options : typing.Optional[RequestOptions]
691
+ Request-specific configuration.
692
+
693
+ Returns
694
+ -------
695
+ HttpResponse[EmptyResponse]
696
+ """
697
+ _response = self._client_wrapper.httpx_client.request(
698
+ f"api/public/scim/Users/{jsonable_encoder(user_id)}",
699
+ method="DELETE",
700
+ request_options=request_options,
701
+ )
702
+ try:
703
+ if 200 <= _response.status_code < 300:
704
+ _data = typing.cast(
705
+ EmptyResponse,
706
+ parse_obj_as(
707
+ type_=EmptyResponse, # type: ignore
708
+ object_=_response.json(),
709
+ ),
710
+ )
711
+ return HttpResponse(response=_response, data=_data)
712
+ if _response.status_code == 400:
713
+ raise Error(
714
+ headers=dict(_response.headers),
715
+ body=typing.cast(
716
+ typing.Any,
717
+ parse_obj_as(
718
+ type_=typing.Any, # type: ignore
719
+ object_=_response.json(),
720
+ ),
721
+ ),
722
+ )
723
+ if _response.status_code == 401:
724
+ raise UnauthorizedError(
725
+ headers=dict(_response.headers),
726
+ body=typing.cast(
727
+ typing.Any,
728
+ parse_obj_as(
729
+ type_=typing.Any, # type: ignore
730
+ object_=_response.json(),
731
+ ),
732
+ ),
733
+ )
734
+ if _response.status_code == 403:
735
+ raise AccessDeniedError(
736
+ headers=dict(_response.headers),
737
+ body=typing.cast(
738
+ typing.Any,
739
+ parse_obj_as(
740
+ type_=typing.Any, # type: ignore
741
+ object_=_response.json(),
742
+ ),
743
+ ),
744
+ )
745
+ if _response.status_code == 405:
746
+ raise MethodNotAllowedError(
747
+ headers=dict(_response.headers),
748
+ body=typing.cast(
749
+ typing.Any,
750
+ parse_obj_as(
751
+ type_=typing.Any, # type: ignore
752
+ object_=_response.json(),
753
+ ),
754
+ ),
755
+ )
756
+ if _response.status_code == 404:
757
+ raise NotFoundError(
758
+ headers=dict(_response.headers),
759
+ body=typing.cast(
760
+ typing.Any,
761
+ parse_obj_as(
762
+ type_=typing.Any, # type: ignore
763
+ object_=_response.json(),
764
+ ),
765
+ ),
766
+ )
767
+ _response_json = _response.json()
768
+ except JSONDecodeError:
769
+ raise ApiError(
770
+ status_code=_response.status_code,
771
+ headers=dict(_response.headers),
772
+ body=_response.text,
773
+ )
774
+ raise ApiError(
775
+ status_code=_response.status_code,
776
+ headers=dict(_response.headers),
777
+ body=_response_json,
778
+ )
779
+
780
+
781
+ class AsyncRawScimClient:
782
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
783
+ self._client_wrapper = client_wrapper
784
+
785
+ async def get_service_provider_config(
786
+ self, *, request_options: typing.Optional[RequestOptions] = None
787
+ ) -> AsyncHttpResponse[ServiceProviderConfig]:
788
+ """
789
+ Get SCIM Service Provider Configuration (requires organization-scoped API key)
790
+
791
+ Parameters
792
+ ----------
793
+ request_options : typing.Optional[RequestOptions]
794
+ Request-specific configuration.
795
+
796
+ Returns
797
+ -------
798
+ AsyncHttpResponse[ServiceProviderConfig]
799
+ """
800
+ _response = await self._client_wrapper.httpx_client.request(
801
+ "api/public/scim/ServiceProviderConfig",
802
+ method="GET",
803
+ request_options=request_options,
804
+ )
805
+ try:
806
+ if 200 <= _response.status_code < 300:
807
+ _data = typing.cast(
808
+ ServiceProviderConfig,
809
+ parse_obj_as(
810
+ type_=ServiceProviderConfig, # type: ignore
811
+ object_=_response.json(),
812
+ ),
813
+ )
814
+ return AsyncHttpResponse(response=_response, data=_data)
815
+ if _response.status_code == 400:
816
+ raise Error(
817
+ headers=dict(_response.headers),
818
+ body=typing.cast(
819
+ typing.Any,
820
+ parse_obj_as(
821
+ type_=typing.Any, # type: ignore
822
+ object_=_response.json(),
823
+ ),
824
+ ),
825
+ )
826
+ if _response.status_code == 401:
827
+ raise UnauthorizedError(
828
+ headers=dict(_response.headers),
829
+ body=typing.cast(
830
+ typing.Any,
831
+ parse_obj_as(
832
+ type_=typing.Any, # type: ignore
833
+ object_=_response.json(),
834
+ ),
835
+ ),
836
+ )
837
+ if _response.status_code == 403:
838
+ raise AccessDeniedError(
839
+ headers=dict(_response.headers),
840
+ body=typing.cast(
841
+ typing.Any,
842
+ parse_obj_as(
843
+ type_=typing.Any, # type: ignore
844
+ object_=_response.json(),
845
+ ),
846
+ ),
847
+ )
848
+ if _response.status_code == 405:
849
+ raise MethodNotAllowedError(
850
+ headers=dict(_response.headers),
851
+ body=typing.cast(
852
+ typing.Any,
853
+ parse_obj_as(
854
+ type_=typing.Any, # type: ignore
855
+ object_=_response.json(),
856
+ ),
857
+ ),
858
+ )
859
+ if _response.status_code == 404:
860
+ raise NotFoundError(
861
+ headers=dict(_response.headers),
862
+ body=typing.cast(
863
+ typing.Any,
864
+ parse_obj_as(
865
+ type_=typing.Any, # type: ignore
866
+ object_=_response.json(),
867
+ ),
868
+ ),
869
+ )
870
+ _response_json = _response.json()
871
+ except JSONDecodeError:
872
+ raise ApiError(
873
+ status_code=_response.status_code,
874
+ headers=dict(_response.headers),
875
+ body=_response.text,
876
+ )
877
+ raise ApiError(
878
+ status_code=_response.status_code,
879
+ headers=dict(_response.headers),
880
+ body=_response_json,
881
+ )
882
+
883
+ async def get_resource_types(
884
+ self, *, request_options: typing.Optional[RequestOptions] = None
885
+ ) -> AsyncHttpResponse[ResourceTypesResponse]:
886
+ """
887
+ Get SCIM Resource Types (requires organization-scoped API key)
888
+
889
+ Parameters
890
+ ----------
891
+ request_options : typing.Optional[RequestOptions]
892
+ Request-specific configuration.
893
+
894
+ Returns
895
+ -------
896
+ AsyncHttpResponse[ResourceTypesResponse]
897
+ """
898
+ _response = await self._client_wrapper.httpx_client.request(
899
+ "api/public/scim/ResourceTypes",
900
+ method="GET",
901
+ request_options=request_options,
902
+ )
903
+ try:
904
+ if 200 <= _response.status_code < 300:
905
+ _data = typing.cast(
906
+ ResourceTypesResponse,
907
+ parse_obj_as(
908
+ type_=ResourceTypesResponse, # type: ignore
909
+ object_=_response.json(),
910
+ ),
911
+ )
912
+ return AsyncHttpResponse(response=_response, data=_data)
913
+ if _response.status_code == 400:
914
+ raise Error(
915
+ headers=dict(_response.headers),
916
+ body=typing.cast(
917
+ typing.Any,
918
+ parse_obj_as(
919
+ type_=typing.Any, # type: ignore
920
+ object_=_response.json(),
921
+ ),
922
+ ),
923
+ )
924
+ if _response.status_code == 401:
925
+ raise UnauthorizedError(
926
+ headers=dict(_response.headers),
927
+ body=typing.cast(
928
+ typing.Any,
929
+ parse_obj_as(
930
+ type_=typing.Any, # type: ignore
931
+ object_=_response.json(),
932
+ ),
933
+ ),
934
+ )
935
+ if _response.status_code == 403:
936
+ raise AccessDeniedError(
937
+ headers=dict(_response.headers),
938
+ body=typing.cast(
939
+ typing.Any,
940
+ parse_obj_as(
941
+ type_=typing.Any, # type: ignore
942
+ object_=_response.json(),
943
+ ),
944
+ ),
945
+ )
946
+ if _response.status_code == 405:
947
+ raise MethodNotAllowedError(
948
+ headers=dict(_response.headers),
949
+ body=typing.cast(
950
+ typing.Any,
951
+ parse_obj_as(
952
+ type_=typing.Any, # type: ignore
953
+ object_=_response.json(),
954
+ ),
955
+ ),
956
+ )
957
+ if _response.status_code == 404:
958
+ raise NotFoundError(
959
+ headers=dict(_response.headers),
960
+ body=typing.cast(
961
+ typing.Any,
962
+ parse_obj_as(
963
+ type_=typing.Any, # type: ignore
964
+ object_=_response.json(),
965
+ ),
966
+ ),
967
+ )
968
+ _response_json = _response.json()
969
+ except JSONDecodeError:
970
+ raise ApiError(
971
+ status_code=_response.status_code,
972
+ headers=dict(_response.headers),
973
+ body=_response.text,
974
+ )
975
+ raise ApiError(
976
+ status_code=_response.status_code,
977
+ headers=dict(_response.headers),
978
+ body=_response_json,
979
+ )
980
+
981
+ async def get_schemas(
982
+ self, *, request_options: typing.Optional[RequestOptions] = None
983
+ ) -> AsyncHttpResponse[SchemasResponse]:
984
+ """
985
+ Get SCIM Schemas (requires organization-scoped API key)
986
+
987
+ Parameters
988
+ ----------
989
+ request_options : typing.Optional[RequestOptions]
990
+ Request-specific configuration.
991
+
992
+ Returns
993
+ -------
994
+ AsyncHttpResponse[SchemasResponse]
995
+ """
996
+ _response = await self._client_wrapper.httpx_client.request(
997
+ "api/public/scim/Schemas",
998
+ method="GET",
999
+ request_options=request_options,
1000
+ )
1001
+ try:
1002
+ if 200 <= _response.status_code < 300:
1003
+ _data = typing.cast(
1004
+ SchemasResponse,
1005
+ parse_obj_as(
1006
+ type_=SchemasResponse, # type: ignore
1007
+ object_=_response.json(),
1008
+ ),
1009
+ )
1010
+ return AsyncHttpResponse(response=_response, data=_data)
1011
+ if _response.status_code == 400:
1012
+ raise Error(
1013
+ headers=dict(_response.headers),
1014
+ body=typing.cast(
1015
+ typing.Any,
1016
+ parse_obj_as(
1017
+ type_=typing.Any, # type: ignore
1018
+ object_=_response.json(),
1019
+ ),
1020
+ ),
1021
+ )
1022
+ if _response.status_code == 401:
1023
+ raise UnauthorizedError(
1024
+ headers=dict(_response.headers),
1025
+ body=typing.cast(
1026
+ typing.Any,
1027
+ parse_obj_as(
1028
+ type_=typing.Any, # type: ignore
1029
+ object_=_response.json(),
1030
+ ),
1031
+ ),
1032
+ )
1033
+ if _response.status_code == 403:
1034
+ raise AccessDeniedError(
1035
+ headers=dict(_response.headers),
1036
+ body=typing.cast(
1037
+ typing.Any,
1038
+ parse_obj_as(
1039
+ type_=typing.Any, # type: ignore
1040
+ object_=_response.json(),
1041
+ ),
1042
+ ),
1043
+ )
1044
+ if _response.status_code == 405:
1045
+ raise MethodNotAllowedError(
1046
+ headers=dict(_response.headers),
1047
+ body=typing.cast(
1048
+ typing.Any,
1049
+ parse_obj_as(
1050
+ type_=typing.Any, # type: ignore
1051
+ object_=_response.json(),
1052
+ ),
1053
+ ),
1054
+ )
1055
+ if _response.status_code == 404:
1056
+ raise NotFoundError(
1057
+ headers=dict(_response.headers),
1058
+ body=typing.cast(
1059
+ typing.Any,
1060
+ parse_obj_as(
1061
+ type_=typing.Any, # type: ignore
1062
+ object_=_response.json(),
1063
+ ),
1064
+ ),
1065
+ )
1066
+ _response_json = _response.json()
1067
+ except JSONDecodeError:
1068
+ raise ApiError(
1069
+ status_code=_response.status_code,
1070
+ headers=dict(_response.headers),
1071
+ body=_response.text,
1072
+ )
1073
+ raise ApiError(
1074
+ status_code=_response.status_code,
1075
+ headers=dict(_response.headers),
1076
+ body=_response_json,
1077
+ )
1078
+
1079
+ async def list_users(
1080
+ self,
1081
+ *,
1082
+ filter: typing.Optional[str] = None,
1083
+ start_index: typing.Optional[int] = None,
1084
+ count: typing.Optional[int] = None,
1085
+ request_options: typing.Optional[RequestOptions] = None,
1086
+ ) -> AsyncHttpResponse[ScimUsersListResponse]:
1087
+ """
1088
+ List users in the organization (requires organization-scoped API key)
1089
+
1090
+ Parameters
1091
+ ----------
1092
+ filter : typing.Optional[str]
1093
+ Filter expression (e.g. userName eq "value")
1094
+
1095
+ start_index : typing.Optional[int]
1096
+ 1-based index of the first result to return (default 1)
1097
+
1098
+ count : typing.Optional[int]
1099
+ Maximum number of results to return (default 100)
1100
+
1101
+ request_options : typing.Optional[RequestOptions]
1102
+ Request-specific configuration.
1103
+
1104
+ Returns
1105
+ -------
1106
+ AsyncHttpResponse[ScimUsersListResponse]
1107
+ """
1108
+ _response = await self._client_wrapper.httpx_client.request(
1109
+ "api/public/scim/Users",
1110
+ method="GET",
1111
+ params={
1112
+ "filter": filter,
1113
+ "startIndex": start_index,
1114
+ "count": count,
1115
+ },
1116
+ request_options=request_options,
1117
+ )
1118
+ try:
1119
+ if 200 <= _response.status_code < 300:
1120
+ _data = typing.cast(
1121
+ ScimUsersListResponse,
1122
+ parse_obj_as(
1123
+ type_=ScimUsersListResponse, # type: ignore
1124
+ object_=_response.json(),
1125
+ ),
1126
+ )
1127
+ return AsyncHttpResponse(response=_response, data=_data)
1128
+ if _response.status_code == 400:
1129
+ raise Error(
1130
+ headers=dict(_response.headers),
1131
+ body=typing.cast(
1132
+ typing.Any,
1133
+ parse_obj_as(
1134
+ type_=typing.Any, # type: ignore
1135
+ object_=_response.json(),
1136
+ ),
1137
+ ),
1138
+ )
1139
+ if _response.status_code == 401:
1140
+ raise UnauthorizedError(
1141
+ headers=dict(_response.headers),
1142
+ body=typing.cast(
1143
+ typing.Any,
1144
+ parse_obj_as(
1145
+ type_=typing.Any, # type: ignore
1146
+ object_=_response.json(),
1147
+ ),
1148
+ ),
1149
+ )
1150
+ if _response.status_code == 403:
1151
+ raise AccessDeniedError(
1152
+ headers=dict(_response.headers),
1153
+ body=typing.cast(
1154
+ typing.Any,
1155
+ parse_obj_as(
1156
+ type_=typing.Any, # type: ignore
1157
+ object_=_response.json(),
1158
+ ),
1159
+ ),
1160
+ )
1161
+ if _response.status_code == 405:
1162
+ raise MethodNotAllowedError(
1163
+ headers=dict(_response.headers),
1164
+ body=typing.cast(
1165
+ typing.Any,
1166
+ parse_obj_as(
1167
+ type_=typing.Any, # type: ignore
1168
+ object_=_response.json(),
1169
+ ),
1170
+ ),
1171
+ )
1172
+ if _response.status_code == 404:
1173
+ raise NotFoundError(
1174
+ headers=dict(_response.headers),
1175
+ body=typing.cast(
1176
+ typing.Any,
1177
+ parse_obj_as(
1178
+ type_=typing.Any, # type: ignore
1179
+ object_=_response.json(),
1180
+ ),
1181
+ ),
1182
+ )
1183
+ _response_json = _response.json()
1184
+ except JSONDecodeError:
1185
+ raise ApiError(
1186
+ status_code=_response.status_code,
1187
+ headers=dict(_response.headers),
1188
+ body=_response.text,
1189
+ )
1190
+ raise ApiError(
1191
+ status_code=_response.status_code,
1192
+ headers=dict(_response.headers),
1193
+ body=_response_json,
1194
+ )
1195
+
1196
+ async def create_user(
1197
+ self,
1198
+ *,
1199
+ user_name: str,
1200
+ name: ScimName,
1201
+ emails: typing.Optional[typing.Sequence[ScimEmail]] = OMIT,
1202
+ active: typing.Optional[bool] = OMIT,
1203
+ password: typing.Optional[str] = OMIT,
1204
+ request_options: typing.Optional[RequestOptions] = None,
1205
+ ) -> AsyncHttpResponse[ScimUser]:
1206
+ """
1207
+ Create a new user in the organization (requires organization-scoped API key)
1208
+
1209
+ Parameters
1210
+ ----------
1211
+ user_name : str
1212
+ User's email address (required)
1213
+
1214
+ name : ScimName
1215
+ User's name information
1216
+
1217
+ emails : typing.Optional[typing.Sequence[ScimEmail]]
1218
+ User's email addresses
1219
+
1220
+ active : typing.Optional[bool]
1221
+ Whether the user is active
1222
+
1223
+ password : typing.Optional[str]
1224
+ Initial password for the user
1225
+
1226
+ request_options : typing.Optional[RequestOptions]
1227
+ Request-specific configuration.
1228
+
1229
+ Returns
1230
+ -------
1231
+ AsyncHttpResponse[ScimUser]
1232
+ """
1233
+ _response = await self._client_wrapper.httpx_client.request(
1234
+ "api/public/scim/Users",
1235
+ method="POST",
1236
+ json={
1237
+ "userName": user_name,
1238
+ "name": convert_and_respect_annotation_metadata(
1239
+ object_=name, annotation=ScimName, direction="write"
1240
+ ),
1241
+ "emails": convert_and_respect_annotation_metadata(
1242
+ object_=emails,
1243
+ annotation=typing.Sequence[ScimEmail],
1244
+ direction="write",
1245
+ ),
1246
+ "active": active,
1247
+ "password": password,
1248
+ },
1249
+ request_options=request_options,
1250
+ omit=OMIT,
1251
+ )
1252
+ try:
1253
+ if 200 <= _response.status_code < 300:
1254
+ _data = typing.cast(
1255
+ ScimUser,
1256
+ parse_obj_as(
1257
+ type_=ScimUser, # type: ignore
1258
+ object_=_response.json(),
1259
+ ),
1260
+ )
1261
+ return AsyncHttpResponse(response=_response, data=_data)
1262
+ if _response.status_code == 400:
1263
+ raise Error(
1264
+ headers=dict(_response.headers),
1265
+ body=typing.cast(
1266
+ typing.Any,
1267
+ parse_obj_as(
1268
+ type_=typing.Any, # type: ignore
1269
+ object_=_response.json(),
1270
+ ),
1271
+ ),
1272
+ )
1273
+ if _response.status_code == 401:
1274
+ raise UnauthorizedError(
1275
+ headers=dict(_response.headers),
1276
+ body=typing.cast(
1277
+ typing.Any,
1278
+ parse_obj_as(
1279
+ type_=typing.Any, # type: ignore
1280
+ object_=_response.json(),
1281
+ ),
1282
+ ),
1283
+ )
1284
+ if _response.status_code == 403:
1285
+ raise AccessDeniedError(
1286
+ headers=dict(_response.headers),
1287
+ body=typing.cast(
1288
+ typing.Any,
1289
+ parse_obj_as(
1290
+ type_=typing.Any, # type: ignore
1291
+ object_=_response.json(),
1292
+ ),
1293
+ ),
1294
+ )
1295
+ if _response.status_code == 405:
1296
+ raise MethodNotAllowedError(
1297
+ headers=dict(_response.headers),
1298
+ body=typing.cast(
1299
+ typing.Any,
1300
+ parse_obj_as(
1301
+ type_=typing.Any, # type: ignore
1302
+ object_=_response.json(),
1303
+ ),
1304
+ ),
1305
+ )
1306
+ if _response.status_code == 404:
1307
+ raise NotFoundError(
1308
+ headers=dict(_response.headers),
1309
+ body=typing.cast(
1310
+ typing.Any,
1311
+ parse_obj_as(
1312
+ type_=typing.Any, # type: ignore
1313
+ object_=_response.json(),
1314
+ ),
1315
+ ),
1316
+ )
1317
+ _response_json = _response.json()
1318
+ except JSONDecodeError:
1319
+ raise ApiError(
1320
+ status_code=_response.status_code,
1321
+ headers=dict(_response.headers),
1322
+ body=_response.text,
1323
+ )
1324
+ raise ApiError(
1325
+ status_code=_response.status_code,
1326
+ headers=dict(_response.headers),
1327
+ body=_response_json,
1328
+ )
1329
+
1330
+ async def get_user(
1331
+ self, user_id: str, *, request_options: typing.Optional[RequestOptions] = None
1332
+ ) -> AsyncHttpResponse[ScimUser]:
1333
+ """
1334
+ Get a specific user by ID (requires organization-scoped API key)
1335
+
1336
+ Parameters
1337
+ ----------
1338
+ user_id : str
1339
+
1340
+ request_options : typing.Optional[RequestOptions]
1341
+ Request-specific configuration.
1342
+
1343
+ Returns
1344
+ -------
1345
+ AsyncHttpResponse[ScimUser]
1346
+ """
1347
+ _response = await self._client_wrapper.httpx_client.request(
1348
+ f"api/public/scim/Users/{jsonable_encoder(user_id)}",
1349
+ method="GET",
1350
+ request_options=request_options,
1351
+ )
1352
+ try:
1353
+ if 200 <= _response.status_code < 300:
1354
+ _data = typing.cast(
1355
+ ScimUser,
1356
+ parse_obj_as(
1357
+ type_=ScimUser, # type: ignore
1358
+ object_=_response.json(),
1359
+ ),
1360
+ )
1361
+ return AsyncHttpResponse(response=_response, data=_data)
1362
+ if _response.status_code == 400:
1363
+ raise Error(
1364
+ headers=dict(_response.headers),
1365
+ body=typing.cast(
1366
+ typing.Any,
1367
+ parse_obj_as(
1368
+ type_=typing.Any, # type: ignore
1369
+ object_=_response.json(),
1370
+ ),
1371
+ ),
1372
+ )
1373
+ if _response.status_code == 401:
1374
+ raise UnauthorizedError(
1375
+ headers=dict(_response.headers),
1376
+ body=typing.cast(
1377
+ typing.Any,
1378
+ parse_obj_as(
1379
+ type_=typing.Any, # type: ignore
1380
+ object_=_response.json(),
1381
+ ),
1382
+ ),
1383
+ )
1384
+ if _response.status_code == 403:
1385
+ raise AccessDeniedError(
1386
+ headers=dict(_response.headers),
1387
+ body=typing.cast(
1388
+ typing.Any,
1389
+ parse_obj_as(
1390
+ type_=typing.Any, # type: ignore
1391
+ object_=_response.json(),
1392
+ ),
1393
+ ),
1394
+ )
1395
+ if _response.status_code == 405:
1396
+ raise MethodNotAllowedError(
1397
+ headers=dict(_response.headers),
1398
+ body=typing.cast(
1399
+ typing.Any,
1400
+ parse_obj_as(
1401
+ type_=typing.Any, # type: ignore
1402
+ object_=_response.json(),
1403
+ ),
1404
+ ),
1405
+ )
1406
+ if _response.status_code == 404:
1407
+ raise NotFoundError(
1408
+ headers=dict(_response.headers),
1409
+ body=typing.cast(
1410
+ typing.Any,
1411
+ parse_obj_as(
1412
+ type_=typing.Any, # type: ignore
1413
+ object_=_response.json(),
1414
+ ),
1415
+ ),
1416
+ )
1417
+ _response_json = _response.json()
1418
+ except JSONDecodeError:
1419
+ raise ApiError(
1420
+ status_code=_response.status_code,
1421
+ headers=dict(_response.headers),
1422
+ body=_response.text,
1423
+ )
1424
+ raise ApiError(
1425
+ status_code=_response.status_code,
1426
+ headers=dict(_response.headers),
1427
+ body=_response_json,
1428
+ )
1429
+
1430
+ async def delete_user(
1431
+ self, user_id: str, *, request_options: typing.Optional[RequestOptions] = None
1432
+ ) -> AsyncHttpResponse[EmptyResponse]:
1433
+ """
1434
+ Remove a user from the organization (requires organization-scoped API key). Note that this only removes the user from the organization but does not delete the user entity itself.
1435
+
1436
+ Parameters
1437
+ ----------
1438
+ user_id : str
1439
+
1440
+ request_options : typing.Optional[RequestOptions]
1441
+ Request-specific configuration.
1442
+
1443
+ Returns
1444
+ -------
1445
+ AsyncHttpResponse[EmptyResponse]
1446
+ """
1447
+ _response = await self._client_wrapper.httpx_client.request(
1448
+ f"api/public/scim/Users/{jsonable_encoder(user_id)}",
1449
+ method="DELETE",
1450
+ request_options=request_options,
1451
+ )
1452
+ try:
1453
+ if 200 <= _response.status_code < 300:
1454
+ _data = typing.cast(
1455
+ EmptyResponse,
1456
+ parse_obj_as(
1457
+ type_=EmptyResponse, # type: ignore
1458
+ object_=_response.json(),
1459
+ ),
1460
+ )
1461
+ return AsyncHttpResponse(response=_response, data=_data)
1462
+ if _response.status_code == 400:
1463
+ raise Error(
1464
+ headers=dict(_response.headers),
1465
+ body=typing.cast(
1466
+ typing.Any,
1467
+ parse_obj_as(
1468
+ type_=typing.Any, # type: ignore
1469
+ object_=_response.json(),
1470
+ ),
1471
+ ),
1472
+ )
1473
+ if _response.status_code == 401:
1474
+ raise UnauthorizedError(
1475
+ headers=dict(_response.headers),
1476
+ body=typing.cast(
1477
+ typing.Any,
1478
+ parse_obj_as(
1479
+ type_=typing.Any, # type: ignore
1480
+ object_=_response.json(),
1481
+ ),
1482
+ ),
1483
+ )
1484
+ if _response.status_code == 403:
1485
+ raise AccessDeniedError(
1486
+ headers=dict(_response.headers),
1487
+ body=typing.cast(
1488
+ typing.Any,
1489
+ parse_obj_as(
1490
+ type_=typing.Any, # type: ignore
1491
+ object_=_response.json(),
1492
+ ),
1493
+ ),
1494
+ )
1495
+ if _response.status_code == 405:
1496
+ raise MethodNotAllowedError(
1497
+ headers=dict(_response.headers),
1498
+ body=typing.cast(
1499
+ typing.Any,
1500
+ parse_obj_as(
1501
+ type_=typing.Any, # type: ignore
1502
+ object_=_response.json(),
1503
+ ),
1504
+ ),
1505
+ )
1506
+ if _response.status_code == 404:
1507
+ raise NotFoundError(
1508
+ headers=dict(_response.headers),
1509
+ body=typing.cast(
1510
+ typing.Any,
1511
+ parse_obj_as(
1512
+ type_=typing.Any, # type: ignore
1513
+ object_=_response.json(),
1514
+ ),
1515
+ ),
1516
+ )
1517
+ _response_json = _response.json()
1518
+ except JSONDecodeError:
1519
+ raise ApiError(
1520
+ status_code=_response.status_code,
1521
+ headers=dict(_response.headers),
1522
+ body=_response.text,
1523
+ )
1524
+ raise ApiError(
1525
+ status_code=_response.status_code,
1526
+ headers=dict(_response.headers),
1527
+ body=_response_json,
1528
+ )