wavix-python-sdk 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (497) hide show
  1. wavix/__init__.py +801 -0
  2. wavix/_default_clients.py +32 -0
  3. wavix/api_keys/__init__.py +4 -0
  4. wavix/api_keys/client.py +764 -0
  5. wavix/api_keys/raw_client.py +1191 -0
  6. wavix/billing/__init__.py +41 -0
  7. wavix/billing/client.py +82 -0
  8. wavix/billing/invoices/__init__.py +34 -0
  9. wavix/billing/invoices/client.py +203 -0
  10. wavix/billing/invoices/raw_client.py +302 -0
  11. wavix/billing/invoices/types/__init__.py +34 -0
  12. wavix/billing/invoices/types/list_invoices_response.py +31 -0
  13. wavix/billing/raw_client.py +13 -0
  14. wavix/billing/transactions/__init__.py +34 -0
  15. wavix/billing/transactions/client.py +209 -0
  16. wavix/billing/transactions/raw_client.py +253 -0
  17. wavix/billing/transactions/types/__init__.py +34 -0
  18. wavix/billing/transactions/types/list_transactions_response.py +31 -0
  19. wavix/buy/__init__.py +61 -0
  20. wavix/buy/cities/__init__.py +34 -0
  21. wavix/buy/cities/client.py +134 -0
  22. wavix/buy/cities/raw_client.py +201 -0
  23. wavix/buy/cities/types/__init__.py +34 -0
  24. wavix/buy/cities/types/list_cities_response.py +23 -0
  25. wavix/buy/client.py +139 -0
  26. wavix/buy/countries/__init__.py +34 -0
  27. wavix/buy/countries/client.py +116 -0
  28. wavix/buy/countries/raw_client.py +144 -0
  29. wavix/buy/countries/types/__init__.py +34 -0
  30. wavix/buy/countries/types/list_countries_response.py +23 -0
  31. wavix/buy/numbers/__init__.py +34 -0
  32. wavix/buy/numbers/client.py +168 -0
  33. wavix/buy/numbers/raw_client.py +227 -0
  34. wavix/buy/numbers/types/__init__.py +34 -0
  35. wavix/buy/numbers/types/list_numbers_response.py +26 -0
  36. wavix/buy/raw_client.py +13 -0
  37. wavix/buy/region_cities/__init__.py +34 -0
  38. wavix/buy/region_cities/client.py +142 -0
  39. wavix/buy/region_cities/raw_client.py +207 -0
  40. wavix/buy/region_cities/types/__init__.py +34 -0
  41. wavix/buy/region_cities/types/list_region_cities_response.py +23 -0
  42. wavix/buy/regions/__init__.py +34 -0
  43. wavix/buy/regions/client.py +132 -0
  44. wavix/buy/regions/raw_client.py +222 -0
  45. wavix/buy/regions/types/__init__.py +34 -0
  46. wavix/buy/regions/types/list_regions_response.py +23 -0
  47. wavix/call_control/__init__.py +40 -0
  48. wavix/call_control/audio/__init__.py +4 -0
  49. wavix/call_control/audio/client.py +195 -0
  50. wavix/call_control/audio/raw_client.py +333 -0
  51. wavix/call_control/client.py +796 -0
  52. wavix/call_control/raw_client.py +1224 -0
  53. wavix/call_control/streams/__init__.py +4 -0
  54. wavix/call_control/streams/client.py +250 -0
  55. wavix/call_control/streams/raw_client.py +325 -0
  56. wavix/call_control/types/__init__.py +38 -0
  57. wavix/call_control/types/call_dtmf_collect_request_prompt.py +33 -0
  58. wavix/call_control/types/call_dtmf_collect_request_prompt_say.py +31 -0
  59. wavix/call_recording/__init__.py +4 -0
  60. wavix/call_recording/client.py +430 -0
  61. wavix/call_recording/raw_client.py +726 -0
  62. wavix/call_webhooks/__init__.py +37 -0
  63. wavix/call_webhooks/client.py +281 -0
  64. wavix/call_webhooks/raw_client.py +529 -0
  65. wavix/call_webhooks/types/__init__.py +38 -0
  66. wavix/call_webhooks/types/call_webhooks_create_request_event_type.py +5 -0
  67. wavix/call_webhooks/types/delete_call_webhooks_request_event_type.py +5 -0
  68. wavix/cart/__init__.py +38 -0
  69. wavix/cart/client.py +327 -0
  70. wavix/cart/raw_client.py +629 -0
  71. wavix/cart/types/__init__.py +40 -0
  72. wavix/cart/types/checkout_cart_response.py +22 -0
  73. wavix/cart/types/get_cart_response.py +29 -0
  74. wavix/cart/types/remove_cart_response.py +22 -0
  75. wavix/cdrs/__init__.py +39 -0
  76. wavix/cdrs/client.py +968 -0
  77. wavix/cdrs/raw_client.py +1176 -0
  78. wavix/cdrs/transcription/__init__.py +4 -0
  79. wavix/cdrs/transcription/client.py +112 -0
  80. wavix/cdrs/transcription/raw_client.py +156 -0
  81. wavix/cdrs/types/__init__.py +38 -0
  82. wavix/cdrs/types/cdr_search_request_disposition.py +5 -0
  83. wavix/cdrs/types/cdr_search_request_type.py +5 -0
  84. wavix/client.py +578 -0
  85. wavix/core/__init__.py +127 -0
  86. wavix/core/api_error.py +23 -0
  87. wavix/core/client_wrapper.py +119 -0
  88. wavix/core/datetime_utils.py +70 -0
  89. wavix/core/file.py +67 -0
  90. wavix/core/force_multipart.py +18 -0
  91. wavix/core/http_client.py +839 -0
  92. wavix/core/http_response.py +59 -0
  93. wavix/core/http_sse/__init__.py +42 -0
  94. wavix/core/http_sse/_api.py +170 -0
  95. wavix/core/http_sse/_decoders.py +61 -0
  96. wavix/core/http_sse/_exceptions.py +7 -0
  97. wavix/core/http_sse/_models.py +17 -0
  98. wavix/core/jsonable_encoder.py +120 -0
  99. wavix/core/logging.py +107 -0
  100. wavix/core/parse_error.py +36 -0
  101. wavix/core/pydantic_utilities.py +508 -0
  102. wavix/core/query_encoder.py +58 -0
  103. wavix/core/remove_none_from_dict.py +11 -0
  104. wavix/core/request_options.py +35 -0
  105. wavix/core/serialization.py +347 -0
  106. wavix/environment.py +7 -0
  107. wavix/errors/__init__.py +56 -0
  108. wavix/errors/bad_request_error.py +10 -0
  109. wavix/errors/forbidden_error.py +10 -0
  110. wavix/errors/not_found_error.py +10 -0
  111. wavix/errors/service_unavailable_error.py +11 -0
  112. wavix/errors/too_many_requests_error.py +11 -0
  113. wavix/errors/unauthorized_error.py +11 -0
  114. wavix/errors/unprocessable_entity_error.py +10 -0
  115. wavix/link_shortener/__init__.py +34 -0
  116. wavix/link_shortener/client.py +194 -0
  117. wavix/link_shortener/metrics/__init__.py +4 -0
  118. wavix/link_shortener/metrics/client.py +198 -0
  119. wavix/link_shortener/metrics/raw_client.py +218 -0
  120. wavix/link_shortener/raw_client.py +265 -0
  121. wavix/number_validator/__init__.py +35 -0
  122. wavix/number_validator/client.py +271 -0
  123. wavix/number_validator/raw_client.py +383 -0
  124. wavix/number_validator/results/__init__.py +4 -0
  125. wavix/number_validator/results/client.py +114 -0
  126. wavix/number_validator/results/raw_client.py +156 -0
  127. wavix/number_validator/types/__init__.py +34 -0
  128. wavix/number_validator/types/get_number_validator_response.py +112 -0
  129. wavix/numbers/__init__.py +39 -0
  130. wavix/numbers/client.py +689 -0
  131. wavix/numbers/papers/__init__.py +4 -0
  132. wavix/numbers/papers/client.py +155 -0
  133. wavix/numbers/papers/raw_client.py +208 -0
  134. wavix/numbers/raw_client.py +1000 -0
  135. wavix/numbers/types/__init__.py +38 -0
  136. wavix/numbers/types/bulk_update_numbers_response.py +23 -0
  137. wavix/numbers/types/delete_numbers_response.py +22 -0
  138. wavix/profile/__init__.py +41 -0
  139. wavix/profile/client.py +308 -0
  140. wavix/profile/config/__init__.py +34 -0
  141. wavix/profile/config/client.py +100 -0
  142. wavix/profile/config/raw_client.py +124 -0
  143. wavix/profile/config/types/__init__.py +34 -0
  144. wavix/profile/config/types/get_config_response.py +25 -0
  145. wavix/profile/raw_client.py +360 -0
  146. wavix/profile/types/__init__.py +38 -0
  147. wavix/profile/types/profile_update_request_company_info.py +48 -0
  148. wavix/profile/types/profile_update_request_company_info_industry.py +22 -0
  149. wavix/py.typed +0 -0
  150. wavix/sip_trunks/__init__.py +4 -0
  151. wavix/sip_trunks/client.py +927 -0
  152. wavix/sip_trunks/raw_client.py +1324 -0
  153. wavix/sms_and_mms/__init__.py +66 -0
  154. wavix/sms_and_mms/client.py +101 -0
  155. wavix/sms_and_mms/messages/__init__.py +49 -0
  156. wavix/sms_and_mms/messages/client.py +625 -0
  157. wavix/sms_and_mms/messages/raw_client.py +793 -0
  158. wavix/sms_and_mms/messages/types/__init__.py +47 -0
  159. wavix/sms_and_mms/messages/types/get_messages_response.py +97 -0
  160. wavix/sms_and_mms/messages/types/list_all_messages_request_message_type.py +5 -0
  161. wavix/sms_and_mms/messages/types/list_messages_request_message_type.py +5 -0
  162. wavix/sms_and_mms/messages/types/list_messages_response.py +26 -0
  163. wavix/sms_and_mms/opt_outs/__init__.py +34 -0
  164. wavix/sms_and_mms/opt_outs/client.py +277 -0
  165. wavix/sms_and_mms/opt_outs/raw_client.py +438 -0
  166. wavix/sms_and_mms/opt_outs/types/__init__.py +34 -0
  167. wavix/sms_and_mms/opt_outs/types/create_opt_outs_response.py +22 -0
  168. wavix/sms_and_mms/raw_client.py +13 -0
  169. wavix/sms_and_mms/sender_ids/__init__.py +38 -0
  170. wavix/sms_and_mms/sender_ids/client.py +391 -0
  171. wavix/sms_and_mms/sender_ids/raw_client.py +617 -0
  172. wavix/sms_and_mms/sender_ids/types/__init__.py +40 -0
  173. wavix/sms_and_mms/sender_ids/types/delete_sender_ids_response.py +22 -0
  174. wavix/sms_and_mms/sender_ids/types/sender_id_create_request_monthly_volume.py +7 -0
  175. wavix/sms_and_mms/sender_ids/types/sender_id_create_request_usecase.py +5 -0
  176. wavix/speech_analytics/__init__.py +52 -0
  177. wavix/speech_analytics/client.py +372 -0
  178. wavix/speech_analytics/file/__init__.py +4 -0
  179. wavix/speech_analytics/file/client.py +114 -0
  180. wavix/speech_analytics/file/raw_client.py +148 -0
  181. wavix/speech_analytics/raw_client.py +527 -0
  182. wavix/speech_analytics/types/__init__.py +47 -0
  183. wavix/speech_analytics/types/create_speech_analytics_response.py +32 -0
  184. wavix/speech_analytics/types/get_speech_analytics_response.py +77 -0
  185. wavix/speech_analytics/types/get_speech_analytics_response_language.py +5 -0
  186. wavix/speech_analytics/types/get_speech_analytics_response_status.py +5 -0
  187. wavix/sub_accounts/__init__.py +52 -0
  188. wavix/sub_accounts/client.py +442 -0
  189. wavix/sub_accounts/raw_client.py +775 -0
  190. wavix/sub_accounts/transactions/__init__.py +4 -0
  191. wavix/sub_accounts/transactions/client.py +198 -0
  192. wavix/sub_accounts/transactions/raw_client.py +265 -0
  193. wavix/sub_accounts/types/__init__.py +47 -0
  194. wavix/sub_accounts/types/list_sub_accounts_request_status.py +5 -0
  195. wavix/sub_accounts/types/sub_accounts_create_request_default_destinations.py +31 -0
  196. wavix/sub_accounts/types/sub_accounts_update_request_default_destinations.py +31 -0
  197. wavix/sub_accounts/types/sub_accounts_update_request_status.py +5 -0
  198. wavix/ten_dlc/__init__.py +167 -0
  199. wavix/ten_dlc/brand_appeals/__init__.py +34 -0
  200. wavix/ten_dlc/brand_appeals/client.py +244 -0
  201. wavix/ten_dlc/brand_appeals/raw_client.py +390 -0
  202. wavix/ten_dlc/brand_appeals/types/__init__.py +34 -0
  203. wavix/ten_dlc/brand_appeals/types/create_brand_appeals_response.py +22 -0
  204. wavix/ten_dlc/brand_evidence/__init__.py +37 -0
  205. wavix/ten_dlc/brand_evidence/client.py +365 -0
  206. wavix/ten_dlc/brand_evidence/raw_client.py +599 -0
  207. wavix/ten_dlc/brand_evidence/types/__init__.py +38 -0
  208. wavix/ten_dlc/brand_evidence/types/delete_brand_evidence_response.py +22 -0
  209. wavix/ten_dlc/brand_evidence/types/upload_brand_evidence_response.py +38 -0
  210. wavix/ten_dlc/brand_vetting_appeals/__init__.py +34 -0
  211. wavix/ten_dlc/brand_vetting_appeals/client.py +258 -0
  212. wavix/ten_dlc/brand_vetting_appeals/raw_client.py +381 -0
  213. wavix/ten_dlc/brand_vetting_appeals/types/__init__.py +36 -0
  214. wavix/ten_dlc/brand_vetting_appeals/types/create_brand_vetting_appeals_response.py +22 -0
  215. wavix/ten_dlc/brand_vettings/__init__.py +4 -0
  216. wavix/ten_dlc/brand_vettings/client.py +325 -0
  217. wavix/ten_dlc/brand_vettings/raw_client.py +518 -0
  218. wavix/ten_dlc/brands/__init__.py +85 -0
  219. wavix/ten_dlc/brands/client.py +870 -0
  220. wavix/ten_dlc/brands/raw_client.py +1263 -0
  221. wavix/ten_dlc/brands/types/__init__.py +83 -0
  222. wavix/ten_dlc/brands/types/create_brands_response.py +143 -0
  223. wavix/ten_dlc/brands/types/create_brands_response_entity_type.py +7 -0
  224. wavix/ten_dlc/brands/types/create_brands_response_status.py +7 -0
  225. wavix/ten_dlc/brands/types/delete_brands_response.py +22 -0
  226. wavix/ten_dlc/brands/types/get_brands_response.py +143 -0
  227. wavix/ten_dlc/brands/types/get_brands_response_entity_type.py +7 -0
  228. wavix/ten_dlc/brands/types/get_brands_response_status.py +7 -0
  229. wavix/ten_dlc/brands/types/list_brands_response.py +33 -0
  230. wavix/ten_dlc/brands/types/list_brands_response_pagination.py +41 -0
  231. wavix/ten_dlc/brands/types/qualify_usecase_brands_request_use_case.py +35 -0
  232. wavix/ten_dlc/brands/types/qualify_usecase_brands_response.py +33 -0
  233. wavix/ten_dlc/brands/types/ten_dlc_brand_update_request_entity_type.py +7 -0
  234. wavix/ten_dlc/brands/types/ten_dlc_brand_update_request_vertical.py +18 -0
  235. wavix/ten_dlc/brands/types/update_brands_response.py +143 -0
  236. wavix/ten_dlc/brands/types/update_brands_response_entity_type.py +7 -0
  237. wavix/ten_dlc/brands/types/update_brands_response_status.py +7 -0
  238. wavix/ten_dlc/campaign_numbers/__init__.py +38 -0
  239. wavix/ten_dlc/campaign_numbers/client.py +304 -0
  240. wavix/ten_dlc/campaign_numbers/raw_client.py +448 -0
  241. wavix/ten_dlc/campaign_numbers/types/__init__.py +40 -0
  242. wavix/ten_dlc/campaign_numbers/types/link_campaign_numbers_response.py +22 -0
  243. wavix/ten_dlc/campaign_numbers/types/list_campaign_numbers_response.py +33 -0
  244. wavix/ten_dlc/campaign_numbers/types/unlink_campaign_numbers_response.py +22 -0
  245. wavix/ten_dlc/campaigns/__init__.py +64 -0
  246. wavix/ten_dlc/campaigns/client.py +1493 -0
  247. wavix/ten_dlc/campaigns/raw_client.py +1840 -0
  248. wavix/ten_dlc/campaigns/types/__init__.py +62 -0
  249. wavix/ten_dlc/campaigns/types/create_campaigns_response.py +211 -0
  250. wavix/ten_dlc/campaigns/types/delete_campaigns_response.py +22 -0
  251. wavix/ten_dlc/campaigns/types/get_campaigns_response.py +211 -0
  252. wavix/ten_dlc/campaigns/types/list_by_brand_campaigns_response.py +33 -0
  253. wavix/ten_dlc/campaigns/types/list_by_brand_campaigns_response_pagination.py +41 -0
  254. wavix/ten_dlc/campaigns/types/list_campaigns_response.py +33 -0
  255. wavix/ten_dlc/campaigns/types/list_campaigns_response_pagination.py +41 -0
  256. wavix/ten_dlc/campaigns/types/ten_dlc_campaign_update_request_usecase.py +15 -0
  257. wavix/ten_dlc/campaigns/types/update_campaigns_response.py +211 -0
  258. wavix/ten_dlc/client.py +196 -0
  259. wavix/ten_dlc/raw_client.py +13 -0
  260. wavix/ten_dlc/subscriptions/__init__.py +37 -0
  261. wavix/ten_dlc/subscriptions/client.py +271 -0
  262. wavix/ten_dlc/subscriptions/raw_client.py +398 -0
  263. wavix/ten_dlc/subscriptions/types/__init__.py +38 -0
  264. wavix/ten_dlc/subscriptions/types/create_subscriptions_response.py +31 -0
  265. wavix/ten_dlc/subscriptions/types/delete_subscriptions_response.py +22 -0
  266. wavix/two_fa/__init__.py +56 -0
  267. wavix/two_fa/client.py +101 -0
  268. wavix/two_fa/events/__init__.py +4 -0
  269. wavix/two_fa/events/client.py +114 -0
  270. wavix/two_fa/events/raw_client.py +156 -0
  271. wavix/two_fa/raw_client.py +13 -0
  272. wavix/two_fa/sessions/__init__.py +4 -0
  273. wavix/two_fa/sessions/client.py +142 -0
  274. wavix/two_fa/sessions/raw_client.py +200 -0
  275. wavix/two_fa/verification/__init__.py +49 -0
  276. wavix/two_fa/verification/client.py +395 -0
  277. wavix/two_fa/verification/raw_client.py +664 -0
  278. wavix/two_fa/verification/types/__init__.py +47 -0
  279. wavix/two_fa/verification/types/check_verification_response.py +22 -0
  280. wavix/two_fa/verification/types/create_verification_response.py +51 -0
  281. wavix/two_fa/verification/types/resend_verification_response.py +38 -0
  282. wavix/two_fa/verification/types/two_factor_verification_resend_request_channel.py +5 -0
  283. wavix/types/__init__.py +637 -0
  284. wavix/types/account_error_response.py +31 -0
  285. wavix/types/account_limits.py +32 -0
  286. wavix/types/allowed_i_ps.py +7 -0
  287. wavix/types/allowed_i_ps_item.py +27 -0
  288. wavix/types/api_key.py +138 -0
  289. wavix/types/api_key_calls_scope_permission.py +30 -0
  290. wavix/types/api_key_calls_scope_permission_allow.py +5 -0
  291. wavix/types/api_key_scope_permission.py +30 -0
  292. wavix/types/api_key_scope_permission_allow.py +5 -0
  293. wavix/types/available_number.py +97 -0
  294. wavix/types/available_number_list_response.py +26 -0
  295. wavix/types/bad_request_error_body.py +27 -0
  296. wavix/types/billing_transaction_list_response.py +31 -0
  297. wavix/types/brand_status_updated_webhook.py +28 -0
  298. wavix/types/brand_status_updated_webhook_status.py +7 -0
  299. wavix/types/call.py +92 -0
  300. wavix/types/call_control_validation_error_response.py +34 -0
  301. wavix/types/call_create_response.py +92 -0
  302. wavix/types/call_create_response_event_type.py +18 -0
  303. wavix/types/call_direction.py +5 -0
  304. wavix/types/call_disposition.py +5 -0
  305. wavix/types/call_event_type.py +18 -0
  306. wavix/types/call_list_response.py +28 -0
  307. wavix/types/call_recording_list_response.py +28 -0
  308. wavix/types/call_response.py +24 -0
  309. wavix/types/call_status_webhook.py +70 -0
  310. wavix/types/call_status_webhook_direction.py +5 -0
  311. wavix/types/call_stream_channel.py +5 -0
  312. wavix/types/call_stream_response.py +27 -0
  313. wavix/types/call_stream_type.py +5 -0
  314. wavix/types/call_webhook.py +37 -0
  315. wavix/types/call_webhook_event_type.py +5 -0
  316. wavix/types/call_webhook_list_response.py +10 -0
  317. wavix/types/call_webhook_list_response_item.py +28 -0
  318. wavix/types/call_webhook_list_response_item_event_type.py +5 -0
  319. wavix/types/campaign_status_updated_webhook.py +41 -0
  320. wavix/types/campaign_status_updated_webhook_status.py +7 -0
  321. wavix/types/cart_response.py +29 -0
  322. wavix/types/cdr.py +97 -0
  323. wavix/types/cdr_list_response.py +26 -0
  324. wavix/types/cdr_response.py +104 -0
  325. wavix/types/cdr_transcription_completed_webhook.py +28 -0
  326. wavix/types/cdr_transcription_completed_webhook_status.py +5 -0
  327. wavix/types/cdr_transcription_response.py +74 -0
  328. wavix/types/cdr_transcription_search_response.py +26 -0
  329. wavix/types/cdr_with_transcription.py +97 -0
  330. wavix/types/city.py +32 -0
  331. wavix/types/city_list_response.py +23 -0
  332. wavix/types/country.py +32 -0
  333. wavix/types/country_has_no_regions_error_response.py +27 -0
  334. wavix/types/country_list_response.py +23 -0
  335. wavix/types/document_type.py +32 -0
  336. wavix/types/document_type_id.py +7 -0
  337. wavix/types/file_transcript_response.py +30 -0
  338. wavix/types/file_transcript_turn.py +46 -0
  339. wavix/types/file_transcription_completed_webhook.py +32 -0
  340. wavix/types/file_transcription_response.py +77 -0
  341. wavix/types/file_transcription_response_language.py +5 -0
  342. wavix/types/file_transcription_response_status.py +5 -0
  343. wavix/types/financial_transaction.py +57 -0
  344. wavix/types/forbidden_error_response.py +27 -0
  345. wavix/types/inbound_call_destination.py +53 -0
  346. wavix/types/inbound_call_transport.py +6 -0
  347. wavix/types/inbound_message.py +46 -0
  348. wavix/types/invalid_recording.py +31 -0
  349. wavix/types/invoice.py +42 -0
  350. wavix/types/invoice_list_response.py +31 -0
  351. wavix/types/list_brand_evidence_response.py +23 -0
  352. wavix/types/list_sessions_response_item.py +58 -0
  353. wavix/types/message.py +103 -0
  354. wavix/types/message_body.py +29 -0
  355. wavix/types/message_create_request.py +46 -0
  356. wavix/types/message_delivery_status.py +8 -0
  357. wavix/types/message_list_response.py +26 -0
  358. wavix/types/message_response.py +97 -0
  359. wavix/types/messages_delivery_report.py +81 -0
  360. wavix/types/not_found_error_body.py +27 -0
  361. wavix/types/not_found_error_response.py +27 -0
  362. wavix/types/number.py +160 -0
  363. wavix/types/number_destination.py +38 -0
  364. wavix/types/number_document.py +58 -0
  365. wavix/types/number_list_response.py +32 -0
  366. wavix/types/number_status_updated_webhook.py +38 -0
  367. wavix/types/number_status_updated_webhook_status.py +5 -0
  368. wavix/types/number_validator_create_bulk_response.py +10 -0
  369. wavix/types/number_validator_create_bulk_response_request_id.py +26 -0
  370. wavix/types/on_call_event_payload.py +34 -0
  371. wavix/types/on_call_event_payload_type.py +5 -0
  372. wavix/types/opt_out.py +27 -0
  373. wavix/types/opt_out_item.py +38 -0
  374. wavix/types/opt_outs_list_response.py +26 -0
  375. wavix/types/pagination.py +37 -0
  376. wavix/types/phone_lookup_details.py +32 -0
  377. wavix/types/phone_number_validation_type.py +5 -0
  378. wavix/types/phone_validation_batch_response.py +38 -0
  379. wavix/types/phone_validation_batch_result_response.py +41 -0
  380. wavix/types/phone_validation_response.py +112 -0
  381. wavix/types/phone_validation_result_response.py +115 -0
  382. wavix/types/profile_config_response.py +25 -0
  383. wavix/types/profile_response.py +79 -0
  384. wavix/types/profile_response_company_info.py +53 -0
  385. wavix/types/profile_response_company_info_country.py +31 -0
  386. wavix/types/profile_response_company_info_industry.py +22 -0
  387. wavix/types/profile_response_default_destinations_item.py +27 -0
  388. wavix/types/record_not_found_error_response.py +27 -0
  389. wavix/types/recording.py +57 -0
  390. wavix/types/recording_deleted_error_response.py +38 -0
  391. wavix/types/region.py +31 -0
  392. wavix/types/region_list_response.py +23 -0
  393. wavix/types/send_messages_response.py +100 -0
  394. wavix/types/sender_id.py +48 -0
  395. wavix/types/sender_id_details.py +44 -0
  396. wavix/types/sender_id_list_response.py +23 -0
  397. wavix/types/sender_id_response.py +48 -0
  398. wavix/types/sender_id_response_type.py +5 -0
  399. wavix/types/sender_id_type.py +5 -0
  400. wavix/types/short_link_metrics_item.py +69 -0
  401. wavix/types/short_link_metrics_response.py +26 -0
  402. wavix/types/short_link_response.py +22 -0
  403. wavix/types/sip_trunk_create_request.py +132 -0
  404. wavix/types/sip_trunk_create_request_allowed_ips_item.py +22 -0
  405. wavix/types/sip_trunk_create_request_host_request.py +26 -0
  406. wavix/types/sip_trunk_list_response.py +26 -0
  407. wavix/types/sip_trunk_response.py +145 -0
  408. wavix/types/sip_trunk_summary.py +114 -0
  409. wavix/types/sip_trunk_summary_host_request.py +31 -0
  410. wavix/types/sub_accounts_list_response.py +26 -0
  411. wavix/types/sub_accounts_transactions_list_response.py +30 -0
  412. wavix/types/sub_accounts_transactions_list_response_transactions_item.py +48 -0
  413. wavix/types/sub_organization_response.py +59 -0
  414. wavix/types/sub_organization_response_default_destinations.py +31 -0
  415. wavix/types/sub_organization_response_status.py +5 -0
  416. wavix/types/submit_file_transcription_response.py +32 -0
  417. wavix/types/success_response.py +22 -0
  418. wavix/types/tcr_error_message.py +27 -0
  419. wavix/types/tcr_feedback.py +23 -0
  420. wavix/types/tcr_feedback_category.py +47 -0
  421. wavix/types/ten_dlc_brand.py +143 -0
  422. wavix/types/ten_dlc_brand_appeal.py +54 -0
  423. wavix/types/ten_dlc_brand_appeal_create_request.py +36 -0
  424. wavix/types/ten_dlc_brand_appeal_outcome.py +38 -0
  425. wavix/types/ten_dlc_brand_appeal_outcome_feedback.py +27 -0
  426. wavix/types/ten_dlc_brand_appeal_outcome_vetting_status.py +7 -0
  427. wavix/types/ten_dlc_brand_create_request.py +8 -0
  428. wavix/types/ten_dlc_brand_create_request_entity_type.py +7 -0
  429. wavix/types/ten_dlc_brand_create_request_stock_exchange.py +26 -0
  430. wavix/types/ten_dlc_brand_create_request_stock_exchange_entity_type.py +7 -0
  431. wavix/types/ten_dlc_brand_create_request_vertical.py +18 -0
  432. wavix/types/ten_dlc_brand_create_request_zero.py +24 -0
  433. wavix/types/ten_dlc_brand_create_request_zero_entity_type.py +5 -0
  434. wavix/types/ten_dlc_brand_entity_type.py +7 -0
  435. wavix/types/ten_dlc_brand_evidence.py +38 -0
  436. wavix/types/ten_dlc_brand_identity_verification_status.py +7 -0
  437. wavix/types/ten_dlc_brand_list_response.py +33 -0
  438. wavix/types/ten_dlc_brand_list_response_pagination.py +41 -0
  439. wavix/types/ten_dlc_brand_qualification_result.py +33 -0
  440. wavix/types/ten_dlc_brand_status.py +7 -0
  441. wavix/types/ten_dlc_brand_vetting.py +71 -0
  442. wavix/types/ten_dlc_brand_vetting_appeal.py +78 -0
  443. wavix/types/ten_dlc_brand_vetting_appeal_appeal_outcome.py +37 -0
  444. wavix/types/ten_dlc_brand_vetting_appeal_appeal_outcome_feedback.py +26 -0
  445. wavix/types/ten_dlc_brand_vetting_appeal_outcome.py +33 -0
  446. wavix/types/ten_dlc_brand_vetting_appeal_outcome_feedback.py +26 -0
  447. wavix/types/ten_dlc_brand_vetting_appeal_outcome_reason.py +22 -0
  448. wavix/types/ten_dlc_campaign.py +211 -0
  449. wavix/types/ten_dlc_campaign_list_response.py +33 -0
  450. wavix/types/ten_dlc_campaign_list_response_pagination.py +41 -0
  451. wavix/types/ten_dlc_campaign_nudge_request.py +32 -0
  452. wavix/types/ten_dlc_campaign_number.py +27 -0
  453. wavix/types/ten_dlc_campaign_number_list_response.py +33 -0
  454. wavix/types/ten_dlc_event_subscription.py +31 -0
  455. wavix/types/ten_dlcmno_metadata.py +101 -0
  456. wavix/types/transaction_status.py +5 -0
  457. wavix/types/transaction_type.py +50 -0
  458. wavix/types/transcript_turn.py +46 -0
  459. wavix/types/transcription_filter.py +35 -0
  460. wavix/types/transcription_filter_agent.py +36 -0
  461. wavix/types/transcription_filter_any.py +36 -0
  462. wavix/types/transcription_filter_client.py +36 -0
  463. wavix/types/transcription_language.py +5 -0
  464. wavix/types/transcription_reference.py +29 -0
  465. wavix/types/transcription_status.py +5 -0
  466. wavix/types/tts_language.py +5 -0
  467. wavix/types/tts_voice_id.py +25 -0
  468. wavix/types/two_factor_verification_check_response.py +22 -0
  469. wavix/types/two_factor_verification_event.py +47 -0
  470. wavix/types/two_factor_verification_resend_response.py +38 -0
  471. wavix/types/two_factor_verification_response.py +51 -0
  472. wavix/types/unauthorized_error_response.py +32 -0
  473. wavix/types/unprocessable_entity_error_body.py +27 -0
  474. wavix/types/validation_error_response.py +27 -0
  475. wavix/types/voice_campaign_create_request.py +20 -0
  476. wavix/types/voice_campaign_response.py +41 -0
  477. wavix/types/voice_campaigns_create_response.py +20 -0
  478. wavix/types/voice_campaigns_create_response_voice_campaign.py +43 -0
  479. wavix/types/voice_campaigns_get_response.py +20 -0
  480. wavix/types/voice_campaigns_get_response_voice_campaign.py +43 -0
  481. wavix/types/web_rtc_token.py +43 -0
  482. wavix/types/web_rtc_token_response.py +44 -0
  483. wavix/types/web_rtc_tokens_list_response.py +30 -0
  484. wavix/version.py +3 -0
  485. wavix/voice_campaigns/__init__.py +4 -0
  486. wavix/voice_campaigns/client.py +197 -0
  487. wavix/voice_campaigns/raw_client.py +332 -0
  488. wavix/webrtc/__init__.py +34 -0
  489. wavix/webrtc/client.py +63 -0
  490. wavix/webrtc/raw_client.py +13 -0
  491. wavix/webrtc/tokens/__init__.py +4 -0
  492. wavix/webrtc/tokens/client.py +432 -0
  493. wavix/webrtc/tokens/raw_client.py +869 -0
  494. wavix_python_sdk-1.0.0.dist-info/LICENSE +21 -0
  495. wavix_python_sdk-1.0.0.dist-info/METADATA +339 -0
  496. wavix_python_sdk-1.0.0.dist-info/RECORD +497 -0
  497. wavix_python_sdk-1.0.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,1191 @@
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 encode_path_param
10
+ from ..core.parse_error import ParsingError
11
+ from ..core.pydantic_utilities import parse_obj_as
12
+ from ..core.request_options import RequestOptions
13
+ from ..core.serialization import convert_and_respect_annotation_metadata
14
+ from ..errors.bad_request_error import BadRequestError
15
+ from ..errors.forbidden_error import ForbiddenError
16
+ from ..errors.not_found_error import NotFoundError
17
+ from ..errors.unauthorized_error import UnauthorizedError
18
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
19
+ from ..types.api_key import ApiKey
20
+ from ..types.api_key_calls_scope_permission import ApiKeyCallsScopePermission
21
+ from ..types.api_key_scope_permission import ApiKeyScopePermission
22
+ from ..types.success_response import SuccessResponse
23
+ from ..types.unauthorized_error_response import UnauthorizedErrorResponse
24
+ from pydantic import ValidationError
25
+
26
+ # this is used as the default value for optional parameters
27
+ OMIT = typing.cast(typing.Any, ...)
28
+
29
+
30
+ class RawApiKeysClient:
31
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
32
+ self._client_wrapper = client_wrapper
33
+
34
+ def list(
35
+ self, *, label: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
36
+ ) -> HttpResponse[typing.List[ApiKey]]:
37
+ """
38
+ Returns the API keys belonging to the authenticated account.
39
+
40
+ Parameters
41
+ ----------
42
+ label : typing.Optional[str]
43
+ Filters API keys by `label`. Matches partial values.
44
+
45
+ request_options : typing.Optional[RequestOptions]
46
+ Request-specific configuration.
47
+
48
+ Returns
49
+ -------
50
+ HttpResponse[typing.List[ApiKey]]
51
+ Returns the list of API keys.
52
+ """
53
+ _response = self._client_wrapper.httpx_client.request(
54
+ "v1/api-keys",
55
+ method="GET",
56
+ params={
57
+ "label": label,
58
+ },
59
+ request_options=request_options,
60
+ )
61
+ try:
62
+ if 200 <= _response.status_code < 300:
63
+ _data = typing.cast(
64
+ typing.List[ApiKey],
65
+ parse_obj_as(
66
+ type_=typing.List[ApiKey], # type: ignore
67
+ object_=_response.json(),
68
+ ),
69
+ )
70
+ return HttpResponse(response=_response, data=_data)
71
+ if _response.status_code == 401:
72
+ raise UnauthorizedError(
73
+ headers=dict(_response.headers),
74
+ body=typing.cast(
75
+ UnauthorizedErrorResponse,
76
+ parse_obj_as(
77
+ type_=UnauthorizedErrorResponse, # type: ignore
78
+ object_=_response.json(),
79
+ ),
80
+ ),
81
+ )
82
+ if _response.status_code == 403:
83
+ raise ForbiddenError(
84
+ headers=dict(_response.headers),
85
+ body=typing.cast(
86
+ typing.Any,
87
+ parse_obj_as(
88
+ type_=typing.Any, # type: ignore
89
+ object_=_response.json(),
90
+ ),
91
+ ),
92
+ )
93
+ _response_json = _response.json()
94
+ except JSONDecodeError:
95
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
96
+ except ValidationError as e:
97
+ raise ParsingError(
98
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
99
+ )
100
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
101
+
102
+ def create(
103
+ self,
104
+ *,
105
+ label: str,
106
+ active: typing.Optional[bool] = OMIT,
107
+ restricted: typing.Optional[bool] = OMIT,
108
+ permitted_ips: typing.Optional[typing.Sequence[str]] = OMIT,
109
+ scopes_enabled: typing.Optional[bool] = OMIT,
110
+ numbers: typing.Optional[ApiKeyScopePermission] = OMIT,
111
+ trunks: typing.Optional[ApiKeyScopePermission] = OMIT,
112
+ calls: typing.Optional[ApiKeyCallsScopePermission] = OMIT,
113
+ messages: typing.Optional[ApiKeyScopePermission] = OMIT,
114
+ recordings: typing.Optional[ApiKeyScopePermission] = OMIT,
115
+ campaigns: typing.Optional[ApiKeyScopePermission] = OMIT,
116
+ two_fa: typing.Optional[ApiKeyScopePermission] = OMIT,
117
+ validator: typing.Optional[ApiKeyScopePermission] = OMIT,
118
+ webhooks: typing.Optional[ApiKeyScopePermission] = OMIT,
119
+ embeddable: typing.Optional[ApiKeyScopePermission] = OMIT,
120
+ billing: typing.Optional[ApiKeyScopePermission] = OMIT,
121
+ account: typing.Optional[ApiKeyScopePermission] = OMIT,
122
+ subaccounts: typing.Optional[ApiKeyScopePermission] = OMIT,
123
+ request_options: typing.Optional[RequestOptions] = None,
124
+ ) -> HttpResponse[ApiKey]:
125
+ """
126
+ Creates an API key for the authenticated account. Restrict access by listing permitted IP addresses in `permitted_ips`.
127
+
128
+ Parameters
129
+ ----------
130
+ label : str
131
+ API key label.
132
+
133
+ active : typing.Optional[bool]
134
+ Indicates whether the API key should be activated upon creation.
135
+
136
+ restricted : typing.Optional[bool]
137
+ Indicates whether to restrict API key access by IP address. When enabled, only requests from IP addresses listed in `permitted_ips` are allowed.
138
+
139
+ permitted_ips : typing.Optional[typing.Sequence[str]]
140
+ List of permitted IP addresses for this API key. Each must be a valid IPv4 address. Required when `restricted` is true.
141
+
142
+ scopes_enabled : typing.Optional[bool]
143
+ When `true`, scope fields below are enforced. When `false` (default), the
144
+ key has full access. Omitted scope fields default to `{ allow: none }`,
145
+ so with `scopes_enabled: true` and no scopes set the key has no access.
146
+
147
+ numbers : typing.Optional[ApiKeyScopePermission]
148
+ View, buy, release, and configure phone numbers, browse inventory, and manage the cart.
149
+
150
+ trunks : typing.Optional[ApiKeyScopePermission]
151
+ View, create, update, and delete SIP trunks and their settings.
152
+
153
+ calls : typing.Optional[ApiKeyCallsScopePermission]
154
+ Access call records and active calls, and control live call actions such as starting, answering, ending, audio playback, DTMF, streaming, and transcription requests.
155
+
156
+ messages : typing.Optional[ApiKeyScopePermission]
157
+ Access message history and Sender IDs, send messages, manage opt-outs, and create or delete Sender IDs.
158
+
159
+ recordings : typing.Optional[ApiKeyScopePermission]
160
+ List, download, and delete call recordings.
161
+
162
+ campaigns : typing.Optional[ApiKeyScopePermission]
163
+ View campaign analytics and Sender ID or Brand status, schedule bulk voice or SMS campaigns, register Brands, and create short links.
164
+
165
+ two_fa : typing.Optional[ApiKeyScopePermission]
166
+ View 2FA service details and verification logs, trigger OTPs by voice or SMS, and validate verification codes.
167
+
168
+ validator : typing.Optional[ApiKeyScopePermission]
169
+ View number validation results and trigger single or bulk validation or HLR lookup requests.
170
+
171
+ webhooks : typing.Optional[ApiKeyScopePermission]
172
+ List, create, and delete webhooks.
173
+
174
+ embeddable : typing.Optional[ApiKeyScopePermission]
175
+ Manage widget tokens, including listing, viewing, creating, updating, and deleting them.
176
+
177
+ billing : typing.Optional[ApiKeyScopePermission]
178
+ Access statements, balance, payment methods, usage reports, and billing settings, including payment method updates.
179
+
180
+ account : typing.Optional[ApiKeyScopePermission]
181
+ View and update account profile information and timezone.
182
+
183
+ subaccounts : typing.Optional[ApiKeyScopePermission]
184
+ Manage subaccounts: list and view them, create, update, and suspend them.
185
+
186
+ request_options : typing.Optional[RequestOptions]
187
+ Request-specific configuration.
188
+
189
+ Returns
190
+ -------
191
+ HttpResponse[ApiKey]
192
+ Returns the created API key.
193
+ """
194
+ _response = self._client_wrapper.httpx_client.request(
195
+ "v1/api-keys",
196
+ method="POST",
197
+ json={
198
+ "label": label,
199
+ "active": active,
200
+ "restricted": restricted,
201
+ "permitted_ips": permitted_ips,
202
+ "scopes_enabled": scopes_enabled,
203
+ "numbers": convert_and_respect_annotation_metadata(
204
+ object_=numbers, annotation=ApiKeyScopePermission, direction="write"
205
+ ),
206
+ "trunks": convert_and_respect_annotation_metadata(
207
+ object_=trunks, annotation=ApiKeyScopePermission, direction="write"
208
+ ),
209
+ "calls": convert_and_respect_annotation_metadata(
210
+ object_=calls, annotation=ApiKeyCallsScopePermission, direction="write"
211
+ ),
212
+ "messages": convert_and_respect_annotation_metadata(
213
+ object_=messages, annotation=ApiKeyScopePermission, direction="write"
214
+ ),
215
+ "recordings": convert_and_respect_annotation_metadata(
216
+ object_=recordings, annotation=ApiKeyScopePermission, direction="write"
217
+ ),
218
+ "campaigns": convert_and_respect_annotation_metadata(
219
+ object_=campaigns, annotation=ApiKeyScopePermission, direction="write"
220
+ ),
221
+ "two_fa": convert_and_respect_annotation_metadata(
222
+ object_=two_fa, annotation=ApiKeyScopePermission, direction="write"
223
+ ),
224
+ "validator": convert_and_respect_annotation_metadata(
225
+ object_=validator, annotation=ApiKeyScopePermission, direction="write"
226
+ ),
227
+ "webhooks": convert_and_respect_annotation_metadata(
228
+ object_=webhooks, annotation=ApiKeyScopePermission, direction="write"
229
+ ),
230
+ "embeddable": convert_and_respect_annotation_metadata(
231
+ object_=embeddable, annotation=ApiKeyScopePermission, direction="write"
232
+ ),
233
+ "billing": convert_and_respect_annotation_metadata(
234
+ object_=billing, annotation=ApiKeyScopePermission, direction="write"
235
+ ),
236
+ "account": convert_and_respect_annotation_metadata(
237
+ object_=account, annotation=ApiKeyScopePermission, direction="write"
238
+ ),
239
+ "subaccounts": convert_and_respect_annotation_metadata(
240
+ object_=subaccounts, annotation=ApiKeyScopePermission, direction="write"
241
+ ),
242
+ },
243
+ headers={
244
+ "content-type": "application/json",
245
+ },
246
+ request_options=request_options,
247
+ omit=OMIT,
248
+ )
249
+ try:
250
+ if 200 <= _response.status_code < 300:
251
+ _data = typing.cast(
252
+ ApiKey,
253
+ parse_obj_as(
254
+ type_=ApiKey, # type: ignore
255
+ object_=_response.json(),
256
+ ),
257
+ )
258
+ return HttpResponse(response=_response, data=_data)
259
+ if _response.status_code == 400:
260
+ raise BadRequestError(
261
+ headers=dict(_response.headers),
262
+ body=typing.cast(
263
+ typing.Any,
264
+ parse_obj_as(
265
+ type_=typing.Any, # type: ignore
266
+ object_=_response.json(),
267
+ ),
268
+ ),
269
+ )
270
+ if _response.status_code == 401:
271
+ raise UnauthorizedError(
272
+ headers=dict(_response.headers),
273
+ body=typing.cast(
274
+ UnauthorizedErrorResponse,
275
+ parse_obj_as(
276
+ type_=UnauthorizedErrorResponse, # type: ignore
277
+ object_=_response.json(),
278
+ ),
279
+ ),
280
+ )
281
+ if _response.status_code == 403:
282
+ raise ForbiddenError(
283
+ headers=dict(_response.headers),
284
+ body=typing.cast(
285
+ typing.Any,
286
+ parse_obj_as(
287
+ type_=typing.Any, # type: ignore
288
+ object_=_response.json(),
289
+ ),
290
+ ),
291
+ )
292
+ if _response.status_code == 422:
293
+ raise UnprocessableEntityError(
294
+ headers=dict(_response.headers),
295
+ body=typing.cast(
296
+ typing.Any,
297
+ parse_obj_as(
298
+ type_=typing.Any, # type: ignore
299
+ object_=_response.json(),
300
+ ),
301
+ ),
302
+ )
303
+ _response_json = _response.json()
304
+ except JSONDecodeError:
305
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
306
+ except ValidationError as e:
307
+ raise ParsingError(
308
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
309
+ )
310
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
311
+
312
+ def delete(
313
+ self, id: int, *, request_options: typing.Optional[RequestOptions] = None
314
+ ) -> HttpResponse[SuccessResponse]:
315
+ """
316
+ Deletes the API key identified by `id`. Deletion is permanent and revokes the key immediately.
317
+
318
+ Parameters
319
+ ----------
320
+ id : int
321
+ The unique ID of the API key.
322
+
323
+ request_options : typing.Optional[RequestOptions]
324
+ Request-specific configuration.
325
+
326
+ Returns
327
+ -------
328
+ HttpResponse[SuccessResponse]
329
+ Returns a success confirmation. The API key is revoked.
330
+ """
331
+ _response = self._client_wrapper.httpx_client.request(
332
+ f"v1/api-keys/{encode_path_param(id)}",
333
+ method="DELETE",
334
+ request_options=request_options,
335
+ )
336
+ try:
337
+ if 200 <= _response.status_code < 300:
338
+ _data = typing.cast(
339
+ SuccessResponse,
340
+ parse_obj_as(
341
+ type_=SuccessResponse, # type: ignore
342
+ object_=_response.json(),
343
+ ),
344
+ )
345
+ return HttpResponse(response=_response, data=_data)
346
+ if _response.status_code == 401:
347
+ raise UnauthorizedError(
348
+ headers=dict(_response.headers),
349
+ body=typing.cast(
350
+ UnauthorizedErrorResponse,
351
+ parse_obj_as(
352
+ type_=UnauthorizedErrorResponse, # type: ignore
353
+ object_=_response.json(),
354
+ ),
355
+ ),
356
+ )
357
+ if _response.status_code == 403:
358
+ raise ForbiddenError(
359
+ headers=dict(_response.headers),
360
+ body=typing.cast(
361
+ typing.Any,
362
+ parse_obj_as(
363
+ type_=typing.Any, # type: ignore
364
+ object_=_response.json(),
365
+ ),
366
+ ),
367
+ )
368
+ if _response.status_code == 404:
369
+ raise NotFoundError(
370
+ headers=dict(_response.headers),
371
+ body=typing.cast(
372
+ typing.Any,
373
+ parse_obj_as(
374
+ type_=typing.Any, # type: ignore
375
+ object_=_response.json(),
376
+ ),
377
+ ),
378
+ )
379
+ _response_json = _response.json()
380
+ except JSONDecodeError:
381
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
382
+ except ValidationError as e:
383
+ raise ParsingError(
384
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
385
+ )
386
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
387
+
388
+ def update(
389
+ self,
390
+ id: int,
391
+ *,
392
+ active: typing.Optional[bool] = OMIT,
393
+ restricted: typing.Optional[bool] = OMIT,
394
+ scopes_enabled: typing.Optional[bool] = OMIT,
395
+ permitted_ips: typing.Optional[typing.Sequence[str]] = OMIT,
396
+ label: typing.Optional[str] = OMIT,
397
+ numbers: typing.Optional[ApiKeyScopePermission] = OMIT,
398
+ trunks: typing.Optional[ApiKeyScopePermission] = OMIT,
399
+ calls: typing.Optional[ApiKeyCallsScopePermission] = OMIT,
400
+ messages: typing.Optional[ApiKeyScopePermission] = OMIT,
401
+ recordings: typing.Optional[ApiKeyScopePermission] = OMIT,
402
+ campaigns: typing.Optional[ApiKeyScopePermission] = OMIT,
403
+ two_fa: typing.Optional[ApiKeyScopePermission] = OMIT,
404
+ validator: typing.Optional[ApiKeyScopePermission] = OMIT,
405
+ webhooks: typing.Optional[ApiKeyScopePermission] = OMIT,
406
+ embeddable: typing.Optional[ApiKeyScopePermission] = OMIT,
407
+ billing: typing.Optional[ApiKeyScopePermission] = OMIT,
408
+ account: typing.Optional[ApiKeyScopePermission] = OMIT,
409
+ subaccounts: typing.Optional[ApiKeyScopePermission] = OMIT,
410
+ request_options: typing.Optional[RequestOptions] = None,
411
+ ) -> HttpResponse[ApiKey]:
412
+ """
413
+ Updates an API key identified by `id`. Only the provided fields are changed.
414
+
415
+ Parameters
416
+ ----------
417
+ id : int
418
+ The unique ID of the API key.
419
+
420
+ active : typing.Optional[bool]
421
+ Indicates whether the API key is active.
422
+
423
+ restricted : typing.Optional[bool]
424
+ Indicates whether the API key is restricted to the listed permitted IPs.
425
+
426
+ scopes_enabled : typing.Optional[bool]
427
+ Indicates whether per-resource scope permissions are enforced for the API key.
428
+
429
+ permitted_ips : typing.Optional[typing.Sequence[str]]
430
+ IP addresses allowed to use the API key when restriction is enabled.
431
+
432
+ label : typing.Optional[str]
433
+ Human-readable label for the API key.
434
+
435
+ numbers : typing.Optional[ApiKeyScopePermission]
436
+ View, buy, release, and configure phone numbers, browse inventory, and manage the cart.
437
+
438
+ trunks : typing.Optional[ApiKeyScopePermission]
439
+ View, create, update, and delete SIP trunks and their settings.
440
+
441
+ calls : typing.Optional[ApiKeyCallsScopePermission]
442
+ Access call records and active calls, and control live call actions such as starting, answering, ending, audio playback, DTMF, streaming, and transcription requests.
443
+
444
+ messages : typing.Optional[ApiKeyScopePermission]
445
+ Access message history and Sender IDs, send messages, manage opt-outs, and create or delete Sender IDs.
446
+
447
+ recordings : typing.Optional[ApiKeyScopePermission]
448
+ List, download, and delete call recordings.
449
+
450
+ campaigns : typing.Optional[ApiKeyScopePermission]
451
+ View campaign analytics and Sender ID or Brand status, schedule bulk voice or SMS campaigns, register Brands, and create short links.
452
+
453
+ two_fa : typing.Optional[ApiKeyScopePermission]
454
+ View 2FA service details and verification logs, trigger OTPs by voice or SMS, and validate verification codes.
455
+
456
+ validator : typing.Optional[ApiKeyScopePermission]
457
+ View number validation results and trigger single or bulk validation or HLR lookup requests.
458
+
459
+ webhooks : typing.Optional[ApiKeyScopePermission]
460
+ List, create, and delete webhooks.
461
+
462
+ embeddable : typing.Optional[ApiKeyScopePermission]
463
+ Manage widget tokens, including listing, viewing, creating, updating, and deleting them.
464
+
465
+ billing : typing.Optional[ApiKeyScopePermission]
466
+ Access statements, balance, payment methods, usage reports, and billing settings, including payment method updates.
467
+
468
+ account : typing.Optional[ApiKeyScopePermission]
469
+ View and update account profile information and timezone.
470
+
471
+ subaccounts : typing.Optional[ApiKeyScopePermission]
472
+ Manage subaccounts: list and view them, create, update, and suspend them.
473
+
474
+ request_options : typing.Optional[RequestOptions]
475
+ Request-specific configuration.
476
+
477
+ Returns
478
+ -------
479
+ HttpResponse[ApiKey]
480
+ Returns the updated API key.
481
+ """
482
+ _response = self._client_wrapper.httpx_client.request(
483
+ f"v1/api-keys/{encode_path_param(id)}",
484
+ method="PATCH",
485
+ json={
486
+ "active": active,
487
+ "restricted": restricted,
488
+ "scopes_enabled": scopes_enabled,
489
+ "permitted_ips": permitted_ips,
490
+ "label": label,
491
+ "numbers": convert_and_respect_annotation_metadata(
492
+ object_=numbers, annotation=ApiKeyScopePermission, direction="write"
493
+ ),
494
+ "trunks": convert_and_respect_annotation_metadata(
495
+ object_=trunks, annotation=ApiKeyScopePermission, direction="write"
496
+ ),
497
+ "calls": convert_and_respect_annotation_metadata(
498
+ object_=calls, annotation=ApiKeyCallsScopePermission, direction="write"
499
+ ),
500
+ "messages": convert_and_respect_annotation_metadata(
501
+ object_=messages, annotation=ApiKeyScopePermission, direction="write"
502
+ ),
503
+ "recordings": convert_and_respect_annotation_metadata(
504
+ object_=recordings, annotation=ApiKeyScopePermission, direction="write"
505
+ ),
506
+ "campaigns": convert_and_respect_annotation_metadata(
507
+ object_=campaigns, annotation=ApiKeyScopePermission, direction="write"
508
+ ),
509
+ "two_fa": convert_and_respect_annotation_metadata(
510
+ object_=two_fa, annotation=ApiKeyScopePermission, direction="write"
511
+ ),
512
+ "validator": convert_and_respect_annotation_metadata(
513
+ object_=validator, annotation=ApiKeyScopePermission, direction="write"
514
+ ),
515
+ "webhooks": convert_and_respect_annotation_metadata(
516
+ object_=webhooks, annotation=ApiKeyScopePermission, direction="write"
517
+ ),
518
+ "embeddable": convert_and_respect_annotation_metadata(
519
+ object_=embeddable, annotation=ApiKeyScopePermission, direction="write"
520
+ ),
521
+ "billing": convert_and_respect_annotation_metadata(
522
+ object_=billing, annotation=ApiKeyScopePermission, direction="write"
523
+ ),
524
+ "account": convert_and_respect_annotation_metadata(
525
+ object_=account, annotation=ApiKeyScopePermission, direction="write"
526
+ ),
527
+ "subaccounts": convert_and_respect_annotation_metadata(
528
+ object_=subaccounts, annotation=ApiKeyScopePermission, direction="write"
529
+ ),
530
+ },
531
+ headers={
532
+ "content-type": "application/json",
533
+ },
534
+ request_options=request_options,
535
+ omit=OMIT,
536
+ )
537
+ try:
538
+ if 200 <= _response.status_code < 300:
539
+ _data = typing.cast(
540
+ ApiKey,
541
+ parse_obj_as(
542
+ type_=ApiKey, # type: ignore
543
+ object_=_response.json(),
544
+ ),
545
+ )
546
+ return HttpResponse(response=_response, data=_data)
547
+ if _response.status_code == 400:
548
+ raise BadRequestError(
549
+ headers=dict(_response.headers),
550
+ body=typing.cast(
551
+ typing.Any,
552
+ parse_obj_as(
553
+ type_=typing.Any, # type: ignore
554
+ object_=_response.json(),
555
+ ),
556
+ ),
557
+ )
558
+ if _response.status_code == 401:
559
+ raise UnauthorizedError(
560
+ headers=dict(_response.headers),
561
+ body=typing.cast(
562
+ UnauthorizedErrorResponse,
563
+ parse_obj_as(
564
+ type_=UnauthorizedErrorResponse, # type: ignore
565
+ object_=_response.json(),
566
+ ),
567
+ ),
568
+ )
569
+ if _response.status_code == 403:
570
+ raise ForbiddenError(
571
+ headers=dict(_response.headers),
572
+ body=typing.cast(
573
+ typing.Any,
574
+ parse_obj_as(
575
+ type_=typing.Any, # type: ignore
576
+ object_=_response.json(),
577
+ ),
578
+ ),
579
+ )
580
+ if _response.status_code == 404:
581
+ raise NotFoundError(
582
+ headers=dict(_response.headers),
583
+ body=typing.cast(
584
+ typing.Any,
585
+ parse_obj_as(
586
+ type_=typing.Any, # type: ignore
587
+ object_=_response.json(),
588
+ ),
589
+ ),
590
+ )
591
+ if _response.status_code == 422:
592
+ raise UnprocessableEntityError(
593
+ headers=dict(_response.headers),
594
+ body=typing.cast(
595
+ typing.Any,
596
+ parse_obj_as(
597
+ type_=typing.Any, # type: ignore
598
+ object_=_response.json(),
599
+ ),
600
+ ),
601
+ )
602
+ _response_json = _response.json()
603
+ except JSONDecodeError:
604
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
605
+ except ValidationError as e:
606
+ raise ParsingError(
607
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
608
+ )
609
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
610
+
611
+
612
+ class AsyncRawApiKeysClient:
613
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
614
+ self._client_wrapper = client_wrapper
615
+
616
+ async def list(
617
+ self, *, label: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
618
+ ) -> AsyncHttpResponse[typing.List[ApiKey]]:
619
+ """
620
+ Returns the API keys belonging to the authenticated account.
621
+
622
+ Parameters
623
+ ----------
624
+ label : typing.Optional[str]
625
+ Filters API keys by `label`. Matches partial values.
626
+
627
+ request_options : typing.Optional[RequestOptions]
628
+ Request-specific configuration.
629
+
630
+ Returns
631
+ -------
632
+ AsyncHttpResponse[typing.List[ApiKey]]
633
+ Returns the list of API keys.
634
+ """
635
+ _response = await self._client_wrapper.httpx_client.request(
636
+ "v1/api-keys",
637
+ method="GET",
638
+ params={
639
+ "label": label,
640
+ },
641
+ request_options=request_options,
642
+ )
643
+ try:
644
+ if 200 <= _response.status_code < 300:
645
+ _data = typing.cast(
646
+ typing.List[ApiKey],
647
+ parse_obj_as(
648
+ type_=typing.List[ApiKey], # type: ignore
649
+ object_=_response.json(),
650
+ ),
651
+ )
652
+ return AsyncHttpResponse(response=_response, data=_data)
653
+ if _response.status_code == 401:
654
+ raise UnauthorizedError(
655
+ headers=dict(_response.headers),
656
+ body=typing.cast(
657
+ UnauthorizedErrorResponse,
658
+ parse_obj_as(
659
+ type_=UnauthorizedErrorResponse, # type: ignore
660
+ object_=_response.json(),
661
+ ),
662
+ ),
663
+ )
664
+ if _response.status_code == 403:
665
+ raise ForbiddenError(
666
+ headers=dict(_response.headers),
667
+ body=typing.cast(
668
+ typing.Any,
669
+ parse_obj_as(
670
+ type_=typing.Any, # type: ignore
671
+ object_=_response.json(),
672
+ ),
673
+ ),
674
+ )
675
+ _response_json = _response.json()
676
+ except JSONDecodeError:
677
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
678
+ except ValidationError as e:
679
+ raise ParsingError(
680
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
681
+ )
682
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
683
+
684
+ async def create(
685
+ self,
686
+ *,
687
+ label: str,
688
+ active: typing.Optional[bool] = OMIT,
689
+ restricted: typing.Optional[bool] = OMIT,
690
+ permitted_ips: typing.Optional[typing.Sequence[str]] = OMIT,
691
+ scopes_enabled: typing.Optional[bool] = OMIT,
692
+ numbers: typing.Optional[ApiKeyScopePermission] = OMIT,
693
+ trunks: typing.Optional[ApiKeyScopePermission] = OMIT,
694
+ calls: typing.Optional[ApiKeyCallsScopePermission] = OMIT,
695
+ messages: typing.Optional[ApiKeyScopePermission] = OMIT,
696
+ recordings: typing.Optional[ApiKeyScopePermission] = OMIT,
697
+ campaigns: typing.Optional[ApiKeyScopePermission] = OMIT,
698
+ two_fa: typing.Optional[ApiKeyScopePermission] = OMIT,
699
+ validator: typing.Optional[ApiKeyScopePermission] = OMIT,
700
+ webhooks: typing.Optional[ApiKeyScopePermission] = OMIT,
701
+ embeddable: typing.Optional[ApiKeyScopePermission] = OMIT,
702
+ billing: typing.Optional[ApiKeyScopePermission] = OMIT,
703
+ account: typing.Optional[ApiKeyScopePermission] = OMIT,
704
+ subaccounts: typing.Optional[ApiKeyScopePermission] = OMIT,
705
+ request_options: typing.Optional[RequestOptions] = None,
706
+ ) -> AsyncHttpResponse[ApiKey]:
707
+ """
708
+ Creates an API key for the authenticated account. Restrict access by listing permitted IP addresses in `permitted_ips`.
709
+
710
+ Parameters
711
+ ----------
712
+ label : str
713
+ API key label.
714
+
715
+ active : typing.Optional[bool]
716
+ Indicates whether the API key should be activated upon creation.
717
+
718
+ restricted : typing.Optional[bool]
719
+ Indicates whether to restrict API key access by IP address. When enabled, only requests from IP addresses listed in `permitted_ips` are allowed.
720
+
721
+ permitted_ips : typing.Optional[typing.Sequence[str]]
722
+ List of permitted IP addresses for this API key. Each must be a valid IPv4 address. Required when `restricted` is true.
723
+
724
+ scopes_enabled : typing.Optional[bool]
725
+ When `true`, scope fields below are enforced. When `false` (default), the
726
+ key has full access. Omitted scope fields default to `{ allow: none }`,
727
+ so with `scopes_enabled: true` and no scopes set the key has no access.
728
+
729
+ numbers : typing.Optional[ApiKeyScopePermission]
730
+ View, buy, release, and configure phone numbers, browse inventory, and manage the cart.
731
+
732
+ trunks : typing.Optional[ApiKeyScopePermission]
733
+ View, create, update, and delete SIP trunks and their settings.
734
+
735
+ calls : typing.Optional[ApiKeyCallsScopePermission]
736
+ Access call records and active calls, and control live call actions such as starting, answering, ending, audio playback, DTMF, streaming, and transcription requests.
737
+
738
+ messages : typing.Optional[ApiKeyScopePermission]
739
+ Access message history and Sender IDs, send messages, manage opt-outs, and create or delete Sender IDs.
740
+
741
+ recordings : typing.Optional[ApiKeyScopePermission]
742
+ List, download, and delete call recordings.
743
+
744
+ campaigns : typing.Optional[ApiKeyScopePermission]
745
+ View campaign analytics and Sender ID or Brand status, schedule bulk voice or SMS campaigns, register Brands, and create short links.
746
+
747
+ two_fa : typing.Optional[ApiKeyScopePermission]
748
+ View 2FA service details and verification logs, trigger OTPs by voice or SMS, and validate verification codes.
749
+
750
+ validator : typing.Optional[ApiKeyScopePermission]
751
+ View number validation results and trigger single or bulk validation or HLR lookup requests.
752
+
753
+ webhooks : typing.Optional[ApiKeyScopePermission]
754
+ List, create, and delete webhooks.
755
+
756
+ embeddable : typing.Optional[ApiKeyScopePermission]
757
+ Manage widget tokens, including listing, viewing, creating, updating, and deleting them.
758
+
759
+ billing : typing.Optional[ApiKeyScopePermission]
760
+ Access statements, balance, payment methods, usage reports, and billing settings, including payment method updates.
761
+
762
+ account : typing.Optional[ApiKeyScopePermission]
763
+ View and update account profile information and timezone.
764
+
765
+ subaccounts : typing.Optional[ApiKeyScopePermission]
766
+ Manage subaccounts: list and view them, create, update, and suspend them.
767
+
768
+ request_options : typing.Optional[RequestOptions]
769
+ Request-specific configuration.
770
+
771
+ Returns
772
+ -------
773
+ AsyncHttpResponse[ApiKey]
774
+ Returns the created API key.
775
+ """
776
+ _response = await self._client_wrapper.httpx_client.request(
777
+ "v1/api-keys",
778
+ method="POST",
779
+ json={
780
+ "label": label,
781
+ "active": active,
782
+ "restricted": restricted,
783
+ "permitted_ips": permitted_ips,
784
+ "scopes_enabled": scopes_enabled,
785
+ "numbers": convert_and_respect_annotation_metadata(
786
+ object_=numbers, annotation=ApiKeyScopePermission, direction="write"
787
+ ),
788
+ "trunks": convert_and_respect_annotation_metadata(
789
+ object_=trunks, annotation=ApiKeyScopePermission, direction="write"
790
+ ),
791
+ "calls": convert_and_respect_annotation_metadata(
792
+ object_=calls, annotation=ApiKeyCallsScopePermission, direction="write"
793
+ ),
794
+ "messages": convert_and_respect_annotation_metadata(
795
+ object_=messages, annotation=ApiKeyScopePermission, direction="write"
796
+ ),
797
+ "recordings": convert_and_respect_annotation_metadata(
798
+ object_=recordings, annotation=ApiKeyScopePermission, direction="write"
799
+ ),
800
+ "campaigns": convert_and_respect_annotation_metadata(
801
+ object_=campaigns, annotation=ApiKeyScopePermission, direction="write"
802
+ ),
803
+ "two_fa": convert_and_respect_annotation_metadata(
804
+ object_=two_fa, annotation=ApiKeyScopePermission, direction="write"
805
+ ),
806
+ "validator": convert_and_respect_annotation_metadata(
807
+ object_=validator, annotation=ApiKeyScopePermission, direction="write"
808
+ ),
809
+ "webhooks": convert_and_respect_annotation_metadata(
810
+ object_=webhooks, annotation=ApiKeyScopePermission, direction="write"
811
+ ),
812
+ "embeddable": convert_and_respect_annotation_metadata(
813
+ object_=embeddable, annotation=ApiKeyScopePermission, direction="write"
814
+ ),
815
+ "billing": convert_and_respect_annotation_metadata(
816
+ object_=billing, annotation=ApiKeyScopePermission, direction="write"
817
+ ),
818
+ "account": convert_and_respect_annotation_metadata(
819
+ object_=account, annotation=ApiKeyScopePermission, direction="write"
820
+ ),
821
+ "subaccounts": convert_and_respect_annotation_metadata(
822
+ object_=subaccounts, annotation=ApiKeyScopePermission, direction="write"
823
+ ),
824
+ },
825
+ headers={
826
+ "content-type": "application/json",
827
+ },
828
+ request_options=request_options,
829
+ omit=OMIT,
830
+ )
831
+ try:
832
+ if 200 <= _response.status_code < 300:
833
+ _data = typing.cast(
834
+ ApiKey,
835
+ parse_obj_as(
836
+ type_=ApiKey, # type: ignore
837
+ object_=_response.json(),
838
+ ),
839
+ )
840
+ return AsyncHttpResponse(response=_response, data=_data)
841
+ if _response.status_code == 400:
842
+ raise BadRequestError(
843
+ headers=dict(_response.headers),
844
+ body=typing.cast(
845
+ typing.Any,
846
+ parse_obj_as(
847
+ type_=typing.Any, # type: ignore
848
+ object_=_response.json(),
849
+ ),
850
+ ),
851
+ )
852
+ if _response.status_code == 401:
853
+ raise UnauthorizedError(
854
+ headers=dict(_response.headers),
855
+ body=typing.cast(
856
+ UnauthorizedErrorResponse,
857
+ parse_obj_as(
858
+ type_=UnauthorizedErrorResponse, # type: ignore
859
+ object_=_response.json(),
860
+ ),
861
+ ),
862
+ )
863
+ if _response.status_code == 403:
864
+ raise ForbiddenError(
865
+ headers=dict(_response.headers),
866
+ body=typing.cast(
867
+ typing.Any,
868
+ parse_obj_as(
869
+ type_=typing.Any, # type: ignore
870
+ object_=_response.json(),
871
+ ),
872
+ ),
873
+ )
874
+ if _response.status_code == 422:
875
+ raise UnprocessableEntityError(
876
+ headers=dict(_response.headers),
877
+ body=typing.cast(
878
+ typing.Any,
879
+ parse_obj_as(
880
+ type_=typing.Any, # type: ignore
881
+ object_=_response.json(),
882
+ ),
883
+ ),
884
+ )
885
+ _response_json = _response.json()
886
+ except JSONDecodeError:
887
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
888
+ except ValidationError as e:
889
+ raise ParsingError(
890
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
891
+ )
892
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
893
+
894
+ async def delete(
895
+ self, id: int, *, request_options: typing.Optional[RequestOptions] = None
896
+ ) -> AsyncHttpResponse[SuccessResponse]:
897
+ """
898
+ Deletes the API key identified by `id`. Deletion is permanent and revokes the key immediately.
899
+
900
+ Parameters
901
+ ----------
902
+ id : int
903
+ The unique ID of the API key.
904
+
905
+ request_options : typing.Optional[RequestOptions]
906
+ Request-specific configuration.
907
+
908
+ Returns
909
+ -------
910
+ AsyncHttpResponse[SuccessResponse]
911
+ Returns a success confirmation. The API key is revoked.
912
+ """
913
+ _response = await self._client_wrapper.httpx_client.request(
914
+ f"v1/api-keys/{encode_path_param(id)}",
915
+ method="DELETE",
916
+ request_options=request_options,
917
+ )
918
+ try:
919
+ if 200 <= _response.status_code < 300:
920
+ _data = typing.cast(
921
+ SuccessResponse,
922
+ parse_obj_as(
923
+ type_=SuccessResponse, # type: ignore
924
+ object_=_response.json(),
925
+ ),
926
+ )
927
+ return AsyncHttpResponse(response=_response, data=_data)
928
+ if _response.status_code == 401:
929
+ raise UnauthorizedError(
930
+ headers=dict(_response.headers),
931
+ body=typing.cast(
932
+ UnauthorizedErrorResponse,
933
+ parse_obj_as(
934
+ type_=UnauthorizedErrorResponse, # type: ignore
935
+ object_=_response.json(),
936
+ ),
937
+ ),
938
+ )
939
+ if _response.status_code == 403:
940
+ raise ForbiddenError(
941
+ headers=dict(_response.headers),
942
+ body=typing.cast(
943
+ typing.Any,
944
+ parse_obj_as(
945
+ type_=typing.Any, # type: ignore
946
+ object_=_response.json(),
947
+ ),
948
+ ),
949
+ )
950
+ if _response.status_code == 404:
951
+ raise NotFoundError(
952
+ headers=dict(_response.headers),
953
+ body=typing.cast(
954
+ typing.Any,
955
+ parse_obj_as(
956
+ type_=typing.Any, # type: ignore
957
+ object_=_response.json(),
958
+ ),
959
+ ),
960
+ )
961
+ _response_json = _response.json()
962
+ except JSONDecodeError:
963
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
964
+ except ValidationError as e:
965
+ raise ParsingError(
966
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
967
+ )
968
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
969
+
970
+ async def update(
971
+ self,
972
+ id: int,
973
+ *,
974
+ active: typing.Optional[bool] = OMIT,
975
+ restricted: typing.Optional[bool] = OMIT,
976
+ scopes_enabled: typing.Optional[bool] = OMIT,
977
+ permitted_ips: typing.Optional[typing.Sequence[str]] = OMIT,
978
+ label: typing.Optional[str] = OMIT,
979
+ numbers: typing.Optional[ApiKeyScopePermission] = OMIT,
980
+ trunks: typing.Optional[ApiKeyScopePermission] = OMIT,
981
+ calls: typing.Optional[ApiKeyCallsScopePermission] = OMIT,
982
+ messages: typing.Optional[ApiKeyScopePermission] = OMIT,
983
+ recordings: typing.Optional[ApiKeyScopePermission] = OMIT,
984
+ campaigns: typing.Optional[ApiKeyScopePermission] = OMIT,
985
+ two_fa: typing.Optional[ApiKeyScopePermission] = OMIT,
986
+ validator: typing.Optional[ApiKeyScopePermission] = OMIT,
987
+ webhooks: typing.Optional[ApiKeyScopePermission] = OMIT,
988
+ embeddable: typing.Optional[ApiKeyScopePermission] = OMIT,
989
+ billing: typing.Optional[ApiKeyScopePermission] = OMIT,
990
+ account: typing.Optional[ApiKeyScopePermission] = OMIT,
991
+ subaccounts: typing.Optional[ApiKeyScopePermission] = OMIT,
992
+ request_options: typing.Optional[RequestOptions] = None,
993
+ ) -> AsyncHttpResponse[ApiKey]:
994
+ """
995
+ Updates an API key identified by `id`. Only the provided fields are changed.
996
+
997
+ Parameters
998
+ ----------
999
+ id : int
1000
+ The unique ID of the API key.
1001
+
1002
+ active : typing.Optional[bool]
1003
+ Indicates whether the API key is active.
1004
+
1005
+ restricted : typing.Optional[bool]
1006
+ Indicates whether the API key is restricted to the listed permitted IPs.
1007
+
1008
+ scopes_enabled : typing.Optional[bool]
1009
+ Indicates whether per-resource scope permissions are enforced for the API key.
1010
+
1011
+ permitted_ips : typing.Optional[typing.Sequence[str]]
1012
+ IP addresses allowed to use the API key when restriction is enabled.
1013
+
1014
+ label : typing.Optional[str]
1015
+ Human-readable label for the API key.
1016
+
1017
+ numbers : typing.Optional[ApiKeyScopePermission]
1018
+ View, buy, release, and configure phone numbers, browse inventory, and manage the cart.
1019
+
1020
+ trunks : typing.Optional[ApiKeyScopePermission]
1021
+ View, create, update, and delete SIP trunks and their settings.
1022
+
1023
+ calls : typing.Optional[ApiKeyCallsScopePermission]
1024
+ Access call records and active calls, and control live call actions such as starting, answering, ending, audio playback, DTMF, streaming, and transcription requests.
1025
+
1026
+ messages : typing.Optional[ApiKeyScopePermission]
1027
+ Access message history and Sender IDs, send messages, manage opt-outs, and create or delete Sender IDs.
1028
+
1029
+ recordings : typing.Optional[ApiKeyScopePermission]
1030
+ List, download, and delete call recordings.
1031
+
1032
+ campaigns : typing.Optional[ApiKeyScopePermission]
1033
+ View campaign analytics and Sender ID or Brand status, schedule bulk voice or SMS campaigns, register Brands, and create short links.
1034
+
1035
+ two_fa : typing.Optional[ApiKeyScopePermission]
1036
+ View 2FA service details and verification logs, trigger OTPs by voice or SMS, and validate verification codes.
1037
+
1038
+ validator : typing.Optional[ApiKeyScopePermission]
1039
+ View number validation results and trigger single or bulk validation or HLR lookup requests.
1040
+
1041
+ webhooks : typing.Optional[ApiKeyScopePermission]
1042
+ List, create, and delete webhooks.
1043
+
1044
+ embeddable : typing.Optional[ApiKeyScopePermission]
1045
+ Manage widget tokens, including listing, viewing, creating, updating, and deleting them.
1046
+
1047
+ billing : typing.Optional[ApiKeyScopePermission]
1048
+ Access statements, balance, payment methods, usage reports, and billing settings, including payment method updates.
1049
+
1050
+ account : typing.Optional[ApiKeyScopePermission]
1051
+ View and update account profile information and timezone.
1052
+
1053
+ subaccounts : typing.Optional[ApiKeyScopePermission]
1054
+ Manage subaccounts: list and view them, create, update, and suspend them.
1055
+
1056
+ request_options : typing.Optional[RequestOptions]
1057
+ Request-specific configuration.
1058
+
1059
+ Returns
1060
+ -------
1061
+ AsyncHttpResponse[ApiKey]
1062
+ Returns the updated API key.
1063
+ """
1064
+ _response = await self._client_wrapper.httpx_client.request(
1065
+ f"v1/api-keys/{encode_path_param(id)}",
1066
+ method="PATCH",
1067
+ json={
1068
+ "active": active,
1069
+ "restricted": restricted,
1070
+ "scopes_enabled": scopes_enabled,
1071
+ "permitted_ips": permitted_ips,
1072
+ "label": label,
1073
+ "numbers": convert_and_respect_annotation_metadata(
1074
+ object_=numbers, annotation=ApiKeyScopePermission, direction="write"
1075
+ ),
1076
+ "trunks": convert_and_respect_annotation_metadata(
1077
+ object_=trunks, annotation=ApiKeyScopePermission, direction="write"
1078
+ ),
1079
+ "calls": convert_and_respect_annotation_metadata(
1080
+ object_=calls, annotation=ApiKeyCallsScopePermission, direction="write"
1081
+ ),
1082
+ "messages": convert_and_respect_annotation_metadata(
1083
+ object_=messages, annotation=ApiKeyScopePermission, direction="write"
1084
+ ),
1085
+ "recordings": convert_and_respect_annotation_metadata(
1086
+ object_=recordings, annotation=ApiKeyScopePermission, direction="write"
1087
+ ),
1088
+ "campaigns": convert_and_respect_annotation_metadata(
1089
+ object_=campaigns, annotation=ApiKeyScopePermission, direction="write"
1090
+ ),
1091
+ "two_fa": convert_and_respect_annotation_metadata(
1092
+ object_=two_fa, annotation=ApiKeyScopePermission, direction="write"
1093
+ ),
1094
+ "validator": convert_and_respect_annotation_metadata(
1095
+ object_=validator, annotation=ApiKeyScopePermission, direction="write"
1096
+ ),
1097
+ "webhooks": convert_and_respect_annotation_metadata(
1098
+ object_=webhooks, annotation=ApiKeyScopePermission, direction="write"
1099
+ ),
1100
+ "embeddable": convert_and_respect_annotation_metadata(
1101
+ object_=embeddable, annotation=ApiKeyScopePermission, direction="write"
1102
+ ),
1103
+ "billing": convert_and_respect_annotation_metadata(
1104
+ object_=billing, annotation=ApiKeyScopePermission, direction="write"
1105
+ ),
1106
+ "account": convert_and_respect_annotation_metadata(
1107
+ object_=account, annotation=ApiKeyScopePermission, direction="write"
1108
+ ),
1109
+ "subaccounts": convert_and_respect_annotation_metadata(
1110
+ object_=subaccounts, annotation=ApiKeyScopePermission, direction="write"
1111
+ ),
1112
+ },
1113
+ headers={
1114
+ "content-type": "application/json",
1115
+ },
1116
+ request_options=request_options,
1117
+ omit=OMIT,
1118
+ )
1119
+ try:
1120
+ if 200 <= _response.status_code < 300:
1121
+ _data = typing.cast(
1122
+ ApiKey,
1123
+ parse_obj_as(
1124
+ type_=ApiKey, # type: ignore
1125
+ object_=_response.json(),
1126
+ ),
1127
+ )
1128
+ return AsyncHttpResponse(response=_response, data=_data)
1129
+ if _response.status_code == 400:
1130
+ raise BadRequestError(
1131
+ headers=dict(_response.headers),
1132
+ body=typing.cast(
1133
+ typing.Any,
1134
+ parse_obj_as(
1135
+ type_=typing.Any, # type: ignore
1136
+ object_=_response.json(),
1137
+ ),
1138
+ ),
1139
+ )
1140
+ if _response.status_code == 401:
1141
+ raise UnauthorizedError(
1142
+ headers=dict(_response.headers),
1143
+ body=typing.cast(
1144
+ UnauthorizedErrorResponse,
1145
+ parse_obj_as(
1146
+ type_=UnauthorizedErrorResponse, # type: ignore
1147
+ object_=_response.json(),
1148
+ ),
1149
+ ),
1150
+ )
1151
+ if _response.status_code == 403:
1152
+ raise ForbiddenError(
1153
+ headers=dict(_response.headers),
1154
+ body=typing.cast(
1155
+ typing.Any,
1156
+ parse_obj_as(
1157
+ type_=typing.Any, # type: ignore
1158
+ object_=_response.json(),
1159
+ ),
1160
+ ),
1161
+ )
1162
+ if _response.status_code == 404:
1163
+ raise NotFoundError(
1164
+ headers=dict(_response.headers),
1165
+ body=typing.cast(
1166
+ typing.Any,
1167
+ parse_obj_as(
1168
+ type_=typing.Any, # type: ignore
1169
+ object_=_response.json(),
1170
+ ),
1171
+ ),
1172
+ )
1173
+ if _response.status_code == 422:
1174
+ raise UnprocessableEntityError(
1175
+ headers=dict(_response.headers),
1176
+ body=typing.cast(
1177
+ typing.Any,
1178
+ parse_obj_as(
1179
+ type_=typing.Any, # type: ignore
1180
+ object_=_response.json(),
1181
+ ),
1182
+ ),
1183
+ )
1184
+ _response_json = _response.json()
1185
+ except JSONDecodeError:
1186
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1187
+ except ValidationError as e:
1188
+ raise ParsingError(
1189
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1190
+ )
1191
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)