mirascope 2.0.0__py3-none-any.whl → 2.0.0a1__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 (443) hide show
  1. mirascope/__init__.py +2 -11
  2. mirascope/graphs/__init__.py +22 -0
  3. mirascope/graphs/finite_state_machine.py +625 -0
  4. mirascope/llm/__init__.py +15 -96
  5. mirascope/llm/agents/__init__.py +15 -0
  6. mirascope/llm/agents/agent.py +97 -0
  7. mirascope/llm/agents/agent_template.py +45 -0
  8. mirascope/llm/agents/decorator.py +176 -0
  9. mirascope/llm/calls/__init__.py +1 -2
  10. mirascope/llm/calls/base_call.py +33 -0
  11. mirascope/llm/calls/calls.py +58 -84
  12. mirascope/llm/calls/decorator.py +120 -140
  13. mirascope/llm/clients/__init__.py +34 -0
  14. mirascope/llm/clients/_missing_import_stubs.py +47 -0
  15. mirascope/llm/clients/anthropic/__init__.py +25 -0
  16. mirascope/llm/{providers/openai/completions → clients/anthropic}/_utils/__init__.py +0 -2
  17. mirascope/llm/{providers → clients}/anthropic/_utils/decode.py +22 -66
  18. mirascope/llm/clients/anthropic/_utils/encode.py +243 -0
  19. mirascope/llm/clients/anthropic/clients.py +819 -0
  20. mirascope/llm/clients/anthropic/model_ids.py +8 -0
  21. mirascope/llm/{providers → clients}/base/__init__.py +5 -4
  22. mirascope/llm/{providers → clients}/base/_utils.py +17 -78
  23. mirascope/llm/{providers/base/base_provider.py → clients/base/client.py} +145 -468
  24. mirascope/llm/{models → clients/base}/params.py +37 -16
  25. mirascope/llm/clients/google/__init__.py +20 -0
  26. mirascope/llm/{providers/openai/responses → clients/google}/_utils/__init__.py +0 -2
  27. mirascope/llm/{providers → clients}/google/_utils/decode.py +22 -98
  28. mirascope/llm/{providers → clients}/google/_utils/encode.py +46 -168
  29. mirascope/llm/clients/google/clients.py +853 -0
  30. mirascope/llm/clients/google/model_ids.py +15 -0
  31. mirascope/llm/clients/openai/__init__.py +25 -0
  32. mirascope/llm/clients/openai/completions/__init__.py +28 -0
  33. mirascope/llm/{providers/google → clients/openai/completions}/_utils/__init__.py +0 -4
  34. mirascope/llm/{providers → clients}/openai/completions/_utils/decode.py +9 -74
  35. mirascope/llm/{providers → clients}/openai/completions/_utils/encode.py +52 -70
  36. mirascope/llm/clients/openai/completions/_utils/model_features.py +81 -0
  37. mirascope/llm/clients/openai/completions/clients.py +833 -0
  38. mirascope/llm/clients/openai/completions/model_ids.py +8 -0
  39. mirascope/llm/clients/openai/responses/__init__.py +26 -0
  40. mirascope/llm/clients/openai/responses/_utils/__init__.py +13 -0
  41. mirascope/llm/{providers → clients}/openai/responses/_utils/decode.py +14 -80
  42. mirascope/llm/{providers → clients}/openai/responses/_utils/encode.py +41 -92
  43. mirascope/llm/clients/openai/responses/_utils/model_features.py +87 -0
  44. mirascope/llm/clients/openai/responses/clients.py +832 -0
  45. mirascope/llm/clients/openai/responses/model_ids.py +8 -0
  46. mirascope/llm/clients/openai/shared/__init__.py +7 -0
  47. mirascope/llm/clients/openai/shared/_utils.py +55 -0
  48. mirascope/llm/clients/providers.py +175 -0
  49. mirascope/llm/content/__init__.py +2 -3
  50. mirascope/llm/content/tool_call.py +0 -6
  51. mirascope/llm/content/tool_output.py +5 -22
  52. mirascope/llm/context/_utils.py +6 -19
  53. mirascope/llm/exceptions.py +43 -298
  54. mirascope/llm/formatting/__init__.py +2 -19
  55. mirascope/llm/formatting/_utils.py +74 -0
  56. mirascope/llm/formatting/format.py +30 -219
  57. mirascope/llm/formatting/from_call_args.py +2 -2
  58. mirascope/llm/formatting/partial.py +7 -80
  59. mirascope/llm/formatting/types.py +64 -21
  60. mirascope/llm/mcp/__init__.py +2 -2
  61. mirascope/llm/mcp/client.py +118 -0
  62. mirascope/llm/messages/__init__.py +0 -3
  63. mirascope/llm/messages/message.py +5 -13
  64. mirascope/llm/models/__init__.py +2 -7
  65. mirascope/llm/models/models.py +139 -315
  66. mirascope/llm/prompts/__init__.py +12 -13
  67. mirascope/llm/prompts/_utils.py +43 -14
  68. mirascope/llm/prompts/decorator.py +204 -144
  69. mirascope/llm/prompts/protocols.py +59 -25
  70. mirascope/llm/responses/__init__.py +1 -9
  71. mirascope/llm/responses/_utils.py +12 -102
  72. mirascope/llm/responses/base_response.py +6 -18
  73. mirascope/llm/responses/base_stream_response.py +50 -173
  74. mirascope/llm/responses/finish_reason.py +0 -1
  75. mirascope/llm/responses/response.py +13 -34
  76. mirascope/llm/responses/root_response.py +29 -100
  77. mirascope/llm/responses/stream_response.py +31 -40
  78. mirascope/llm/tools/__init__.py +2 -9
  79. mirascope/llm/tools/_utils.py +3 -12
  80. mirascope/llm/tools/decorator.py +16 -25
  81. mirascope/llm/tools/protocols.py +4 -4
  82. mirascope/llm/tools/tool_schema.py +19 -87
  83. mirascope/llm/tools/toolkit.py +27 -35
  84. mirascope/llm/tools/tools.py +41 -135
  85. {mirascope-2.0.0.dist-info → mirascope-2.0.0a1.dist-info}/METADATA +13 -90
  86. mirascope-2.0.0a1.dist-info/RECORD +102 -0
  87. {mirascope-2.0.0.dist-info → mirascope-2.0.0a1.dist-info}/WHEEL +1 -1
  88. {mirascope-2.0.0.dist-info → mirascope-2.0.0a1.dist-info}/licenses/LICENSE +1 -1
  89. mirascope/_stubs.py +0 -363
  90. mirascope/api/__init__.py +0 -14
  91. mirascope/api/_generated/README.md +0 -207
  92. mirascope/api/_generated/__init__.py +0 -440
  93. mirascope/api/_generated/annotations/__init__.py +0 -33
  94. mirascope/api/_generated/annotations/client.py +0 -506
  95. mirascope/api/_generated/annotations/raw_client.py +0 -1414
  96. mirascope/api/_generated/annotations/types/__init__.py +0 -31
  97. mirascope/api/_generated/annotations/types/annotations_create_request_label.py +0 -5
  98. mirascope/api/_generated/annotations/types/annotations_create_response.py +0 -48
  99. mirascope/api/_generated/annotations/types/annotations_create_response_label.py +0 -5
  100. mirascope/api/_generated/annotations/types/annotations_get_response.py +0 -48
  101. mirascope/api/_generated/annotations/types/annotations_get_response_label.py +0 -5
  102. mirascope/api/_generated/annotations/types/annotations_list_request_label.py +0 -5
  103. mirascope/api/_generated/annotations/types/annotations_list_response.py +0 -21
  104. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item.py +0 -50
  105. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item_label.py +0 -5
  106. mirascope/api/_generated/annotations/types/annotations_update_request_label.py +0 -5
  107. mirascope/api/_generated/annotations/types/annotations_update_response.py +0 -48
  108. mirascope/api/_generated/annotations/types/annotations_update_response_label.py +0 -5
  109. mirascope/api/_generated/api_keys/__init__.py +0 -17
  110. mirascope/api/_generated/api_keys/client.py +0 -530
  111. mirascope/api/_generated/api_keys/raw_client.py +0 -1236
  112. mirascope/api/_generated/api_keys/types/__init__.py +0 -15
  113. mirascope/api/_generated/api_keys/types/api_keys_create_response.py +0 -28
  114. mirascope/api/_generated/api_keys/types/api_keys_get_response.py +0 -27
  115. mirascope/api/_generated/api_keys/types/api_keys_list_all_for_org_response_item.py +0 -40
  116. mirascope/api/_generated/api_keys/types/api_keys_list_response_item.py +0 -27
  117. mirascope/api/_generated/client.py +0 -211
  118. mirascope/api/_generated/core/__init__.py +0 -52
  119. mirascope/api/_generated/core/api_error.py +0 -23
  120. mirascope/api/_generated/core/client_wrapper.py +0 -46
  121. mirascope/api/_generated/core/datetime_utils.py +0 -28
  122. mirascope/api/_generated/core/file.py +0 -67
  123. mirascope/api/_generated/core/force_multipart.py +0 -16
  124. mirascope/api/_generated/core/http_client.py +0 -543
  125. mirascope/api/_generated/core/http_response.py +0 -55
  126. mirascope/api/_generated/core/jsonable_encoder.py +0 -100
  127. mirascope/api/_generated/core/pydantic_utilities.py +0 -255
  128. mirascope/api/_generated/core/query_encoder.py +0 -58
  129. mirascope/api/_generated/core/remove_none_from_dict.py +0 -11
  130. mirascope/api/_generated/core/request_options.py +0 -35
  131. mirascope/api/_generated/core/serialization.py +0 -276
  132. mirascope/api/_generated/docs/__init__.py +0 -4
  133. mirascope/api/_generated/docs/client.py +0 -91
  134. mirascope/api/_generated/docs/raw_client.py +0 -178
  135. mirascope/api/_generated/environment.py +0 -9
  136. mirascope/api/_generated/environments/__init__.py +0 -23
  137. mirascope/api/_generated/environments/client.py +0 -649
  138. mirascope/api/_generated/environments/raw_client.py +0 -1567
  139. mirascope/api/_generated/environments/types/__init__.py +0 -25
  140. mirascope/api/_generated/environments/types/environments_create_response.py +0 -24
  141. mirascope/api/_generated/environments/types/environments_get_analytics_response.py +0 -60
  142. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_functions_item.py +0 -24
  143. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_models_item.py +0 -22
  144. mirascope/api/_generated/environments/types/environments_get_response.py +0 -24
  145. mirascope/api/_generated/environments/types/environments_list_response_item.py +0 -24
  146. mirascope/api/_generated/environments/types/environments_update_response.py +0 -24
  147. mirascope/api/_generated/errors/__init__.py +0 -25
  148. mirascope/api/_generated/errors/bad_request_error.py +0 -14
  149. mirascope/api/_generated/errors/conflict_error.py +0 -14
  150. mirascope/api/_generated/errors/forbidden_error.py +0 -11
  151. mirascope/api/_generated/errors/internal_server_error.py +0 -10
  152. mirascope/api/_generated/errors/not_found_error.py +0 -11
  153. mirascope/api/_generated/errors/payment_required_error.py +0 -15
  154. mirascope/api/_generated/errors/service_unavailable_error.py +0 -14
  155. mirascope/api/_generated/errors/too_many_requests_error.py +0 -15
  156. mirascope/api/_generated/errors/unauthorized_error.py +0 -11
  157. mirascope/api/_generated/functions/__init__.py +0 -39
  158. mirascope/api/_generated/functions/client.py +0 -647
  159. mirascope/api/_generated/functions/raw_client.py +0 -1890
  160. mirascope/api/_generated/functions/types/__init__.py +0 -53
  161. mirascope/api/_generated/functions/types/functions_create_request_dependencies_value.py +0 -20
  162. mirascope/api/_generated/functions/types/functions_create_response.py +0 -37
  163. mirascope/api/_generated/functions/types/functions_create_response_dependencies_value.py +0 -20
  164. mirascope/api/_generated/functions/types/functions_find_by_hash_response.py +0 -39
  165. mirascope/api/_generated/functions/types/functions_find_by_hash_response_dependencies_value.py +0 -20
  166. mirascope/api/_generated/functions/types/functions_get_by_env_response.py +0 -53
  167. mirascope/api/_generated/functions/types/functions_get_by_env_response_dependencies_value.py +0 -22
  168. mirascope/api/_generated/functions/types/functions_get_response.py +0 -37
  169. mirascope/api/_generated/functions/types/functions_get_response_dependencies_value.py +0 -20
  170. mirascope/api/_generated/functions/types/functions_list_by_env_response.py +0 -25
  171. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item.py +0 -56
  172. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item_dependencies_value.py +0 -22
  173. mirascope/api/_generated/functions/types/functions_list_response.py +0 -21
  174. mirascope/api/_generated/functions/types/functions_list_response_functions_item.py +0 -41
  175. mirascope/api/_generated/functions/types/functions_list_response_functions_item_dependencies_value.py +0 -20
  176. mirascope/api/_generated/health/__init__.py +0 -7
  177. mirascope/api/_generated/health/client.py +0 -92
  178. mirascope/api/_generated/health/raw_client.py +0 -175
  179. mirascope/api/_generated/health/types/__init__.py +0 -8
  180. mirascope/api/_generated/health/types/health_check_response.py +0 -22
  181. mirascope/api/_generated/health/types/health_check_response_status.py +0 -5
  182. mirascope/api/_generated/organization_invitations/__init__.py +0 -33
  183. mirascope/api/_generated/organization_invitations/client.py +0 -546
  184. mirascope/api/_generated/organization_invitations/raw_client.py +0 -1519
  185. mirascope/api/_generated/organization_invitations/types/__init__.py +0 -53
  186. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response.py +0 -34
  187. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response_role.py +0 -7
  188. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_request_role.py +0 -7
  189. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response.py +0 -48
  190. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_role.py +0 -7
  191. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_status.py +0 -7
  192. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response.py +0 -48
  193. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_role.py +0 -7
  194. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_status.py +0 -7
  195. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item.py +0 -48
  196. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_role.py +0 -7
  197. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_status.py +0 -7
  198. mirascope/api/_generated/organization_memberships/__init__.py +0 -19
  199. mirascope/api/_generated/organization_memberships/client.py +0 -302
  200. mirascope/api/_generated/organization_memberships/raw_client.py +0 -736
  201. mirascope/api/_generated/organization_memberships/types/__init__.py +0 -27
  202. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item.py +0 -33
  203. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item_role.py +0 -7
  204. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_request_role.py +0 -7
  205. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response.py +0 -31
  206. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response_role.py +0 -7
  207. mirascope/api/_generated/organizations/__init__.py +0 -51
  208. mirascope/api/_generated/organizations/client.py +0 -869
  209. mirascope/api/_generated/organizations/raw_client.py +0 -2593
  210. mirascope/api/_generated/organizations/types/__init__.py +0 -71
  211. mirascope/api/_generated/organizations/types/organizations_create_payment_intent_response.py +0 -24
  212. mirascope/api/_generated/organizations/types/organizations_create_response.py +0 -26
  213. mirascope/api/_generated/organizations/types/organizations_create_response_role.py +0 -5
  214. mirascope/api/_generated/organizations/types/organizations_get_response.py +0 -26
  215. mirascope/api/_generated/organizations/types/organizations_get_response_role.py +0 -5
  216. mirascope/api/_generated/organizations/types/organizations_list_response_item.py +0 -26
  217. mirascope/api/_generated/organizations/types/organizations_list_response_item_role.py +0 -5
  218. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_request_target_plan.py +0 -7
  219. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response.py +0 -47
  220. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item.py +0 -33
  221. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item_resource.py +0 -7
  222. mirascope/api/_generated/organizations/types/organizations_router_balance_response.py +0 -24
  223. mirascope/api/_generated/organizations/types/organizations_subscription_response.py +0 -53
  224. mirascope/api/_generated/organizations/types/organizations_subscription_response_current_plan.py +0 -7
  225. mirascope/api/_generated/organizations/types/organizations_subscription_response_payment_method.py +0 -26
  226. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change.py +0 -34
  227. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change_target_plan.py +0 -7
  228. mirascope/api/_generated/organizations/types/organizations_update_response.py +0 -26
  229. mirascope/api/_generated/organizations/types/organizations_update_response_role.py +0 -5
  230. mirascope/api/_generated/organizations/types/organizations_update_subscription_request_target_plan.py +0 -7
  231. mirascope/api/_generated/organizations/types/organizations_update_subscription_response.py +0 -35
  232. mirascope/api/_generated/project_memberships/__init__.py +0 -25
  233. mirascope/api/_generated/project_memberships/client.py +0 -437
  234. mirascope/api/_generated/project_memberships/raw_client.py +0 -1039
  235. mirascope/api/_generated/project_memberships/types/__init__.py +0 -29
  236. mirascope/api/_generated/project_memberships/types/project_memberships_create_request_role.py +0 -7
  237. mirascope/api/_generated/project_memberships/types/project_memberships_create_response.py +0 -35
  238. mirascope/api/_generated/project_memberships/types/project_memberships_create_response_role.py +0 -7
  239. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item.py +0 -33
  240. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item_role.py +0 -7
  241. mirascope/api/_generated/project_memberships/types/project_memberships_update_request_role.py +0 -7
  242. mirascope/api/_generated/project_memberships/types/project_memberships_update_response.py +0 -35
  243. mirascope/api/_generated/project_memberships/types/project_memberships_update_response_role.py +0 -7
  244. mirascope/api/_generated/projects/__init__.py +0 -7
  245. mirascope/api/_generated/projects/client.py +0 -428
  246. mirascope/api/_generated/projects/raw_client.py +0 -1302
  247. mirascope/api/_generated/projects/types/__init__.py +0 -10
  248. mirascope/api/_generated/projects/types/projects_create_response.py +0 -25
  249. mirascope/api/_generated/projects/types/projects_get_response.py +0 -25
  250. mirascope/api/_generated/projects/types/projects_list_response_item.py +0 -25
  251. mirascope/api/_generated/projects/types/projects_update_response.py +0 -25
  252. mirascope/api/_generated/reference.md +0 -4915
  253. mirascope/api/_generated/tags/__init__.py +0 -19
  254. mirascope/api/_generated/tags/client.py +0 -504
  255. mirascope/api/_generated/tags/raw_client.py +0 -1288
  256. mirascope/api/_generated/tags/types/__init__.py +0 -17
  257. mirascope/api/_generated/tags/types/tags_create_response.py +0 -41
  258. mirascope/api/_generated/tags/types/tags_get_response.py +0 -41
  259. mirascope/api/_generated/tags/types/tags_list_response.py +0 -23
  260. mirascope/api/_generated/tags/types/tags_list_response_tags_item.py +0 -41
  261. mirascope/api/_generated/tags/types/tags_update_response.py +0 -41
  262. mirascope/api/_generated/token_cost/__init__.py +0 -7
  263. mirascope/api/_generated/token_cost/client.py +0 -160
  264. mirascope/api/_generated/token_cost/raw_client.py +0 -264
  265. mirascope/api/_generated/token_cost/types/__init__.py +0 -8
  266. mirascope/api/_generated/token_cost/types/token_cost_calculate_request_usage.py +0 -54
  267. mirascope/api/_generated/token_cost/types/token_cost_calculate_response.py +0 -52
  268. mirascope/api/_generated/traces/__init__.py +0 -97
  269. mirascope/api/_generated/traces/client.py +0 -1103
  270. mirascope/api/_generated/traces/raw_client.py +0 -2322
  271. mirascope/api/_generated/traces/types/__init__.py +0 -155
  272. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item.py +0 -29
  273. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource.py +0 -27
  274. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item.py +0 -23
  275. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value.py +0 -38
  276. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_array_value.py +0 -19
  277. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value.py +0 -22
  278. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_resource_attributes_item_value_kvlist_value_values_item.py +0 -20
  279. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item.py +0 -29
  280. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope.py +0 -31
  281. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item.py +0 -23
  282. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value.py +0 -38
  283. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_array_value.py +0 -19
  284. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value.py +0 -22
  285. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_scope_attributes_item_value_kvlist_value_values_item.py +0 -22
  286. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item.py +0 -48
  287. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item.py +0 -23
  288. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value.py +0 -38
  289. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_array_value.py +0 -19
  290. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value.py +0 -24
  291. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_attributes_item_value_kvlist_value_values_item.py +0 -22
  292. mirascope/api/_generated/traces/types/traces_create_request_resource_spans_item_scope_spans_item_spans_item_status.py +0 -20
  293. mirascope/api/_generated/traces/types/traces_create_response.py +0 -24
  294. mirascope/api/_generated/traces/types/traces_create_response_partial_success.py +0 -22
  295. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response.py +0 -60
  296. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response_top_functions_item.py +0 -24
  297. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response_top_models_item.py +0 -22
  298. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response.py +0 -33
  299. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response_spans_item.py +0 -88
  300. mirascope/api/_generated/traces/types/traces_get_trace_detail_response.py +0 -33
  301. mirascope/api/_generated/traces/types/traces_get_trace_detail_response_spans_item.py +0 -88
  302. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response.py +0 -25
  303. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response_traces_item.py +0 -44
  304. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item.py +0 -26
  305. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item_operator.py +0 -7
  306. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_by.py +0 -7
  307. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_order.py +0 -7
  308. mirascope/api/_generated/traces/types/traces_search_by_env_response.py +0 -26
  309. mirascope/api/_generated/traces/types/traces_search_by_env_response_spans_item.py +0 -50
  310. mirascope/api/_generated/traces/types/traces_search_request_attribute_filters_item.py +0 -26
  311. mirascope/api/_generated/traces/types/traces_search_request_attribute_filters_item_operator.py +0 -7
  312. mirascope/api/_generated/traces/types/traces_search_request_sort_by.py +0 -7
  313. mirascope/api/_generated/traces/types/traces_search_request_sort_order.py +0 -5
  314. mirascope/api/_generated/traces/types/traces_search_response.py +0 -26
  315. mirascope/api/_generated/traces/types/traces_search_response_spans_item.py +0 -50
  316. mirascope/api/_generated/types/__init__.py +0 -85
  317. mirascope/api/_generated/types/already_exists_error.py +0 -22
  318. mirascope/api/_generated/types/already_exists_error_tag.py +0 -5
  319. mirascope/api/_generated/types/bad_request_error_body.py +0 -50
  320. mirascope/api/_generated/types/click_house_error.py +0 -22
  321. mirascope/api/_generated/types/database_error.py +0 -22
  322. mirascope/api/_generated/types/database_error_tag.py +0 -5
  323. mirascope/api/_generated/types/date.py +0 -3
  324. mirascope/api/_generated/types/http_api_decode_error.py +0 -27
  325. mirascope/api/_generated/types/http_api_decode_error_tag.py +0 -5
  326. mirascope/api/_generated/types/immutable_resource_error.py +0 -22
  327. mirascope/api/_generated/types/internal_server_error_body.py +0 -49
  328. mirascope/api/_generated/types/issue.py +0 -38
  329. mirascope/api/_generated/types/issue_tag.py +0 -10
  330. mirascope/api/_generated/types/not_found_error_body.py +0 -22
  331. mirascope/api/_generated/types/not_found_error_tag.py +0 -5
  332. mirascope/api/_generated/types/number_from_string.py +0 -3
  333. mirascope/api/_generated/types/permission_denied_error.py +0 -22
  334. mirascope/api/_generated/types/permission_denied_error_tag.py +0 -5
  335. mirascope/api/_generated/types/plan_limit_exceeded_error.py +0 -32
  336. mirascope/api/_generated/types/plan_limit_exceeded_error_tag.py +0 -7
  337. mirascope/api/_generated/types/pricing_unavailable_error.py +0 -23
  338. mirascope/api/_generated/types/property_key.py +0 -7
  339. mirascope/api/_generated/types/property_key_key.py +0 -25
  340. mirascope/api/_generated/types/property_key_key_tag.py +0 -5
  341. mirascope/api/_generated/types/rate_limit_error.py +0 -31
  342. mirascope/api/_generated/types/rate_limit_error_tag.py +0 -5
  343. mirascope/api/_generated/types/service_unavailable_error_body.py +0 -24
  344. mirascope/api/_generated/types/service_unavailable_error_tag.py +0 -7
  345. mirascope/api/_generated/types/stripe_error.py +0 -20
  346. mirascope/api/_generated/types/subscription_past_due_error.py +0 -31
  347. mirascope/api/_generated/types/subscription_past_due_error_tag.py +0 -7
  348. mirascope/api/_generated/types/unauthorized_error_body.py +0 -21
  349. mirascope/api/_generated/types/unauthorized_error_tag.py +0 -5
  350. mirascope/api/client.py +0 -255
  351. mirascope/api/settings.py +0 -99
  352. mirascope/llm/formatting/output_parser.py +0 -178
  353. mirascope/llm/formatting/primitives.py +0 -192
  354. mirascope/llm/mcp/mcp_client.py +0 -130
  355. mirascope/llm/messages/_utils.py +0 -34
  356. mirascope/llm/models/thinking_config.py +0 -61
  357. mirascope/llm/prompts/prompts.py +0 -487
  358. mirascope/llm/providers/__init__.py +0 -62
  359. mirascope/llm/providers/anthropic/__init__.py +0 -11
  360. mirascope/llm/providers/anthropic/_utils/__init__.py +0 -27
  361. mirascope/llm/providers/anthropic/_utils/beta_decode.py +0 -282
  362. mirascope/llm/providers/anthropic/_utils/beta_encode.py +0 -266
  363. mirascope/llm/providers/anthropic/_utils/encode.py +0 -418
  364. mirascope/llm/providers/anthropic/_utils/errors.py +0 -46
  365. mirascope/llm/providers/anthropic/beta_provider.py +0 -374
  366. mirascope/llm/providers/anthropic/model_id.py +0 -23
  367. mirascope/llm/providers/anthropic/model_info.py +0 -87
  368. mirascope/llm/providers/anthropic/provider.py +0 -479
  369. mirascope/llm/providers/google/__init__.py +0 -6
  370. mirascope/llm/providers/google/_utils/errors.py +0 -50
  371. mirascope/llm/providers/google/model_id.py +0 -22
  372. mirascope/llm/providers/google/model_info.py +0 -63
  373. mirascope/llm/providers/google/provider.py +0 -492
  374. mirascope/llm/providers/mirascope/__init__.py +0 -5
  375. mirascope/llm/providers/mirascope/_utils.py +0 -73
  376. mirascope/llm/providers/mirascope/provider.py +0 -349
  377. mirascope/llm/providers/mlx/__init__.py +0 -9
  378. mirascope/llm/providers/mlx/_utils.py +0 -141
  379. mirascope/llm/providers/mlx/encoding/__init__.py +0 -8
  380. mirascope/llm/providers/mlx/encoding/base.py +0 -72
  381. mirascope/llm/providers/mlx/encoding/transformers.py +0 -150
  382. mirascope/llm/providers/mlx/mlx.py +0 -254
  383. mirascope/llm/providers/mlx/model_id.py +0 -17
  384. mirascope/llm/providers/mlx/provider.py +0 -452
  385. mirascope/llm/providers/model_id.py +0 -16
  386. mirascope/llm/providers/ollama/__init__.py +0 -7
  387. mirascope/llm/providers/ollama/provider.py +0 -71
  388. mirascope/llm/providers/openai/__init__.py +0 -15
  389. mirascope/llm/providers/openai/_utils/__init__.py +0 -5
  390. mirascope/llm/providers/openai/_utils/errors.py +0 -46
  391. mirascope/llm/providers/openai/completions/__init__.py +0 -7
  392. mirascope/llm/providers/openai/completions/base_provider.py +0 -542
  393. mirascope/llm/providers/openai/completions/provider.py +0 -22
  394. mirascope/llm/providers/openai/model_id.py +0 -31
  395. mirascope/llm/providers/openai/model_info.py +0 -303
  396. mirascope/llm/providers/openai/provider.py +0 -441
  397. mirascope/llm/providers/openai/responses/__init__.py +0 -5
  398. mirascope/llm/providers/openai/responses/provider.py +0 -513
  399. mirascope/llm/providers/provider_id.py +0 -24
  400. mirascope/llm/providers/provider_registry.py +0 -299
  401. mirascope/llm/providers/together/__init__.py +0 -7
  402. mirascope/llm/providers/together/provider.py +0 -40
  403. mirascope/llm/responses/usage.py +0 -95
  404. mirascope/ops/__init__.py +0 -111
  405. mirascope/ops/_internal/__init__.py +0 -5
  406. mirascope/ops/_internal/closure.py +0 -1169
  407. mirascope/ops/_internal/configuration.py +0 -177
  408. mirascope/ops/_internal/context.py +0 -76
  409. mirascope/ops/_internal/exporters/__init__.py +0 -26
  410. mirascope/ops/_internal/exporters/exporters.py +0 -395
  411. mirascope/ops/_internal/exporters/processors.py +0 -104
  412. mirascope/ops/_internal/exporters/types.py +0 -165
  413. mirascope/ops/_internal/exporters/utils.py +0 -29
  414. mirascope/ops/_internal/instrumentation/__init__.py +0 -8
  415. mirascope/ops/_internal/instrumentation/llm/__init__.py +0 -8
  416. mirascope/ops/_internal/instrumentation/llm/common.py +0 -530
  417. mirascope/ops/_internal/instrumentation/llm/cost.py +0 -190
  418. mirascope/ops/_internal/instrumentation/llm/encode.py +0 -238
  419. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/__init__.py +0 -38
  420. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_input_messages.py +0 -31
  421. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_output_messages.py +0 -38
  422. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/gen_ai_system_instructions.py +0 -18
  423. mirascope/ops/_internal/instrumentation/llm/gen_ai_types/shared.py +0 -100
  424. mirascope/ops/_internal/instrumentation/llm/llm.py +0 -161
  425. mirascope/ops/_internal/instrumentation/llm/model.py +0 -1798
  426. mirascope/ops/_internal/instrumentation/llm/response.py +0 -521
  427. mirascope/ops/_internal/instrumentation/llm/serialize.py +0 -300
  428. mirascope/ops/_internal/propagation.py +0 -198
  429. mirascope/ops/_internal/protocols.py +0 -133
  430. mirascope/ops/_internal/session.py +0 -139
  431. mirascope/ops/_internal/spans.py +0 -232
  432. mirascope/ops/_internal/traced_calls.py +0 -375
  433. mirascope/ops/_internal/traced_functions.py +0 -523
  434. mirascope/ops/_internal/tracing.py +0 -353
  435. mirascope/ops/_internal/types.py +0 -13
  436. mirascope/ops/_internal/utils.py +0 -123
  437. mirascope/ops/_internal/versioned_calls.py +0 -512
  438. mirascope/ops/_internal/versioned_functions.py +0 -357
  439. mirascope/ops/_internal/versioning.py +0 -303
  440. mirascope/ops/exceptions.py +0 -21
  441. mirascope-2.0.0.dist-info/RECORD +0 -423
  442. /mirascope/llm/{providers → clients}/base/kwargs.py +0 -0
  443. /mirascope/llm/{providers → clients}/google/message.py +0 -0
@@ -1,2593 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
- from json.decoder import JSONDecodeError
5
-
6
- from ..core.api_error import ApiError
7
- from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
- from ..core.http_response import AsyncHttpResponse, HttpResponse
9
- from ..core.jsonable_encoder import jsonable_encoder
10
- from ..core.pydantic_utilities import parse_obj_as
11
- from ..core.request_options import RequestOptions
12
- from ..errors.bad_request_error import BadRequestError
13
- from ..errors.conflict_error import ConflictError
14
- from ..errors.forbidden_error import ForbiddenError
15
- from ..errors.internal_server_error import InternalServerError
16
- from ..errors.not_found_error import NotFoundError
17
- from ..errors.payment_required_error import PaymentRequiredError
18
- from ..errors.service_unavailable_error import ServiceUnavailableError
19
- from ..errors.too_many_requests_error import TooManyRequestsError
20
- from ..types.not_found_error_body import NotFoundErrorBody
21
- from ..types.permission_denied_error import PermissionDeniedError
22
- from ..types.plan_limit_exceeded_error import PlanLimitExceededError
23
- from ..types.rate_limit_error import RateLimitError
24
- from .types.organizations_create_payment_intent_response import (
25
- OrganizationsCreatePaymentIntentResponse,
26
- )
27
- from .types.organizations_create_response import OrganizationsCreateResponse
28
- from .types.organizations_get_response import OrganizationsGetResponse
29
- from .types.organizations_list_response_item import OrganizationsListResponseItem
30
- from .types.organizations_preview_subscription_change_request_target_plan import (
31
- OrganizationsPreviewSubscriptionChangeRequestTargetPlan,
32
- )
33
- from .types.organizations_preview_subscription_change_response import (
34
- OrganizationsPreviewSubscriptionChangeResponse,
35
- )
36
- from .types.organizations_router_balance_response import (
37
- OrganizationsRouterBalanceResponse,
38
- )
39
- from .types.organizations_subscription_response import OrganizationsSubscriptionResponse
40
- from .types.organizations_update_response import OrganizationsUpdateResponse
41
- from .types.organizations_update_subscription_request_target_plan import (
42
- OrganizationsUpdateSubscriptionRequestTargetPlan,
43
- )
44
- from .types.organizations_update_subscription_response import (
45
- OrganizationsUpdateSubscriptionResponse,
46
- )
47
-
48
- # this is used as the default value for optional parameters
49
- OMIT = typing.cast(typing.Any, ...)
50
-
51
-
52
- class RawOrganizationsClient:
53
- def __init__(self, *, client_wrapper: SyncClientWrapper):
54
- self._client_wrapper = client_wrapper
55
-
56
- def list(
57
- self, *, request_options: typing.Optional[RequestOptions] = None
58
- ) -> HttpResponse[typing.List[OrganizationsListResponseItem]]:
59
- """
60
- Parameters
61
- ----------
62
- request_options : typing.Optional[RequestOptions]
63
- Request-specific configuration.
64
-
65
- Returns
66
- -------
67
- HttpResponse[typing.List[OrganizationsListResponseItem]]
68
- Success
69
- """
70
- _response = self._client_wrapper.httpx_client.request(
71
- "organizations",
72
- method="GET",
73
- request_options=request_options,
74
- )
75
- try:
76
- if 200 <= _response.status_code < 300:
77
- _data = typing.cast(
78
- typing.List[OrganizationsListResponseItem],
79
- parse_obj_as(
80
- type_=typing.List[OrganizationsListResponseItem], # type: ignore
81
- object_=_response.json(),
82
- ),
83
- )
84
- return HttpResponse(response=_response, data=_data)
85
- if _response.status_code == 400:
86
- raise BadRequestError(
87
- headers=dict(_response.headers),
88
- body=typing.cast(
89
- typing.Optional[typing.Any],
90
- parse_obj_as(
91
- type_=typing.Optional[typing.Any], # type: ignore
92
- object_=_response.json(),
93
- ),
94
- ),
95
- )
96
- if _response.status_code == 429:
97
- raise TooManyRequestsError(
98
- headers=dict(_response.headers),
99
- body=typing.cast(
100
- RateLimitError,
101
- parse_obj_as(
102
- type_=RateLimitError, # type: ignore
103
- object_=_response.json(),
104
- ),
105
- ),
106
- )
107
- if _response.status_code == 500:
108
- raise InternalServerError(
109
- headers=dict(_response.headers),
110
- body=typing.cast(
111
- typing.Optional[typing.Any],
112
- parse_obj_as(
113
- type_=typing.Optional[typing.Any], # type: ignore
114
- object_=_response.json(),
115
- ),
116
- ),
117
- )
118
- if _response.status_code == 503:
119
- raise ServiceUnavailableError(
120
- headers=dict(_response.headers),
121
- body=typing.cast(
122
- typing.Optional[typing.Any],
123
- parse_obj_as(
124
- type_=typing.Optional[typing.Any], # type: ignore
125
- object_=_response.json(),
126
- ),
127
- ),
128
- )
129
- _response_json = _response.json()
130
- except JSONDecodeError:
131
- raise ApiError(
132
- status_code=_response.status_code,
133
- headers=dict(_response.headers),
134
- body=_response.text,
135
- )
136
- raise ApiError(
137
- status_code=_response.status_code,
138
- headers=dict(_response.headers),
139
- body=_response_json,
140
- )
141
-
142
- def create(
143
- self,
144
- *,
145
- name: str,
146
- slug: str,
147
- request_options: typing.Optional[RequestOptions] = None,
148
- ) -> HttpResponse[OrganizationsCreateResponse]:
149
- """
150
- Parameters
151
- ----------
152
- name : str
153
- a string at most 100 character(s) long
154
-
155
- slug : str
156
- a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$
157
-
158
- request_options : typing.Optional[RequestOptions]
159
- Request-specific configuration.
160
-
161
- Returns
162
- -------
163
- HttpResponse[OrganizationsCreateResponse]
164
- Success
165
- """
166
- _response = self._client_wrapper.httpx_client.request(
167
- "organizations",
168
- method="POST",
169
- json={
170
- "name": name,
171
- "slug": slug,
172
- },
173
- headers={
174
- "content-type": "application/json",
175
- },
176
- request_options=request_options,
177
- omit=OMIT,
178
- )
179
- try:
180
- if 200 <= _response.status_code < 300:
181
- _data = typing.cast(
182
- OrganizationsCreateResponse,
183
- parse_obj_as(
184
- type_=OrganizationsCreateResponse, # type: ignore
185
- object_=_response.json(),
186
- ),
187
- )
188
- return HttpResponse(response=_response, data=_data)
189
- if _response.status_code == 400:
190
- raise BadRequestError(
191
- headers=dict(_response.headers),
192
- body=typing.cast(
193
- typing.Optional[typing.Any],
194
- parse_obj_as(
195
- type_=typing.Optional[typing.Any], # type: ignore
196
- object_=_response.json(),
197
- ),
198
- ),
199
- )
200
- if _response.status_code == 404:
201
- raise NotFoundError(
202
- headers=dict(_response.headers),
203
- body=typing.cast(
204
- NotFoundErrorBody,
205
- parse_obj_as(
206
- type_=NotFoundErrorBody, # type: ignore
207
- object_=_response.json(),
208
- ),
209
- ),
210
- )
211
- if _response.status_code == 409:
212
- raise ConflictError(
213
- headers=dict(_response.headers),
214
- body=typing.cast(
215
- typing.Optional[typing.Any],
216
- parse_obj_as(
217
- type_=typing.Optional[typing.Any], # type: ignore
218
- object_=_response.json(),
219
- ),
220
- ),
221
- )
222
- if _response.status_code == 429:
223
- raise TooManyRequestsError(
224
- headers=dict(_response.headers),
225
- body=typing.cast(
226
- RateLimitError,
227
- parse_obj_as(
228
- type_=RateLimitError, # type: ignore
229
- object_=_response.json(),
230
- ),
231
- ),
232
- )
233
- if _response.status_code == 500:
234
- raise InternalServerError(
235
- headers=dict(_response.headers),
236
- body=typing.cast(
237
- typing.Optional[typing.Any],
238
- parse_obj_as(
239
- type_=typing.Optional[typing.Any], # type: ignore
240
- object_=_response.json(),
241
- ),
242
- ),
243
- )
244
- if _response.status_code == 503:
245
- raise ServiceUnavailableError(
246
- headers=dict(_response.headers),
247
- body=typing.cast(
248
- typing.Optional[typing.Any],
249
- parse_obj_as(
250
- type_=typing.Optional[typing.Any], # type: ignore
251
- object_=_response.json(),
252
- ),
253
- ),
254
- )
255
- _response_json = _response.json()
256
- except JSONDecodeError:
257
- raise ApiError(
258
- status_code=_response.status_code,
259
- headers=dict(_response.headers),
260
- body=_response.text,
261
- )
262
- raise ApiError(
263
- status_code=_response.status_code,
264
- headers=dict(_response.headers),
265
- body=_response_json,
266
- )
267
-
268
- def get(
269
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
270
- ) -> HttpResponse[OrganizationsGetResponse]:
271
- """
272
- Parameters
273
- ----------
274
- id : str
275
-
276
- request_options : typing.Optional[RequestOptions]
277
- Request-specific configuration.
278
-
279
- Returns
280
- -------
281
- HttpResponse[OrganizationsGetResponse]
282
- Success
283
- """
284
- _response = self._client_wrapper.httpx_client.request(
285
- f"organizations/{jsonable_encoder(id)}",
286
- method="GET",
287
- request_options=request_options,
288
- )
289
- try:
290
- if 200 <= _response.status_code < 300:
291
- _data = typing.cast(
292
- OrganizationsGetResponse,
293
- parse_obj_as(
294
- type_=OrganizationsGetResponse, # type: ignore
295
- object_=_response.json(),
296
- ),
297
- )
298
- return HttpResponse(response=_response, data=_data)
299
- if _response.status_code == 400:
300
- raise BadRequestError(
301
- headers=dict(_response.headers),
302
- body=typing.cast(
303
- typing.Optional[typing.Any],
304
- parse_obj_as(
305
- type_=typing.Optional[typing.Any], # type: ignore
306
- object_=_response.json(),
307
- ),
308
- ),
309
- )
310
- if _response.status_code == 403:
311
- raise ForbiddenError(
312
- headers=dict(_response.headers),
313
- body=typing.cast(
314
- PermissionDeniedError,
315
- parse_obj_as(
316
- type_=PermissionDeniedError, # type: ignore
317
- object_=_response.json(),
318
- ),
319
- ),
320
- )
321
- if _response.status_code == 404:
322
- raise NotFoundError(
323
- headers=dict(_response.headers),
324
- body=typing.cast(
325
- NotFoundErrorBody,
326
- parse_obj_as(
327
- type_=NotFoundErrorBody, # type: ignore
328
- object_=_response.json(),
329
- ),
330
- ),
331
- )
332
- if _response.status_code == 429:
333
- raise TooManyRequestsError(
334
- headers=dict(_response.headers),
335
- body=typing.cast(
336
- RateLimitError,
337
- parse_obj_as(
338
- type_=RateLimitError, # type: ignore
339
- object_=_response.json(),
340
- ),
341
- ),
342
- )
343
- if _response.status_code == 500:
344
- raise InternalServerError(
345
- headers=dict(_response.headers),
346
- body=typing.cast(
347
- typing.Optional[typing.Any],
348
- parse_obj_as(
349
- type_=typing.Optional[typing.Any], # type: ignore
350
- object_=_response.json(),
351
- ),
352
- ),
353
- )
354
- if _response.status_code == 503:
355
- raise ServiceUnavailableError(
356
- headers=dict(_response.headers),
357
- body=typing.cast(
358
- typing.Optional[typing.Any],
359
- parse_obj_as(
360
- type_=typing.Optional[typing.Any], # type: ignore
361
- object_=_response.json(),
362
- ),
363
- ),
364
- )
365
- _response_json = _response.json()
366
- except JSONDecodeError:
367
- raise ApiError(
368
- status_code=_response.status_code,
369
- headers=dict(_response.headers),
370
- body=_response.text,
371
- )
372
- raise ApiError(
373
- status_code=_response.status_code,
374
- headers=dict(_response.headers),
375
- body=_response_json,
376
- )
377
-
378
- def update(
379
- self,
380
- id: str,
381
- *,
382
- name: typing.Optional[str] = OMIT,
383
- slug: typing.Optional[str] = OMIT,
384
- request_options: typing.Optional[RequestOptions] = None,
385
- ) -> HttpResponse[OrganizationsUpdateResponse]:
386
- """
387
- Parameters
388
- ----------
389
- id : str
390
-
391
- name : typing.Optional[str]
392
- a string at most 100 character(s) long
393
-
394
- slug : typing.Optional[str]
395
- a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$
396
-
397
- request_options : typing.Optional[RequestOptions]
398
- Request-specific configuration.
399
-
400
- Returns
401
- -------
402
- HttpResponse[OrganizationsUpdateResponse]
403
- Success
404
- """
405
- _response = self._client_wrapper.httpx_client.request(
406
- f"organizations/{jsonable_encoder(id)}",
407
- method="PUT",
408
- json={
409
- "name": name,
410
- "slug": slug,
411
- },
412
- headers={
413
- "content-type": "application/json",
414
- },
415
- request_options=request_options,
416
- omit=OMIT,
417
- )
418
- try:
419
- if 200 <= _response.status_code < 300:
420
- _data = typing.cast(
421
- OrganizationsUpdateResponse,
422
- parse_obj_as(
423
- type_=OrganizationsUpdateResponse, # type: ignore
424
- object_=_response.json(),
425
- ),
426
- )
427
- return HttpResponse(response=_response, data=_data)
428
- if _response.status_code == 400:
429
- raise BadRequestError(
430
- headers=dict(_response.headers),
431
- body=typing.cast(
432
- typing.Optional[typing.Any],
433
- parse_obj_as(
434
- type_=typing.Optional[typing.Any], # type: ignore
435
- object_=_response.json(),
436
- ),
437
- ),
438
- )
439
- if _response.status_code == 403:
440
- raise ForbiddenError(
441
- headers=dict(_response.headers),
442
- body=typing.cast(
443
- PermissionDeniedError,
444
- parse_obj_as(
445
- type_=PermissionDeniedError, # type: ignore
446
- object_=_response.json(),
447
- ),
448
- ),
449
- )
450
- if _response.status_code == 404:
451
- raise NotFoundError(
452
- headers=dict(_response.headers),
453
- body=typing.cast(
454
- NotFoundErrorBody,
455
- parse_obj_as(
456
- type_=NotFoundErrorBody, # type: ignore
457
- object_=_response.json(),
458
- ),
459
- ),
460
- )
461
- if _response.status_code == 429:
462
- raise TooManyRequestsError(
463
- headers=dict(_response.headers),
464
- body=typing.cast(
465
- RateLimitError,
466
- parse_obj_as(
467
- type_=RateLimitError, # type: ignore
468
- object_=_response.json(),
469
- ),
470
- ),
471
- )
472
- if _response.status_code == 500:
473
- raise InternalServerError(
474
- headers=dict(_response.headers),
475
- body=typing.cast(
476
- typing.Optional[typing.Any],
477
- parse_obj_as(
478
- type_=typing.Optional[typing.Any], # type: ignore
479
- object_=_response.json(),
480
- ),
481
- ),
482
- )
483
- if _response.status_code == 503:
484
- raise ServiceUnavailableError(
485
- headers=dict(_response.headers),
486
- body=typing.cast(
487
- typing.Optional[typing.Any],
488
- parse_obj_as(
489
- type_=typing.Optional[typing.Any], # type: ignore
490
- object_=_response.json(),
491
- ),
492
- ),
493
- )
494
- _response_json = _response.json()
495
- except JSONDecodeError:
496
- raise ApiError(
497
- status_code=_response.status_code,
498
- headers=dict(_response.headers),
499
- body=_response.text,
500
- )
501
- raise ApiError(
502
- status_code=_response.status_code,
503
- headers=dict(_response.headers),
504
- body=_response_json,
505
- )
506
-
507
- def delete(
508
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
509
- ) -> HttpResponse[None]:
510
- """
511
- Parameters
512
- ----------
513
- id : str
514
-
515
- request_options : typing.Optional[RequestOptions]
516
- Request-specific configuration.
517
-
518
- Returns
519
- -------
520
- HttpResponse[None]
521
- """
522
- _response = self._client_wrapper.httpx_client.request(
523
- f"organizations/{jsonable_encoder(id)}",
524
- method="DELETE",
525
- request_options=request_options,
526
- )
527
- try:
528
- if 200 <= _response.status_code < 300:
529
- return HttpResponse(response=_response, data=None)
530
- if _response.status_code == 400:
531
- raise BadRequestError(
532
- headers=dict(_response.headers),
533
- body=typing.cast(
534
- typing.Optional[typing.Any],
535
- parse_obj_as(
536
- type_=typing.Optional[typing.Any], # type: ignore
537
- object_=_response.json(),
538
- ),
539
- ),
540
- )
541
- if _response.status_code == 403:
542
- raise ForbiddenError(
543
- headers=dict(_response.headers),
544
- body=typing.cast(
545
- PermissionDeniedError,
546
- parse_obj_as(
547
- type_=PermissionDeniedError, # type: ignore
548
- object_=_response.json(),
549
- ),
550
- ),
551
- )
552
- if _response.status_code == 404:
553
- raise NotFoundError(
554
- headers=dict(_response.headers),
555
- body=typing.cast(
556
- NotFoundErrorBody,
557
- parse_obj_as(
558
- type_=NotFoundErrorBody, # type: ignore
559
- object_=_response.json(),
560
- ),
561
- ),
562
- )
563
- if _response.status_code == 409:
564
- raise ConflictError(
565
- headers=dict(_response.headers),
566
- body=typing.cast(
567
- typing.Optional[typing.Any],
568
- parse_obj_as(
569
- type_=typing.Optional[typing.Any], # type: ignore
570
- object_=_response.json(),
571
- ),
572
- ),
573
- )
574
- if _response.status_code == 429:
575
- raise TooManyRequestsError(
576
- headers=dict(_response.headers),
577
- body=typing.cast(
578
- RateLimitError,
579
- parse_obj_as(
580
- type_=RateLimitError, # type: ignore
581
- object_=_response.json(),
582
- ),
583
- ),
584
- )
585
- if _response.status_code == 500:
586
- raise InternalServerError(
587
- headers=dict(_response.headers),
588
- body=typing.cast(
589
- typing.Optional[typing.Any],
590
- parse_obj_as(
591
- type_=typing.Optional[typing.Any], # type: ignore
592
- object_=_response.json(),
593
- ),
594
- ),
595
- )
596
- if _response.status_code == 503:
597
- raise ServiceUnavailableError(
598
- headers=dict(_response.headers),
599
- body=typing.cast(
600
- typing.Optional[typing.Any],
601
- parse_obj_as(
602
- type_=typing.Optional[typing.Any], # type: ignore
603
- object_=_response.json(),
604
- ),
605
- ),
606
- )
607
- _response_json = _response.json()
608
- except JSONDecodeError:
609
- raise ApiError(
610
- status_code=_response.status_code,
611
- headers=dict(_response.headers),
612
- body=_response.text,
613
- )
614
- raise ApiError(
615
- status_code=_response.status_code,
616
- headers=dict(_response.headers),
617
- body=_response_json,
618
- )
619
-
620
- def routerbalance(
621
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
622
- ) -> HttpResponse[OrganizationsRouterBalanceResponse]:
623
- """
624
- Parameters
625
- ----------
626
- id : str
627
-
628
- request_options : typing.Optional[RequestOptions]
629
- Request-specific configuration.
630
-
631
- Returns
632
- -------
633
- HttpResponse[OrganizationsRouterBalanceResponse]
634
- Success
635
- """
636
- _response = self._client_wrapper.httpx_client.request(
637
- f"organizations/{jsonable_encoder(id)}/router-balance",
638
- method="GET",
639
- request_options=request_options,
640
- )
641
- try:
642
- if 200 <= _response.status_code < 300:
643
- _data = typing.cast(
644
- OrganizationsRouterBalanceResponse,
645
- parse_obj_as(
646
- type_=OrganizationsRouterBalanceResponse, # type: ignore
647
- object_=_response.json(),
648
- ),
649
- )
650
- return HttpResponse(response=_response, data=_data)
651
- if _response.status_code == 400:
652
- raise BadRequestError(
653
- headers=dict(_response.headers),
654
- body=typing.cast(
655
- typing.Optional[typing.Any],
656
- parse_obj_as(
657
- type_=typing.Optional[typing.Any], # type: ignore
658
- object_=_response.json(),
659
- ),
660
- ),
661
- )
662
- if _response.status_code == 403:
663
- raise ForbiddenError(
664
- headers=dict(_response.headers),
665
- body=typing.cast(
666
- PermissionDeniedError,
667
- parse_obj_as(
668
- type_=PermissionDeniedError, # type: ignore
669
- object_=_response.json(),
670
- ),
671
- ),
672
- )
673
- if _response.status_code == 404:
674
- raise NotFoundError(
675
- headers=dict(_response.headers),
676
- body=typing.cast(
677
- NotFoundErrorBody,
678
- parse_obj_as(
679
- type_=NotFoundErrorBody, # type: ignore
680
- object_=_response.json(),
681
- ),
682
- ),
683
- )
684
- if _response.status_code == 429:
685
- raise TooManyRequestsError(
686
- headers=dict(_response.headers),
687
- body=typing.cast(
688
- RateLimitError,
689
- parse_obj_as(
690
- type_=RateLimitError, # type: ignore
691
- object_=_response.json(),
692
- ),
693
- ),
694
- )
695
- if _response.status_code == 500:
696
- raise InternalServerError(
697
- headers=dict(_response.headers),
698
- body=typing.cast(
699
- typing.Optional[typing.Any],
700
- parse_obj_as(
701
- type_=typing.Optional[typing.Any], # type: ignore
702
- object_=_response.json(),
703
- ),
704
- ),
705
- )
706
- if _response.status_code == 503:
707
- raise ServiceUnavailableError(
708
- headers=dict(_response.headers),
709
- body=typing.cast(
710
- typing.Optional[typing.Any],
711
- parse_obj_as(
712
- type_=typing.Optional[typing.Any], # type: ignore
713
- object_=_response.json(),
714
- ),
715
- ),
716
- )
717
- _response_json = _response.json()
718
- except JSONDecodeError:
719
- raise ApiError(
720
- status_code=_response.status_code,
721
- headers=dict(_response.headers),
722
- body=_response.text,
723
- )
724
- raise ApiError(
725
- status_code=_response.status_code,
726
- headers=dict(_response.headers),
727
- body=_response_json,
728
- )
729
-
730
- def createpaymentintent(
731
- self,
732
- id: str,
733
- *,
734
- amount: float,
735
- request_options: typing.Optional[RequestOptions] = None,
736
- ) -> HttpResponse[OrganizationsCreatePaymentIntentResponse]:
737
- """
738
- Parameters
739
- ----------
740
- id : str
741
-
742
- amount : float
743
- a positive number
744
-
745
- request_options : typing.Optional[RequestOptions]
746
- Request-specific configuration.
747
-
748
- Returns
749
- -------
750
- HttpResponse[OrganizationsCreatePaymentIntentResponse]
751
- Success
752
- """
753
- _response = self._client_wrapper.httpx_client.request(
754
- f"organizations/{jsonable_encoder(id)}/credits/payment-intent",
755
- method="POST",
756
- json={
757
- "amount": amount,
758
- },
759
- headers={
760
- "content-type": "application/json",
761
- },
762
- request_options=request_options,
763
- omit=OMIT,
764
- )
765
- try:
766
- if 200 <= _response.status_code < 300:
767
- _data = typing.cast(
768
- OrganizationsCreatePaymentIntentResponse,
769
- parse_obj_as(
770
- type_=OrganizationsCreatePaymentIntentResponse, # type: ignore
771
- object_=_response.json(),
772
- ),
773
- )
774
- return HttpResponse(response=_response, data=_data)
775
- if _response.status_code == 400:
776
- raise BadRequestError(
777
- headers=dict(_response.headers),
778
- body=typing.cast(
779
- typing.Optional[typing.Any],
780
- parse_obj_as(
781
- type_=typing.Optional[typing.Any], # type: ignore
782
- object_=_response.json(),
783
- ),
784
- ),
785
- )
786
- if _response.status_code == 403:
787
- raise ForbiddenError(
788
- headers=dict(_response.headers),
789
- body=typing.cast(
790
- PermissionDeniedError,
791
- parse_obj_as(
792
- type_=PermissionDeniedError, # type: ignore
793
- object_=_response.json(),
794
- ),
795
- ),
796
- )
797
- if _response.status_code == 404:
798
- raise NotFoundError(
799
- headers=dict(_response.headers),
800
- body=typing.cast(
801
- NotFoundErrorBody,
802
- parse_obj_as(
803
- type_=NotFoundErrorBody, # type: ignore
804
- object_=_response.json(),
805
- ),
806
- ),
807
- )
808
- if _response.status_code == 429:
809
- raise TooManyRequestsError(
810
- headers=dict(_response.headers),
811
- body=typing.cast(
812
- RateLimitError,
813
- parse_obj_as(
814
- type_=RateLimitError, # type: ignore
815
- object_=_response.json(),
816
- ),
817
- ),
818
- )
819
- if _response.status_code == 500:
820
- raise InternalServerError(
821
- headers=dict(_response.headers),
822
- body=typing.cast(
823
- typing.Optional[typing.Any],
824
- parse_obj_as(
825
- type_=typing.Optional[typing.Any], # type: ignore
826
- object_=_response.json(),
827
- ),
828
- ),
829
- )
830
- if _response.status_code == 503:
831
- raise ServiceUnavailableError(
832
- headers=dict(_response.headers),
833
- body=typing.cast(
834
- typing.Optional[typing.Any],
835
- parse_obj_as(
836
- type_=typing.Optional[typing.Any], # type: ignore
837
- object_=_response.json(),
838
- ),
839
- ),
840
- )
841
- _response_json = _response.json()
842
- except JSONDecodeError:
843
- raise ApiError(
844
- status_code=_response.status_code,
845
- headers=dict(_response.headers),
846
- body=_response.text,
847
- )
848
- raise ApiError(
849
- status_code=_response.status_code,
850
- headers=dict(_response.headers),
851
- body=_response_json,
852
- )
853
-
854
- def subscription(
855
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
856
- ) -> HttpResponse[OrganizationsSubscriptionResponse]:
857
- """
858
- Parameters
859
- ----------
860
- id : str
861
-
862
- request_options : typing.Optional[RequestOptions]
863
- Request-specific configuration.
864
-
865
- Returns
866
- -------
867
- HttpResponse[OrganizationsSubscriptionResponse]
868
- Success
869
- """
870
- _response = self._client_wrapper.httpx_client.request(
871
- f"organizations/{jsonable_encoder(id)}/subscription",
872
- method="GET",
873
- request_options=request_options,
874
- )
875
- try:
876
- if 200 <= _response.status_code < 300:
877
- _data = typing.cast(
878
- OrganizationsSubscriptionResponse,
879
- parse_obj_as(
880
- type_=OrganizationsSubscriptionResponse, # type: ignore
881
- object_=_response.json(),
882
- ),
883
- )
884
- return HttpResponse(response=_response, data=_data)
885
- if _response.status_code == 400:
886
- raise BadRequestError(
887
- headers=dict(_response.headers),
888
- body=typing.cast(
889
- typing.Optional[typing.Any],
890
- parse_obj_as(
891
- type_=typing.Optional[typing.Any], # type: ignore
892
- object_=_response.json(),
893
- ),
894
- ),
895
- )
896
- if _response.status_code == 403:
897
- raise ForbiddenError(
898
- headers=dict(_response.headers),
899
- body=typing.cast(
900
- PermissionDeniedError,
901
- parse_obj_as(
902
- type_=PermissionDeniedError, # type: ignore
903
- object_=_response.json(),
904
- ),
905
- ),
906
- )
907
- if _response.status_code == 404:
908
- raise NotFoundError(
909
- headers=dict(_response.headers),
910
- body=typing.cast(
911
- NotFoundErrorBody,
912
- parse_obj_as(
913
- type_=NotFoundErrorBody, # type: ignore
914
- object_=_response.json(),
915
- ),
916
- ),
917
- )
918
- if _response.status_code == 429:
919
- raise TooManyRequestsError(
920
- headers=dict(_response.headers),
921
- body=typing.cast(
922
- RateLimitError,
923
- parse_obj_as(
924
- type_=RateLimitError, # type: ignore
925
- object_=_response.json(),
926
- ),
927
- ),
928
- )
929
- if _response.status_code == 500:
930
- raise InternalServerError(
931
- headers=dict(_response.headers),
932
- body=typing.cast(
933
- typing.Optional[typing.Any],
934
- parse_obj_as(
935
- type_=typing.Optional[typing.Any], # type: ignore
936
- object_=_response.json(),
937
- ),
938
- ),
939
- )
940
- if _response.status_code == 503:
941
- raise ServiceUnavailableError(
942
- headers=dict(_response.headers),
943
- body=typing.cast(
944
- typing.Optional[typing.Any],
945
- parse_obj_as(
946
- type_=typing.Optional[typing.Any], # type: ignore
947
- object_=_response.json(),
948
- ),
949
- ),
950
- )
951
- _response_json = _response.json()
952
- except JSONDecodeError:
953
- raise ApiError(
954
- status_code=_response.status_code,
955
- headers=dict(_response.headers),
956
- body=_response.text,
957
- )
958
- raise ApiError(
959
- status_code=_response.status_code,
960
- headers=dict(_response.headers),
961
- body=_response_json,
962
- )
963
-
964
- def previewsubscriptionchange(
965
- self,
966
- id: str,
967
- *,
968
- target_plan: OrganizationsPreviewSubscriptionChangeRequestTargetPlan,
969
- request_options: typing.Optional[RequestOptions] = None,
970
- ) -> HttpResponse[OrganizationsPreviewSubscriptionChangeResponse]:
971
- """
972
- Parameters
973
- ----------
974
- id : str
975
-
976
- target_plan : OrganizationsPreviewSubscriptionChangeRequestTargetPlan
977
-
978
- request_options : typing.Optional[RequestOptions]
979
- Request-specific configuration.
980
-
981
- Returns
982
- -------
983
- HttpResponse[OrganizationsPreviewSubscriptionChangeResponse]
984
- Success
985
- """
986
- _response = self._client_wrapper.httpx_client.request(
987
- f"organizations/{jsonable_encoder(id)}/subscription/preview",
988
- method="POST",
989
- json={
990
- "targetPlan": target_plan,
991
- },
992
- headers={
993
- "content-type": "application/json",
994
- },
995
- request_options=request_options,
996
- omit=OMIT,
997
- )
998
- try:
999
- if 200 <= _response.status_code < 300:
1000
- _data = typing.cast(
1001
- OrganizationsPreviewSubscriptionChangeResponse,
1002
- parse_obj_as(
1003
- type_=OrganizationsPreviewSubscriptionChangeResponse, # type: ignore
1004
- object_=_response.json(),
1005
- ),
1006
- )
1007
- return HttpResponse(response=_response, data=_data)
1008
- if _response.status_code == 400:
1009
- raise BadRequestError(
1010
- headers=dict(_response.headers),
1011
- body=typing.cast(
1012
- typing.Optional[typing.Any],
1013
- parse_obj_as(
1014
- type_=typing.Optional[typing.Any], # type: ignore
1015
- object_=_response.json(),
1016
- ),
1017
- ),
1018
- )
1019
- if _response.status_code == 403:
1020
- raise ForbiddenError(
1021
- headers=dict(_response.headers),
1022
- body=typing.cast(
1023
- PermissionDeniedError,
1024
- parse_obj_as(
1025
- type_=PermissionDeniedError, # type: ignore
1026
- object_=_response.json(),
1027
- ),
1028
- ),
1029
- )
1030
- if _response.status_code == 404:
1031
- raise NotFoundError(
1032
- headers=dict(_response.headers),
1033
- body=typing.cast(
1034
- NotFoundErrorBody,
1035
- parse_obj_as(
1036
- type_=NotFoundErrorBody, # type: ignore
1037
- object_=_response.json(),
1038
- ),
1039
- ),
1040
- )
1041
- if _response.status_code == 429:
1042
- raise TooManyRequestsError(
1043
- headers=dict(_response.headers),
1044
- body=typing.cast(
1045
- RateLimitError,
1046
- parse_obj_as(
1047
- type_=RateLimitError, # type: ignore
1048
- object_=_response.json(),
1049
- ),
1050
- ),
1051
- )
1052
- if _response.status_code == 500:
1053
- raise InternalServerError(
1054
- headers=dict(_response.headers),
1055
- body=typing.cast(
1056
- typing.Optional[typing.Any],
1057
- parse_obj_as(
1058
- type_=typing.Optional[typing.Any], # type: ignore
1059
- object_=_response.json(),
1060
- ),
1061
- ),
1062
- )
1063
- if _response.status_code == 503:
1064
- raise ServiceUnavailableError(
1065
- headers=dict(_response.headers),
1066
- body=typing.cast(
1067
- typing.Optional[typing.Any],
1068
- parse_obj_as(
1069
- type_=typing.Optional[typing.Any], # type: ignore
1070
- object_=_response.json(),
1071
- ),
1072
- ),
1073
- )
1074
- _response_json = _response.json()
1075
- except JSONDecodeError:
1076
- raise ApiError(
1077
- status_code=_response.status_code,
1078
- headers=dict(_response.headers),
1079
- body=_response.text,
1080
- )
1081
- raise ApiError(
1082
- status_code=_response.status_code,
1083
- headers=dict(_response.headers),
1084
- body=_response_json,
1085
- )
1086
-
1087
- def updatesubscription(
1088
- self,
1089
- id: str,
1090
- *,
1091
- target_plan: OrganizationsUpdateSubscriptionRequestTargetPlan,
1092
- request_options: typing.Optional[RequestOptions] = None,
1093
- ) -> HttpResponse[OrganizationsUpdateSubscriptionResponse]:
1094
- """
1095
- Parameters
1096
- ----------
1097
- id : str
1098
-
1099
- target_plan : OrganizationsUpdateSubscriptionRequestTargetPlan
1100
-
1101
- request_options : typing.Optional[RequestOptions]
1102
- Request-specific configuration.
1103
-
1104
- Returns
1105
- -------
1106
- HttpResponse[OrganizationsUpdateSubscriptionResponse]
1107
- Success
1108
- """
1109
- _response = self._client_wrapper.httpx_client.request(
1110
- f"organizations/{jsonable_encoder(id)}/subscription/update",
1111
- method="POST",
1112
- json={
1113
- "targetPlan": target_plan,
1114
- },
1115
- headers={
1116
- "content-type": "application/json",
1117
- },
1118
- request_options=request_options,
1119
- omit=OMIT,
1120
- )
1121
- try:
1122
- if 200 <= _response.status_code < 300:
1123
- _data = typing.cast(
1124
- OrganizationsUpdateSubscriptionResponse,
1125
- parse_obj_as(
1126
- type_=OrganizationsUpdateSubscriptionResponse, # type: ignore
1127
- object_=_response.json(),
1128
- ),
1129
- )
1130
- return HttpResponse(response=_response, data=_data)
1131
- if _response.status_code == 400:
1132
- raise BadRequestError(
1133
- headers=dict(_response.headers),
1134
- body=typing.cast(
1135
- typing.Optional[typing.Any],
1136
- parse_obj_as(
1137
- type_=typing.Optional[typing.Any], # type: ignore
1138
- object_=_response.json(),
1139
- ),
1140
- ),
1141
- )
1142
- if _response.status_code == 402:
1143
- raise PaymentRequiredError(
1144
- headers=dict(_response.headers),
1145
- body=typing.cast(
1146
- PlanLimitExceededError,
1147
- parse_obj_as(
1148
- type_=PlanLimitExceededError, # type: ignore
1149
- object_=_response.json(),
1150
- ),
1151
- ),
1152
- )
1153
- if _response.status_code == 403:
1154
- raise ForbiddenError(
1155
- headers=dict(_response.headers),
1156
- body=typing.cast(
1157
- PermissionDeniedError,
1158
- parse_obj_as(
1159
- type_=PermissionDeniedError, # type: ignore
1160
- object_=_response.json(),
1161
- ),
1162
- ),
1163
- )
1164
- if _response.status_code == 404:
1165
- raise NotFoundError(
1166
- headers=dict(_response.headers),
1167
- body=typing.cast(
1168
- NotFoundErrorBody,
1169
- parse_obj_as(
1170
- type_=NotFoundErrorBody, # type: ignore
1171
- object_=_response.json(),
1172
- ),
1173
- ),
1174
- )
1175
- if _response.status_code == 429:
1176
- raise TooManyRequestsError(
1177
- headers=dict(_response.headers),
1178
- body=typing.cast(
1179
- RateLimitError,
1180
- parse_obj_as(
1181
- type_=RateLimitError, # type: ignore
1182
- object_=_response.json(),
1183
- ),
1184
- ),
1185
- )
1186
- if _response.status_code == 500:
1187
- raise InternalServerError(
1188
- headers=dict(_response.headers),
1189
- body=typing.cast(
1190
- typing.Optional[typing.Any],
1191
- parse_obj_as(
1192
- type_=typing.Optional[typing.Any], # type: ignore
1193
- object_=_response.json(),
1194
- ),
1195
- ),
1196
- )
1197
- if _response.status_code == 503:
1198
- raise ServiceUnavailableError(
1199
- headers=dict(_response.headers),
1200
- body=typing.cast(
1201
- typing.Optional[typing.Any],
1202
- parse_obj_as(
1203
- type_=typing.Optional[typing.Any], # type: ignore
1204
- object_=_response.json(),
1205
- ),
1206
- ),
1207
- )
1208
- _response_json = _response.json()
1209
- except JSONDecodeError:
1210
- raise ApiError(
1211
- status_code=_response.status_code,
1212
- headers=dict(_response.headers),
1213
- body=_response.text,
1214
- )
1215
- raise ApiError(
1216
- status_code=_response.status_code,
1217
- headers=dict(_response.headers),
1218
- body=_response_json,
1219
- )
1220
-
1221
- def cancelscheduleddowngrade(
1222
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1223
- ) -> HttpResponse[None]:
1224
- """
1225
- Parameters
1226
- ----------
1227
- id : str
1228
-
1229
- request_options : typing.Optional[RequestOptions]
1230
- Request-specific configuration.
1231
-
1232
- Returns
1233
- -------
1234
- HttpResponse[None]
1235
- """
1236
- _response = self._client_wrapper.httpx_client.request(
1237
- f"organizations/{jsonable_encoder(id)}/subscription/cancel-downgrade",
1238
- method="POST",
1239
- request_options=request_options,
1240
- )
1241
- try:
1242
- if 200 <= _response.status_code < 300:
1243
- return HttpResponse(response=_response, data=None)
1244
- if _response.status_code == 400:
1245
- raise BadRequestError(
1246
- headers=dict(_response.headers),
1247
- body=typing.cast(
1248
- typing.Optional[typing.Any],
1249
- parse_obj_as(
1250
- type_=typing.Optional[typing.Any], # type: ignore
1251
- object_=_response.json(),
1252
- ),
1253
- ),
1254
- )
1255
- if _response.status_code == 403:
1256
- raise ForbiddenError(
1257
- headers=dict(_response.headers),
1258
- body=typing.cast(
1259
- PermissionDeniedError,
1260
- parse_obj_as(
1261
- type_=PermissionDeniedError, # type: ignore
1262
- object_=_response.json(),
1263
- ),
1264
- ),
1265
- )
1266
- if _response.status_code == 404:
1267
- raise NotFoundError(
1268
- headers=dict(_response.headers),
1269
- body=typing.cast(
1270
- NotFoundErrorBody,
1271
- parse_obj_as(
1272
- type_=NotFoundErrorBody, # type: ignore
1273
- object_=_response.json(),
1274
- ),
1275
- ),
1276
- )
1277
- if _response.status_code == 429:
1278
- raise TooManyRequestsError(
1279
- headers=dict(_response.headers),
1280
- body=typing.cast(
1281
- RateLimitError,
1282
- parse_obj_as(
1283
- type_=RateLimitError, # type: ignore
1284
- object_=_response.json(),
1285
- ),
1286
- ),
1287
- )
1288
- if _response.status_code == 500:
1289
- raise InternalServerError(
1290
- headers=dict(_response.headers),
1291
- body=typing.cast(
1292
- typing.Optional[typing.Any],
1293
- parse_obj_as(
1294
- type_=typing.Optional[typing.Any], # type: ignore
1295
- object_=_response.json(),
1296
- ),
1297
- ),
1298
- )
1299
- if _response.status_code == 503:
1300
- raise ServiceUnavailableError(
1301
- headers=dict(_response.headers),
1302
- body=typing.cast(
1303
- typing.Optional[typing.Any],
1304
- parse_obj_as(
1305
- type_=typing.Optional[typing.Any], # type: ignore
1306
- object_=_response.json(),
1307
- ),
1308
- ),
1309
- )
1310
- _response_json = _response.json()
1311
- except JSONDecodeError:
1312
- raise ApiError(
1313
- status_code=_response.status_code,
1314
- headers=dict(_response.headers),
1315
- body=_response.text,
1316
- )
1317
- raise ApiError(
1318
- status_code=_response.status_code,
1319
- headers=dict(_response.headers),
1320
- body=_response_json,
1321
- )
1322
-
1323
-
1324
- class AsyncRawOrganizationsClient:
1325
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
1326
- self._client_wrapper = client_wrapper
1327
-
1328
- async def list(
1329
- self, *, request_options: typing.Optional[RequestOptions] = None
1330
- ) -> AsyncHttpResponse[typing.List[OrganizationsListResponseItem]]:
1331
- """
1332
- Parameters
1333
- ----------
1334
- request_options : typing.Optional[RequestOptions]
1335
- Request-specific configuration.
1336
-
1337
- Returns
1338
- -------
1339
- AsyncHttpResponse[typing.List[OrganizationsListResponseItem]]
1340
- Success
1341
- """
1342
- _response = await self._client_wrapper.httpx_client.request(
1343
- "organizations",
1344
- method="GET",
1345
- request_options=request_options,
1346
- )
1347
- try:
1348
- if 200 <= _response.status_code < 300:
1349
- _data = typing.cast(
1350
- typing.List[OrganizationsListResponseItem],
1351
- parse_obj_as(
1352
- type_=typing.List[OrganizationsListResponseItem], # type: ignore
1353
- object_=_response.json(),
1354
- ),
1355
- )
1356
- return AsyncHttpResponse(response=_response, data=_data)
1357
- if _response.status_code == 400:
1358
- raise BadRequestError(
1359
- headers=dict(_response.headers),
1360
- body=typing.cast(
1361
- typing.Optional[typing.Any],
1362
- parse_obj_as(
1363
- type_=typing.Optional[typing.Any], # type: ignore
1364
- object_=_response.json(),
1365
- ),
1366
- ),
1367
- )
1368
- if _response.status_code == 429:
1369
- raise TooManyRequestsError(
1370
- headers=dict(_response.headers),
1371
- body=typing.cast(
1372
- RateLimitError,
1373
- parse_obj_as(
1374
- type_=RateLimitError, # type: ignore
1375
- object_=_response.json(),
1376
- ),
1377
- ),
1378
- )
1379
- if _response.status_code == 500:
1380
- raise InternalServerError(
1381
- headers=dict(_response.headers),
1382
- body=typing.cast(
1383
- typing.Optional[typing.Any],
1384
- parse_obj_as(
1385
- type_=typing.Optional[typing.Any], # type: ignore
1386
- object_=_response.json(),
1387
- ),
1388
- ),
1389
- )
1390
- if _response.status_code == 503:
1391
- raise ServiceUnavailableError(
1392
- headers=dict(_response.headers),
1393
- body=typing.cast(
1394
- typing.Optional[typing.Any],
1395
- parse_obj_as(
1396
- type_=typing.Optional[typing.Any], # type: ignore
1397
- object_=_response.json(),
1398
- ),
1399
- ),
1400
- )
1401
- _response_json = _response.json()
1402
- except JSONDecodeError:
1403
- raise ApiError(
1404
- status_code=_response.status_code,
1405
- headers=dict(_response.headers),
1406
- body=_response.text,
1407
- )
1408
- raise ApiError(
1409
- status_code=_response.status_code,
1410
- headers=dict(_response.headers),
1411
- body=_response_json,
1412
- )
1413
-
1414
- async def create(
1415
- self,
1416
- *,
1417
- name: str,
1418
- slug: str,
1419
- request_options: typing.Optional[RequestOptions] = None,
1420
- ) -> AsyncHttpResponse[OrganizationsCreateResponse]:
1421
- """
1422
- Parameters
1423
- ----------
1424
- name : str
1425
- a string at most 100 character(s) long
1426
-
1427
- slug : str
1428
- a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$
1429
-
1430
- request_options : typing.Optional[RequestOptions]
1431
- Request-specific configuration.
1432
-
1433
- Returns
1434
- -------
1435
- AsyncHttpResponse[OrganizationsCreateResponse]
1436
- Success
1437
- """
1438
- _response = await self._client_wrapper.httpx_client.request(
1439
- "organizations",
1440
- method="POST",
1441
- json={
1442
- "name": name,
1443
- "slug": slug,
1444
- },
1445
- headers={
1446
- "content-type": "application/json",
1447
- },
1448
- request_options=request_options,
1449
- omit=OMIT,
1450
- )
1451
- try:
1452
- if 200 <= _response.status_code < 300:
1453
- _data = typing.cast(
1454
- OrganizationsCreateResponse,
1455
- parse_obj_as(
1456
- type_=OrganizationsCreateResponse, # type: ignore
1457
- object_=_response.json(),
1458
- ),
1459
- )
1460
- return AsyncHttpResponse(response=_response, data=_data)
1461
- if _response.status_code == 400:
1462
- raise BadRequestError(
1463
- headers=dict(_response.headers),
1464
- body=typing.cast(
1465
- typing.Optional[typing.Any],
1466
- parse_obj_as(
1467
- type_=typing.Optional[typing.Any], # type: ignore
1468
- object_=_response.json(),
1469
- ),
1470
- ),
1471
- )
1472
- if _response.status_code == 404:
1473
- raise NotFoundError(
1474
- headers=dict(_response.headers),
1475
- body=typing.cast(
1476
- NotFoundErrorBody,
1477
- parse_obj_as(
1478
- type_=NotFoundErrorBody, # type: ignore
1479
- object_=_response.json(),
1480
- ),
1481
- ),
1482
- )
1483
- if _response.status_code == 409:
1484
- raise ConflictError(
1485
- headers=dict(_response.headers),
1486
- body=typing.cast(
1487
- typing.Optional[typing.Any],
1488
- parse_obj_as(
1489
- type_=typing.Optional[typing.Any], # type: ignore
1490
- object_=_response.json(),
1491
- ),
1492
- ),
1493
- )
1494
- if _response.status_code == 429:
1495
- raise TooManyRequestsError(
1496
- headers=dict(_response.headers),
1497
- body=typing.cast(
1498
- RateLimitError,
1499
- parse_obj_as(
1500
- type_=RateLimitError, # type: ignore
1501
- object_=_response.json(),
1502
- ),
1503
- ),
1504
- )
1505
- if _response.status_code == 500:
1506
- raise InternalServerError(
1507
- headers=dict(_response.headers),
1508
- body=typing.cast(
1509
- typing.Optional[typing.Any],
1510
- parse_obj_as(
1511
- type_=typing.Optional[typing.Any], # type: ignore
1512
- object_=_response.json(),
1513
- ),
1514
- ),
1515
- )
1516
- if _response.status_code == 503:
1517
- raise ServiceUnavailableError(
1518
- headers=dict(_response.headers),
1519
- body=typing.cast(
1520
- typing.Optional[typing.Any],
1521
- parse_obj_as(
1522
- type_=typing.Optional[typing.Any], # type: ignore
1523
- object_=_response.json(),
1524
- ),
1525
- ),
1526
- )
1527
- _response_json = _response.json()
1528
- except JSONDecodeError:
1529
- raise ApiError(
1530
- status_code=_response.status_code,
1531
- headers=dict(_response.headers),
1532
- body=_response.text,
1533
- )
1534
- raise ApiError(
1535
- status_code=_response.status_code,
1536
- headers=dict(_response.headers),
1537
- body=_response_json,
1538
- )
1539
-
1540
- async def get(
1541
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1542
- ) -> AsyncHttpResponse[OrganizationsGetResponse]:
1543
- """
1544
- Parameters
1545
- ----------
1546
- id : str
1547
-
1548
- request_options : typing.Optional[RequestOptions]
1549
- Request-specific configuration.
1550
-
1551
- Returns
1552
- -------
1553
- AsyncHttpResponse[OrganizationsGetResponse]
1554
- Success
1555
- """
1556
- _response = await self._client_wrapper.httpx_client.request(
1557
- f"organizations/{jsonable_encoder(id)}",
1558
- method="GET",
1559
- request_options=request_options,
1560
- )
1561
- try:
1562
- if 200 <= _response.status_code < 300:
1563
- _data = typing.cast(
1564
- OrganizationsGetResponse,
1565
- parse_obj_as(
1566
- type_=OrganizationsGetResponse, # type: ignore
1567
- object_=_response.json(),
1568
- ),
1569
- )
1570
- return AsyncHttpResponse(response=_response, data=_data)
1571
- if _response.status_code == 400:
1572
- raise BadRequestError(
1573
- headers=dict(_response.headers),
1574
- body=typing.cast(
1575
- typing.Optional[typing.Any],
1576
- parse_obj_as(
1577
- type_=typing.Optional[typing.Any], # type: ignore
1578
- object_=_response.json(),
1579
- ),
1580
- ),
1581
- )
1582
- if _response.status_code == 403:
1583
- raise ForbiddenError(
1584
- headers=dict(_response.headers),
1585
- body=typing.cast(
1586
- PermissionDeniedError,
1587
- parse_obj_as(
1588
- type_=PermissionDeniedError, # type: ignore
1589
- object_=_response.json(),
1590
- ),
1591
- ),
1592
- )
1593
- if _response.status_code == 404:
1594
- raise NotFoundError(
1595
- headers=dict(_response.headers),
1596
- body=typing.cast(
1597
- NotFoundErrorBody,
1598
- parse_obj_as(
1599
- type_=NotFoundErrorBody, # type: ignore
1600
- object_=_response.json(),
1601
- ),
1602
- ),
1603
- )
1604
- if _response.status_code == 429:
1605
- raise TooManyRequestsError(
1606
- headers=dict(_response.headers),
1607
- body=typing.cast(
1608
- RateLimitError,
1609
- parse_obj_as(
1610
- type_=RateLimitError, # type: ignore
1611
- object_=_response.json(),
1612
- ),
1613
- ),
1614
- )
1615
- if _response.status_code == 500:
1616
- raise InternalServerError(
1617
- headers=dict(_response.headers),
1618
- body=typing.cast(
1619
- typing.Optional[typing.Any],
1620
- parse_obj_as(
1621
- type_=typing.Optional[typing.Any], # type: ignore
1622
- object_=_response.json(),
1623
- ),
1624
- ),
1625
- )
1626
- if _response.status_code == 503:
1627
- raise ServiceUnavailableError(
1628
- headers=dict(_response.headers),
1629
- body=typing.cast(
1630
- typing.Optional[typing.Any],
1631
- parse_obj_as(
1632
- type_=typing.Optional[typing.Any], # type: ignore
1633
- object_=_response.json(),
1634
- ),
1635
- ),
1636
- )
1637
- _response_json = _response.json()
1638
- except JSONDecodeError:
1639
- raise ApiError(
1640
- status_code=_response.status_code,
1641
- headers=dict(_response.headers),
1642
- body=_response.text,
1643
- )
1644
- raise ApiError(
1645
- status_code=_response.status_code,
1646
- headers=dict(_response.headers),
1647
- body=_response_json,
1648
- )
1649
-
1650
- async def update(
1651
- self,
1652
- id: str,
1653
- *,
1654
- name: typing.Optional[str] = OMIT,
1655
- slug: typing.Optional[str] = OMIT,
1656
- request_options: typing.Optional[RequestOptions] = None,
1657
- ) -> AsyncHttpResponse[OrganizationsUpdateResponse]:
1658
- """
1659
- Parameters
1660
- ----------
1661
- id : str
1662
-
1663
- name : typing.Optional[str]
1664
- a string at most 100 character(s) long
1665
-
1666
- slug : typing.Optional[str]
1667
- a string matching the pattern ^[a-z0-9][a-z0-9_-]*[a-z0-9]$
1668
-
1669
- request_options : typing.Optional[RequestOptions]
1670
- Request-specific configuration.
1671
-
1672
- Returns
1673
- -------
1674
- AsyncHttpResponse[OrganizationsUpdateResponse]
1675
- Success
1676
- """
1677
- _response = await self._client_wrapper.httpx_client.request(
1678
- f"organizations/{jsonable_encoder(id)}",
1679
- method="PUT",
1680
- json={
1681
- "name": name,
1682
- "slug": slug,
1683
- },
1684
- headers={
1685
- "content-type": "application/json",
1686
- },
1687
- request_options=request_options,
1688
- omit=OMIT,
1689
- )
1690
- try:
1691
- if 200 <= _response.status_code < 300:
1692
- _data = typing.cast(
1693
- OrganizationsUpdateResponse,
1694
- parse_obj_as(
1695
- type_=OrganizationsUpdateResponse, # type: ignore
1696
- object_=_response.json(),
1697
- ),
1698
- )
1699
- return AsyncHttpResponse(response=_response, data=_data)
1700
- if _response.status_code == 400:
1701
- raise BadRequestError(
1702
- headers=dict(_response.headers),
1703
- body=typing.cast(
1704
- typing.Optional[typing.Any],
1705
- parse_obj_as(
1706
- type_=typing.Optional[typing.Any], # type: ignore
1707
- object_=_response.json(),
1708
- ),
1709
- ),
1710
- )
1711
- if _response.status_code == 403:
1712
- raise ForbiddenError(
1713
- headers=dict(_response.headers),
1714
- body=typing.cast(
1715
- PermissionDeniedError,
1716
- parse_obj_as(
1717
- type_=PermissionDeniedError, # type: ignore
1718
- object_=_response.json(),
1719
- ),
1720
- ),
1721
- )
1722
- if _response.status_code == 404:
1723
- raise NotFoundError(
1724
- headers=dict(_response.headers),
1725
- body=typing.cast(
1726
- NotFoundErrorBody,
1727
- parse_obj_as(
1728
- type_=NotFoundErrorBody, # type: ignore
1729
- object_=_response.json(),
1730
- ),
1731
- ),
1732
- )
1733
- if _response.status_code == 429:
1734
- raise TooManyRequestsError(
1735
- headers=dict(_response.headers),
1736
- body=typing.cast(
1737
- RateLimitError,
1738
- parse_obj_as(
1739
- type_=RateLimitError, # type: ignore
1740
- object_=_response.json(),
1741
- ),
1742
- ),
1743
- )
1744
- if _response.status_code == 500:
1745
- raise InternalServerError(
1746
- headers=dict(_response.headers),
1747
- body=typing.cast(
1748
- typing.Optional[typing.Any],
1749
- parse_obj_as(
1750
- type_=typing.Optional[typing.Any], # type: ignore
1751
- object_=_response.json(),
1752
- ),
1753
- ),
1754
- )
1755
- if _response.status_code == 503:
1756
- raise ServiceUnavailableError(
1757
- headers=dict(_response.headers),
1758
- body=typing.cast(
1759
- typing.Optional[typing.Any],
1760
- parse_obj_as(
1761
- type_=typing.Optional[typing.Any], # type: ignore
1762
- object_=_response.json(),
1763
- ),
1764
- ),
1765
- )
1766
- _response_json = _response.json()
1767
- except JSONDecodeError:
1768
- raise ApiError(
1769
- status_code=_response.status_code,
1770
- headers=dict(_response.headers),
1771
- body=_response.text,
1772
- )
1773
- raise ApiError(
1774
- status_code=_response.status_code,
1775
- headers=dict(_response.headers),
1776
- body=_response_json,
1777
- )
1778
-
1779
- async def delete(
1780
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1781
- ) -> AsyncHttpResponse[None]:
1782
- """
1783
- Parameters
1784
- ----------
1785
- id : str
1786
-
1787
- request_options : typing.Optional[RequestOptions]
1788
- Request-specific configuration.
1789
-
1790
- Returns
1791
- -------
1792
- AsyncHttpResponse[None]
1793
- """
1794
- _response = await self._client_wrapper.httpx_client.request(
1795
- f"organizations/{jsonable_encoder(id)}",
1796
- method="DELETE",
1797
- request_options=request_options,
1798
- )
1799
- try:
1800
- if 200 <= _response.status_code < 300:
1801
- return AsyncHttpResponse(response=_response, data=None)
1802
- if _response.status_code == 400:
1803
- raise BadRequestError(
1804
- headers=dict(_response.headers),
1805
- body=typing.cast(
1806
- typing.Optional[typing.Any],
1807
- parse_obj_as(
1808
- type_=typing.Optional[typing.Any], # type: ignore
1809
- object_=_response.json(),
1810
- ),
1811
- ),
1812
- )
1813
- if _response.status_code == 403:
1814
- raise ForbiddenError(
1815
- headers=dict(_response.headers),
1816
- body=typing.cast(
1817
- PermissionDeniedError,
1818
- parse_obj_as(
1819
- type_=PermissionDeniedError, # type: ignore
1820
- object_=_response.json(),
1821
- ),
1822
- ),
1823
- )
1824
- if _response.status_code == 404:
1825
- raise NotFoundError(
1826
- headers=dict(_response.headers),
1827
- body=typing.cast(
1828
- NotFoundErrorBody,
1829
- parse_obj_as(
1830
- type_=NotFoundErrorBody, # type: ignore
1831
- object_=_response.json(),
1832
- ),
1833
- ),
1834
- )
1835
- if _response.status_code == 409:
1836
- raise ConflictError(
1837
- headers=dict(_response.headers),
1838
- body=typing.cast(
1839
- typing.Optional[typing.Any],
1840
- parse_obj_as(
1841
- type_=typing.Optional[typing.Any], # type: ignore
1842
- object_=_response.json(),
1843
- ),
1844
- ),
1845
- )
1846
- if _response.status_code == 429:
1847
- raise TooManyRequestsError(
1848
- headers=dict(_response.headers),
1849
- body=typing.cast(
1850
- RateLimitError,
1851
- parse_obj_as(
1852
- type_=RateLimitError, # type: ignore
1853
- object_=_response.json(),
1854
- ),
1855
- ),
1856
- )
1857
- if _response.status_code == 500:
1858
- raise InternalServerError(
1859
- headers=dict(_response.headers),
1860
- body=typing.cast(
1861
- typing.Optional[typing.Any],
1862
- parse_obj_as(
1863
- type_=typing.Optional[typing.Any], # type: ignore
1864
- object_=_response.json(),
1865
- ),
1866
- ),
1867
- )
1868
- if _response.status_code == 503:
1869
- raise ServiceUnavailableError(
1870
- headers=dict(_response.headers),
1871
- body=typing.cast(
1872
- typing.Optional[typing.Any],
1873
- parse_obj_as(
1874
- type_=typing.Optional[typing.Any], # type: ignore
1875
- object_=_response.json(),
1876
- ),
1877
- ),
1878
- )
1879
- _response_json = _response.json()
1880
- except JSONDecodeError:
1881
- raise ApiError(
1882
- status_code=_response.status_code,
1883
- headers=dict(_response.headers),
1884
- body=_response.text,
1885
- )
1886
- raise ApiError(
1887
- status_code=_response.status_code,
1888
- headers=dict(_response.headers),
1889
- body=_response_json,
1890
- )
1891
-
1892
- async def routerbalance(
1893
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1894
- ) -> AsyncHttpResponse[OrganizationsRouterBalanceResponse]:
1895
- """
1896
- Parameters
1897
- ----------
1898
- id : str
1899
-
1900
- request_options : typing.Optional[RequestOptions]
1901
- Request-specific configuration.
1902
-
1903
- Returns
1904
- -------
1905
- AsyncHttpResponse[OrganizationsRouterBalanceResponse]
1906
- Success
1907
- """
1908
- _response = await self._client_wrapper.httpx_client.request(
1909
- f"organizations/{jsonable_encoder(id)}/router-balance",
1910
- method="GET",
1911
- request_options=request_options,
1912
- )
1913
- try:
1914
- if 200 <= _response.status_code < 300:
1915
- _data = typing.cast(
1916
- OrganizationsRouterBalanceResponse,
1917
- parse_obj_as(
1918
- type_=OrganizationsRouterBalanceResponse, # type: ignore
1919
- object_=_response.json(),
1920
- ),
1921
- )
1922
- return AsyncHttpResponse(response=_response, data=_data)
1923
- if _response.status_code == 400:
1924
- raise BadRequestError(
1925
- headers=dict(_response.headers),
1926
- body=typing.cast(
1927
- typing.Optional[typing.Any],
1928
- parse_obj_as(
1929
- type_=typing.Optional[typing.Any], # type: ignore
1930
- object_=_response.json(),
1931
- ),
1932
- ),
1933
- )
1934
- if _response.status_code == 403:
1935
- raise ForbiddenError(
1936
- headers=dict(_response.headers),
1937
- body=typing.cast(
1938
- PermissionDeniedError,
1939
- parse_obj_as(
1940
- type_=PermissionDeniedError, # type: ignore
1941
- object_=_response.json(),
1942
- ),
1943
- ),
1944
- )
1945
- if _response.status_code == 404:
1946
- raise NotFoundError(
1947
- headers=dict(_response.headers),
1948
- body=typing.cast(
1949
- NotFoundErrorBody,
1950
- parse_obj_as(
1951
- type_=NotFoundErrorBody, # type: ignore
1952
- object_=_response.json(),
1953
- ),
1954
- ),
1955
- )
1956
- if _response.status_code == 429:
1957
- raise TooManyRequestsError(
1958
- headers=dict(_response.headers),
1959
- body=typing.cast(
1960
- RateLimitError,
1961
- parse_obj_as(
1962
- type_=RateLimitError, # type: ignore
1963
- object_=_response.json(),
1964
- ),
1965
- ),
1966
- )
1967
- if _response.status_code == 500:
1968
- raise InternalServerError(
1969
- headers=dict(_response.headers),
1970
- body=typing.cast(
1971
- typing.Optional[typing.Any],
1972
- parse_obj_as(
1973
- type_=typing.Optional[typing.Any], # type: ignore
1974
- object_=_response.json(),
1975
- ),
1976
- ),
1977
- )
1978
- if _response.status_code == 503:
1979
- raise ServiceUnavailableError(
1980
- headers=dict(_response.headers),
1981
- body=typing.cast(
1982
- typing.Optional[typing.Any],
1983
- parse_obj_as(
1984
- type_=typing.Optional[typing.Any], # type: ignore
1985
- object_=_response.json(),
1986
- ),
1987
- ),
1988
- )
1989
- _response_json = _response.json()
1990
- except JSONDecodeError:
1991
- raise ApiError(
1992
- status_code=_response.status_code,
1993
- headers=dict(_response.headers),
1994
- body=_response.text,
1995
- )
1996
- raise ApiError(
1997
- status_code=_response.status_code,
1998
- headers=dict(_response.headers),
1999
- body=_response_json,
2000
- )
2001
-
2002
- async def createpaymentintent(
2003
- self,
2004
- id: str,
2005
- *,
2006
- amount: float,
2007
- request_options: typing.Optional[RequestOptions] = None,
2008
- ) -> AsyncHttpResponse[OrganizationsCreatePaymentIntentResponse]:
2009
- """
2010
- Parameters
2011
- ----------
2012
- id : str
2013
-
2014
- amount : float
2015
- a positive number
2016
-
2017
- request_options : typing.Optional[RequestOptions]
2018
- Request-specific configuration.
2019
-
2020
- Returns
2021
- -------
2022
- AsyncHttpResponse[OrganizationsCreatePaymentIntentResponse]
2023
- Success
2024
- """
2025
- _response = await self._client_wrapper.httpx_client.request(
2026
- f"organizations/{jsonable_encoder(id)}/credits/payment-intent",
2027
- method="POST",
2028
- json={
2029
- "amount": amount,
2030
- },
2031
- headers={
2032
- "content-type": "application/json",
2033
- },
2034
- request_options=request_options,
2035
- omit=OMIT,
2036
- )
2037
- try:
2038
- if 200 <= _response.status_code < 300:
2039
- _data = typing.cast(
2040
- OrganizationsCreatePaymentIntentResponse,
2041
- parse_obj_as(
2042
- type_=OrganizationsCreatePaymentIntentResponse, # type: ignore
2043
- object_=_response.json(),
2044
- ),
2045
- )
2046
- return AsyncHttpResponse(response=_response, data=_data)
2047
- if _response.status_code == 400:
2048
- raise BadRequestError(
2049
- headers=dict(_response.headers),
2050
- body=typing.cast(
2051
- typing.Optional[typing.Any],
2052
- parse_obj_as(
2053
- type_=typing.Optional[typing.Any], # type: ignore
2054
- object_=_response.json(),
2055
- ),
2056
- ),
2057
- )
2058
- if _response.status_code == 403:
2059
- raise ForbiddenError(
2060
- headers=dict(_response.headers),
2061
- body=typing.cast(
2062
- PermissionDeniedError,
2063
- parse_obj_as(
2064
- type_=PermissionDeniedError, # type: ignore
2065
- object_=_response.json(),
2066
- ),
2067
- ),
2068
- )
2069
- if _response.status_code == 404:
2070
- raise NotFoundError(
2071
- headers=dict(_response.headers),
2072
- body=typing.cast(
2073
- NotFoundErrorBody,
2074
- parse_obj_as(
2075
- type_=NotFoundErrorBody, # type: ignore
2076
- object_=_response.json(),
2077
- ),
2078
- ),
2079
- )
2080
- if _response.status_code == 429:
2081
- raise TooManyRequestsError(
2082
- headers=dict(_response.headers),
2083
- body=typing.cast(
2084
- RateLimitError,
2085
- parse_obj_as(
2086
- type_=RateLimitError, # type: ignore
2087
- object_=_response.json(),
2088
- ),
2089
- ),
2090
- )
2091
- if _response.status_code == 500:
2092
- raise InternalServerError(
2093
- headers=dict(_response.headers),
2094
- body=typing.cast(
2095
- typing.Optional[typing.Any],
2096
- parse_obj_as(
2097
- type_=typing.Optional[typing.Any], # type: ignore
2098
- object_=_response.json(),
2099
- ),
2100
- ),
2101
- )
2102
- if _response.status_code == 503:
2103
- raise ServiceUnavailableError(
2104
- headers=dict(_response.headers),
2105
- body=typing.cast(
2106
- typing.Optional[typing.Any],
2107
- parse_obj_as(
2108
- type_=typing.Optional[typing.Any], # type: ignore
2109
- object_=_response.json(),
2110
- ),
2111
- ),
2112
- )
2113
- _response_json = _response.json()
2114
- except JSONDecodeError:
2115
- raise ApiError(
2116
- status_code=_response.status_code,
2117
- headers=dict(_response.headers),
2118
- body=_response.text,
2119
- )
2120
- raise ApiError(
2121
- status_code=_response.status_code,
2122
- headers=dict(_response.headers),
2123
- body=_response_json,
2124
- )
2125
-
2126
- async def subscription(
2127
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
2128
- ) -> AsyncHttpResponse[OrganizationsSubscriptionResponse]:
2129
- """
2130
- Parameters
2131
- ----------
2132
- id : str
2133
-
2134
- request_options : typing.Optional[RequestOptions]
2135
- Request-specific configuration.
2136
-
2137
- Returns
2138
- -------
2139
- AsyncHttpResponse[OrganizationsSubscriptionResponse]
2140
- Success
2141
- """
2142
- _response = await self._client_wrapper.httpx_client.request(
2143
- f"organizations/{jsonable_encoder(id)}/subscription",
2144
- method="GET",
2145
- request_options=request_options,
2146
- )
2147
- try:
2148
- if 200 <= _response.status_code < 300:
2149
- _data = typing.cast(
2150
- OrganizationsSubscriptionResponse,
2151
- parse_obj_as(
2152
- type_=OrganizationsSubscriptionResponse, # type: ignore
2153
- object_=_response.json(),
2154
- ),
2155
- )
2156
- return AsyncHttpResponse(response=_response, data=_data)
2157
- if _response.status_code == 400:
2158
- raise BadRequestError(
2159
- headers=dict(_response.headers),
2160
- body=typing.cast(
2161
- typing.Optional[typing.Any],
2162
- parse_obj_as(
2163
- type_=typing.Optional[typing.Any], # type: ignore
2164
- object_=_response.json(),
2165
- ),
2166
- ),
2167
- )
2168
- if _response.status_code == 403:
2169
- raise ForbiddenError(
2170
- headers=dict(_response.headers),
2171
- body=typing.cast(
2172
- PermissionDeniedError,
2173
- parse_obj_as(
2174
- type_=PermissionDeniedError, # type: ignore
2175
- object_=_response.json(),
2176
- ),
2177
- ),
2178
- )
2179
- if _response.status_code == 404:
2180
- raise NotFoundError(
2181
- headers=dict(_response.headers),
2182
- body=typing.cast(
2183
- NotFoundErrorBody,
2184
- parse_obj_as(
2185
- type_=NotFoundErrorBody, # type: ignore
2186
- object_=_response.json(),
2187
- ),
2188
- ),
2189
- )
2190
- if _response.status_code == 429:
2191
- raise TooManyRequestsError(
2192
- headers=dict(_response.headers),
2193
- body=typing.cast(
2194
- RateLimitError,
2195
- parse_obj_as(
2196
- type_=RateLimitError, # type: ignore
2197
- object_=_response.json(),
2198
- ),
2199
- ),
2200
- )
2201
- if _response.status_code == 500:
2202
- raise InternalServerError(
2203
- headers=dict(_response.headers),
2204
- body=typing.cast(
2205
- typing.Optional[typing.Any],
2206
- parse_obj_as(
2207
- type_=typing.Optional[typing.Any], # type: ignore
2208
- object_=_response.json(),
2209
- ),
2210
- ),
2211
- )
2212
- if _response.status_code == 503:
2213
- raise ServiceUnavailableError(
2214
- headers=dict(_response.headers),
2215
- body=typing.cast(
2216
- typing.Optional[typing.Any],
2217
- parse_obj_as(
2218
- type_=typing.Optional[typing.Any], # type: ignore
2219
- object_=_response.json(),
2220
- ),
2221
- ),
2222
- )
2223
- _response_json = _response.json()
2224
- except JSONDecodeError:
2225
- raise ApiError(
2226
- status_code=_response.status_code,
2227
- headers=dict(_response.headers),
2228
- body=_response.text,
2229
- )
2230
- raise ApiError(
2231
- status_code=_response.status_code,
2232
- headers=dict(_response.headers),
2233
- body=_response_json,
2234
- )
2235
-
2236
- async def previewsubscriptionchange(
2237
- self,
2238
- id: str,
2239
- *,
2240
- target_plan: OrganizationsPreviewSubscriptionChangeRequestTargetPlan,
2241
- request_options: typing.Optional[RequestOptions] = None,
2242
- ) -> AsyncHttpResponse[OrganizationsPreviewSubscriptionChangeResponse]:
2243
- """
2244
- Parameters
2245
- ----------
2246
- id : str
2247
-
2248
- target_plan : OrganizationsPreviewSubscriptionChangeRequestTargetPlan
2249
-
2250
- request_options : typing.Optional[RequestOptions]
2251
- Request-specific configuration.
2252
-
2253
- Returns
2254
- -------
2255
- AsyncHttpResponse[OrganizationsPreviewSubscriptionChangeResponse]
2256
- Success
2257
- """
2258
- _response = await self._client_wrapper.httpx_client.request(
2259
- f"organizations/{jsonable_encoder(id)}/subscription/preview",
2260
- method="POST",
2261
- json={
2262
- "targetPlan": target_plan,
2263
- },
2264
- headers={
2265
- "content-type": "application/json",
2266
- },
2267
- request_options=request_options,
2268
- omit=OMIT,
2269
- )
2270
- try:
2271
- if 200 <= _response.status_code < 300:
2272
- _data = typing.cast(
2273
- OrganizationsPreviewSubscriptionChangeResponse,
2274
- parse_obj_as(
2275
- type_=OrganizationsPreviewSubscriptionChangeResponse, # type: ignore
2276
- object_=_response.json(),
2277
- ),
2278
- )
2279
- return AsyncHttpResponse(response=_response, data=_data)
2280
- if _response.status_code == 400:
2281
- raise BadRequestError(
2282
- headers=dict(_response.headers),
2283
- body=typing.cast(
2284
- typing.Optional[typing.Any],
2285
- parse_obj_as(
2286
- type_=typing.Optional[typing.Any], # type: ignore
2287
- object_=_response.json(),
2288
- ),
2289
- ),
2290
- )
2291
- if _response.status_code == 403:
2292
- raise ForbiddenError(
2293
- headers=dict(_response.headers),
2294
- body=typing.cast(
2295
- PermissionDeniedError,
2296
- parse_obj_as(
2297
- type_=PermissionDeniedError, # type: ignore
2298
- object_=_response.json(),
2299
- ),
2300
- ),
2301
- )
2302
- if _response.status_code == 404:
2303
- raise NotFoundError(
2304
- headers=dict(_response.headers),
2305
- body=typing.cast(
2306
- NotFoundErrorBody,
2307
- parse_obj_as(
2308
- type_=NotFoundErrorBody, # type: ignore
2309
- object_=_response.json(),
2310
- ),
2311
- ),
2312
- )
2313
- if _response.status_code == 429:
2314
- raise TooManyRequestsError(
2315
- headers=dict(_response.headers),
2316
- body=typing.cast(
2317
- RateLimitError,
2318
- parse_obj_as(
2319
- type_=RateLimitError, # type: ignore
2320
- object_=_response.json(),
2321
- ),
2322
- ),
2323
- )
2324
- if _response.status_code == 500:
2325
- raise InternalServerError(
2326
- headers=dict(_response.headers),
2327
- body=typing.cast(
2328
- typing.Optional[typing.Any],
2329
- parse_obj_as(
2330
- type_=typing.Optional[typing.Any], # type: ignore
2331
- object_=_response.json(),
2332
- ),
2333
- ),
2334
- )
2335
- if _response.status_code == 503:
2336
- raise ServiceUnavailableError(
2337
- headers=dict(_response.headers),
2338
- body=typing.cast(
2339
- typing.Optional[typing.Any],
2340
- parse_obj_as(
2341
- type_=typing.Optional[typing.Any], # type: ignore
2342
- object_=_response.json(),
2343
- ),
2344
- ),
2345
- )
2346
- _response_json = _response.json()
2347
- except JSONDecodeError:
2348
- raise ApiError(
2349
- status_code=_response.status_code,
2350
- headers=dict(_response.headers),
2351
- body=_response.text,
2352
- )
2353
- raise ApiError(
2354
- status_code=_response.status_code,
2355
- headers=dict(_response.headers),
2356
- body=_response_json,
2357
- )
2358
-
2359
- async def updatesubscription(
2360
- self,
2361
- id: str,
2362
- *,
2363
- target_plan: OrganizationsUpdateSubscriptionRequestTargetPlan,
2364
- request_options: typing.Optional[RequestOptions] = None,
2365
- ) -> AsyncHttpResponse[OrganizationsUpdateSubscriptionResponse]:
2366
- """
2367
- Parameters
2368
- ----------
2369
- id : str
2370
-
2371
- target_plan : OrganizationsUpdateSubscriptionRequestTargetPlan
2372
-
2373
- request_options : typing.Optional[RequestOptions]
2374
- Request-specific configuration.
2375
-
2376
- Returns
2377
- -------
2378
- AsyncHttpResponse[OrganizationsUpdateSubscriptionResponse]
2379
- Success
2380
- """
2381
- _response = await self._client_wrapper.httpx_client.request(
2382
- f"organizations/{jsonable_encoder(id)}/subscription/update",
2383
- method="POST",
2384
- json={
2385
- "targetPlan": target_plan,
2386
- },
2387
- headers={
2388
- "content-type": "application/json",
2389
- },
2390
- request_options=request_options,
2391
- omit=OMIT,
2392
- )
2393
- try:
2394
- if 200 <= _response.status_code < 300:
2395
- _data = typing.cast(
2396
- OrganizationsUpdateSubscriptionResponse,
2397
- parse_obj_as(
2398
- type_=OrganizationsUpdateSubscriptionResponse, # type: ignore
2399
- object_=_response.json(),
2400
- ),
2401
- )
2402
- return AsyncHttpResponse(response=_response, data=_data)
2403
- if _response.status_code == 400:
2404
- raise BadRequestError(
2405
- headers=dict(_response.headers),
2406
- body=typing.cast(
2407
- typing.Optional[typing.Any],
2408
- parse_obj_as(
2409
- type_=typing.Optional[typing.Any], # type: ignore
2410
- object_=_response.json(),
2411
- ),
2412
- ),
2413
- )
2414
- if _response.status_code == 402:
2415
- raise PaymentRequiredError(
2416
- headers=dict(_response.headers),
2417
- body=typing.cast(
2418
- PlanLimitExceededError,
2419
- parse_obj_as(
2420
- type_=PlanLimitExceededError, # type: ignore
2421
- object_=_response.json(),
2422
- ),
2423
- ),
2424
- )
2425
- if _response.status_code == 403:
2426
- raise ForbiddenError(
2427
- headers=dict(_response.headers),
2428
- body=typing.cast(
2429
- PermissionDeniedError,
2430
- parse_obj_as(
2431
- type_=PermissionDeniedError, # type: ignore
2432
- object_=_response.json(),
2433
- ),
2434
- ),
2435
- )
2436
- if _response.status_code == 404:
2437
- raise NotFoundError(
2438
- headers=dict(_response.headers),
2439
- body=typing.cast(
2440
- NotFoundErrorBody,
2441
- parse_obj_as(
2442
- type_=NotFoundErrorBody, # type: ignore
2443
- object_=_response.json(),
2444
- ),
2445
- ),
2446
- )
2447
- if _response.status_code == 429:
2448
- raise TooManyRequestsError(
2449
- headers=dict(_response.headers),
2450
- body=typing.cast(
2451
- RateLimitError,
2452
- parse_obj_as(
2453
- type_=RateLimitError, # type: ignore
2454
- object_=_response.json(),
2455
- ),
2456
- ),
2457
- )
2458
- if _response.status_code == 500:
2459
- raise InternalServerError(
2460
- headers=dict(_response.headers),
2461
- body=typing.cast(
2462
- typing.Optional[typing.Any],
2463
- parse_obj_as(
2464
- type_=typing.Optional[typing.Any], # type: ignore
2465
- object_=_response.json(),
2466
- ),
2467
- ),
2468
- )
2469
- if _response.status_code == 503:
2470
- raise ServiceUnavailableError(
2471
- headers=dict(_response.headers),
2472
- body=typing.cast(
2473
- typing.Optional[typing.Any],
2474
- parse_obj_as(
2475
- type_=typing.Optional[typing.Any], # type: ignore
2476
- object_=_response.json(),
2477
- ),
2478
- ),
2479
- )
2480
- _response_json = _response.json()
2481
- except JSONDecodeError:
2482
- raise ApiError(
2483
- status_code=_response.status_code,
2484
- headers=dict(_response.headers),
2485
- body=_response.text,
2486
- )
2487
- raise ApiError(
2488
- status_code=_response.status_code,
2489
- headers=dict(_response.headers),
2490
- body=_response_json,
2491
- )
2492
-
2493
- async def cancelscheduleddowngrade(
2494
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
2495
- ) -> AsyncHttpResponse[None]:
2496
- """
2497
- Parameters
2498
- ----------
2499
- id : str
2500
-
2501
- request_options : typing.Optional[RequestOptions]
2502
- Request-specific configuration.
2503
-
2504
- Returns
2505
- -------
2506
- AsyncHttpResponse[None]
2507
- """
2508
- _response = await self._client_wrapper.httpx_client.request(
2509
- f"organizations/{jsonable_encoder(id)}/subscription/cancel-downgrade",
2510
- method="POST",
2511
- request_options=request_options,
2512
- )
2513
- try:
2514
- if 200 <= _response.status_code < 300:
2515
- return AsyncHttpResponse(response=_response, data=None)
2516
- if _response.status_code == 400:
2517
- raise BadRequestError(
2518
- headers=dict(_response.headers),
2519
- body=typing.cast(
2520
- typing.Optional[typing.Any],
2521
- parse_obj_as(
2522
- type_=typing.Optional[typing.Any], # type: ignore
2523
- object_=_response.json(),
2524
- ),
2525
- ),
2526
- )
2527
- if _response.status_code == 403:
2528
- raise ForbiddenError(
2529
- headers=dict(_response.headers),
2530
- body=typing.cast(
2531
- PermissionDeniedError,
2532
- parse_obj_as(
2533
- type_=PermissionDeniedError, # type: ignore
2534
- object_=_response.json(),
2535
- ),
2536
- ),
2537
- )
2538
- if _response.status_code == 404:
2539
- raise NotFoundError(
2540
- headers=dict(_response.headers),
2541
- body=typing.cast(
2542
- NotFoundErrorBody,
2543
- parse_obj_as(
2544
- type_=NotFoundErrorBody, # type: ignore
2545
- object_=_response.json(),
2546
- ),
2547
- ),
2548
- )
2549
- if _response.status_code == 429:
2550
- raise TooManyRequestsError(
2551
- headers=dict(_response.headers),
2552
- body=typing.cast(
2553
- RateLimitError,
2554
- parse_obj_as(
2555
- type_=RateLimitError, # type: ignore
2556
- object_=_response.json(),
2557
- ),
2558
- ),
2559
- )
2560
- if _response.status_code == 500:
2561
- raise InternalServerError(
2562
- headers=dict(_response.headers),
2563
- body=typing.cast(
2564
- typing.Optional[typing.Any],
2565
- parse_obj_as(
2566
- type_=typing.Optional[typing.Any], # type: ignore
2567
- object_=_response.json(),
2568
- ),
2569
- ),
2570
- )
2571
- if _response.status_code == 503:
2572
- raise ServiceUnavailableError(
2573
- headers=dict(_response.headers),
2574
- body=typing.cast(
2575
- typing.Optional[typing.Any],
2576
- parse_obj_as(
2577
- type_=typing.Optional[typing.Any], # type: ignore
2578
- object_=_response.json(),
2579
- ),
2580
- ),
2581
- )
2582
- _response_json = _response.json()
2583
- except JSONDecodeError:
2584
- raise ApiError(
2585
- status_code=_response.status_code,
2586
- headers=dict(_response.headers),
2587
- body=_response.text,
2588
- )
2589
- raise ApiError(
2590
- status_code=_response.status_code,
2591
- headers=dict(_response.headers),
2592
- body=_response_json,
2593
- )