whitebit-python-sdk 1.1.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 (451) hide show
  1. whitebit/__init__.py +793 -0
  2. whitebit/client.py +580 -0
  3. whitebit/codes/__init__.py +7 -0
  4. whitebit/codes/client.py +510 -0
  5. whitebit/codes/raw_client.py +809 -0
  6. whitebit/codes/types/__init__.py +10 -0
  7. whitebit/codes/types/apply_code_response.py +22 -0
  8. whitebit/codes/types/create_code_response.py +32 -0
  9. whitebit/codes/types/get_codes_history_response.py +27 -0
  10. whitebit/codes/types/get_my_codes_response.py +27 -0
  11. whitebit/collateral_trading/__init__.py +183 -0
  12. whitebit/collateral_trading/client.py +2452 -0
  13. whitebit/collateral_trading/raw_client.py +4337 -0
  14. whitebit/collateral_trading/types/__init__.py +213 -0
  15. whitebit/collateral_trading/types/cancel_oco_order_response.py +34 -0
  16. whitebit/collateral_trading/types/cancel_oco_order_response_stop_loss.py +146 -0
  17. whitebit/collateral_trading/types/cancel_oco_order_response_stop_loss_activation_condition.py +5 -0
  18. whitebit/collateral_trading/types/cancel_oco_order_response_stop_loss_side.py +5 -0
  19. whitebit/collateral_trading/types/cancel_oco_order_response_take_profit.py +114 -0
  20. whitebit/collateral_trading/types/cancel_oco_order_response_take_profit_side.py +5 -0
  21. whitebit/collateral_trading/types/change_collateral_account_leverage_response.py +22 -0
  22. whitebit/collateral_trading/types/close_position_request_position_side.py +5 -0
  23. whitebit/collateral_trading/types/collateral_account_balance_summary_response_item.py +48 -0
  24. whitebit/collateral_trading/types/collateral_account_summary_response.py +60 -0
  25. whitebit/collateral_trading/types/create_collateral_bulk_order_request_orders_item.py +98 -0
  26. whitebit/collateral_trading/types/create_collateral_bulk_order_request_orders_item_position_side.py +7 -0
  27. whitebit/collateral_trading/types/create_collateral_bulk_order_request_orders_item_side.py +5 -0
  28. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item.py +29 -0
  29. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item_error.py +36 -0
  30. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item_result.py +132 -0
  31. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item_result_position_side.py +7 -0
  32. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item_result_side.py +5 -0
  33. whitebit/collateral_trading/types/create_collateral_bulk_order_response_item_result_status.py +7 -0
  34. whitebit/collateral_trading/types/create_collateral_limit_order_request_position_side.py +5 -0
  35. whitebit/collateral_trading/types/create_collateral_limit_order_request_side.py +5 -0
  36. whitebit/collateral_trading/types/create_collateral_limit_order_response.py +132 -0
  37. whitebit/collateral_trading/types/create_collateral_limit_order_response_oto.py +44 -0
  38. whitebit/collateral_trading/types/create_collateral_limit_order_response_position_side.py +5 -0
  39. whitebit/collateral_trading/types/create_collateral_limit_order_response_side.py +5 -0
  40. whitebit/collateral_trading/types/create_collateral_limit_order_response_status.py +7 -0
  41. whitebit/collateral_trading/types/create_collateral_market_order_request_position_side.py +5 -0
  42. whitebit/collateral_trading/types/create_collateral_market_order_request_side.py +5 -0
  43. whitebit/collateral_trading/types/create_collateral_market_order_response.py +110 -0
  44. whitebit/collateral_trading/types/create_collateral_market_order_response_oto.py +44 -0
  45. whitebit/collateral_trading/types/create_collateral_market_order_response_position_side.py +5 -0
  46. whitebit/collateral_trading/types/create_collateral_market_order_response_side.py +5 -0
  47. whitebit/collateral_trading/types/create_collateral_market_order_response_status.py +7 -0
  48. whitebit/collateral_trading/types/create_collateral_oco_order_request_side.py +5 -0
  49. whitebit/collateral_trading/types/create_collateral_oco_order_response.py +34 -0
  50. whitebit/collateral_trading/types/create_collateral_oco_order_response_stop_loss.py +159 -0
  51. whitebit/collateral_trading/types/create_collateral_oco_order_response_stop_loss_activation_condition.py +5 -0
  52. whitebit/collateral_trading/types/create_collateral_oco_order_response_stop_loss_position_side.py +5 -0
  53. whitebit/collateral_trading/types/create_collateral_oco_order_response_stop_loss_side.py +5 -0
  54. whitebit/collateral_trading/types/create_collateral_oco_order_response_stop_loss_status.py +7 -0
  55. whitebit/collateral_trading/types/create_collateral_oco_order_response_take_profit.py +139 -0
  56. whitebit/collateral_trading/types/create_collateral_oco_order_response_take_profit_position_side.py +7 -0
  57. whitebit/collateral_trading/types/create_collateral_oco_order_response_take_profit_side.py +5 -0
  58. whitebit/collateral_trading/types/create_collateral_oco_order_response_take_profit_status.py +7 -0
  59. whitebit/collateral_trading/types/create_collateral_stop_limit_order_request_position_side.py +5 -0
  60. whitebit/collateral_trading/types/create_collateral_stop_limit_order_request_side.py +5 -0
  61. whitebit/collateral_trading/types/create_collateral_stop_limit_order_response.py +122 -0
  62. whitebit/collateral_trading/types/create_collateral_stop_limit_order_response_oto.py +44 -0
  63. whitebit/collateral_trading/types/create_collateral_stop_limit_order_response_position_side.py +5 -0
  64. whitebit/collateral_trading/types/create_collateral_stop_limit_order_response_side.py +5 -0
  65. whitebit/collateral_trading/types/create_collateral_stop_limit_order_response_status.py +7 -0
  66. whitebit/collateral_trading/types/create_collateral_trigger_market_order_request_position_side.py +7 -0
  67. whitebit/collateral_trading/types/create_collateral_trigger_market_order_request_side.py +5 -0
  68. whitebit/collateral_trading/types/create_collateral_trigger_market_order_response.py +117 -0
  69. whitebit/collateral_trading/types/create_collateral_trigger_market_order_response_oto.py +44 -0
  70. whitebit/collateral_trading/types/create_collateral_trigger_market_order_response_position_side.py +7 -0
  71. whitebit/collateral_trading/types/create_collateral_trigger_market_order_response_side.py +5 -0
  72. whitebit/collateral_trading/types/create_collateral_trigger_market_order_response_status.py +7 -0
  73. whitebit/collateral_trading/types/get_collateral_hedge_mode_response.py +26 -0
  74. whitebit/collateral_trading/types/get_conditional_orders_response.py +38 -0
  75. whitebit/collateral_trading/types/get_conditional_orders_response_records_item.py +60 -0
  76. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oco.py +31 -0
  77. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oco_stop_loss.py +28 -0
  78. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oco_stop_loss_position_side.py +7 -0
  79. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oco_take_profit.py +28 -0
  80. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oco_take_profit_position_side.py +7 -0
  81. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oto.py +34 -0
  82. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oto_conditional_order.py +30 -0
  83. whitebit/collateral_trading/types/get_conditional_orders_response_records_item_oto_conditional_order_position_side.py +7 -0
  84. whitebit/collateral_trading/types/get_funding_history_response.py +33 -0
  85. whitebit/collateral_trading/types/get_funding_history_response_records_item.py +66 -0
  86. whitebit/collateral_trading/types/get_oco_orders_response_item.py +34 -0
  87. whitebit/collateral_trading/types/get_oco_orders_response_item_stop_loss.py +49 -0
  88. whitebit/collateral_trading/types/get_oco_orders_response_item_stop_loss_activation_condition.py +5 -0
  89. whitebit/collateral_trading/types/get_oco_orders_response_item_stop_loss_side.py +5 -0
  90. whitebit/collateral_trading/types/get_oco_orders_response_item_take_profit.py +43 -0
  91. whitebit/collateral_trading/types/get_oco_orders_response_item_take_profit_side.py +5 -0
  92. whitebit/collateral_trading/types/get_open_positions_response_item.py +136 -0
  93. whitebit/collateral_trading/types/get_open_positions_response_item_liquidation_state.py +5 -0
  94. whitebit/collateral_trading/types/get_open_positions_response_item_position_side.py +5 -0
  95. whitebit/collateral_trading/types/get_open_positions_response_item_tpsl.py +51 -0
  96. whitebit/collateral_trading/types/get_positions_history_response_item.py +95 -0
  97. whitebit/collateral_trading/types/get_positions_history_response_item_liquidation_state.py +5 -0
  98. whitebit/collateral_trading/types/get_positions_history_response_item_order_detail.py +61 -0
  99. whitebit/collateral_trading/types/get_positions_history_response_item_position_side.py +5 -0
  100. whitebit/core/__init__.py +52 -0
  101. whitebit/core/api_error.py +23 -0
  102. whitebit/core/client_wrapper.py +57 -0
  103. whitebit/core/datetime_utils.py +28 -0
  104. whitebit/core/file.py +67 -0
  105. whitebit/core/http_client.py +497 -0
  106. whitebit/core/http_response.py +55 -0
  107. whitebit/core/jsonable_encoder.py +100 -0
  108. whitebit/core/pydantic_utilities.py +255 -0
  109. whitebit/core/query_encoder.py +58 -0
  110. whitebit/core/remove_none_from_dict.py +11 -0
  111. whitebit/core/request_options.py +35 -0
  112. whitebit/core/serialization.py +276 -0
  113. whitebit/credit_line/__init__.py +4 -0
  114. whitebit/credit_line/client.py +128 -0
  115. whitebit/credit_line/raw_client.py +191 -0
  116. whitebit/crypto_lending_fixed/__init__.py +7 -0
  117. whitebit/crypto_lending_fixed/client.py +651 -0
  118. whitebit/crypto_lending_fixed/raw_client.py +931 -0
  119. whitebit/crypto_lending_fixed/types/__init__.py +9 -0
  120. whitebit/crypto_lending_fixed/types/create_fixed_investment_response.py +22 -0
  121. whitebit/crypto_lending_fixed/types/get_fixed_investments_history_response.py +22 -0
  122. whitebit/crypto_lending_fixed/types/get_interest_payment_history_response.py +22 -0
  123. whitebit/crypto_lending_flex/__init__.py +29 -0
  124. whitebit/crypto_lending_flex/client.py +1140 -0
  125. whitebit/crypto_lending_flex/raw_client.py +1651 -0
  126. whitebit/crypto_lending_flex/types/__init__.py +27 -0
  127. whitebit/crypto_lending_flex/types/close_flex_investment_response.py +20 -0
  128. whitebit/crypto_lending_flex/types/close_flex_investment_response_data.py +26 -0
  129. whitebit/crypto_lending_flex/types/create_flex_investment_response.py +20 -0
  130. whitebit/crypto_lending_flex/types/create_flex_investment_response_data.py +26 -0
  131. whitebit/crypto_lending_flex/types/get_flex_investment_history_response.py +22 -0
  132. whitebit/crypto_lending_flex/types/get_flex_payment_history_response.py +22 -0
  133. whitebit/crypto_lending_flex/types/get_user_flex_investments_response.py +22 -0
  134. whitebit/crypto_lending_flex/types/update_flex_auto_reinvestment_response.py +19 -0
  135. whitebit/crypto_lending_flex/types/withdraw_from_flex_investment_response.py +20 -0
  136. whitebit/crypto_lending_flex/types/withdraw_from_flex_investment_response_data.py +26 -0
  137. whitebit/deposit/__init__.py +35 -0
  138. whitebit/deposit/client.py +997 -0
  139. whitebit/deposit/raw_client.py +1342 -0
  140. whitebit/deposit/types/__init__.py +33 -0
  141. whitebit/deposit/types/create_new_address_request_type.py +5 -0
  142. whitebit/deposit/types/create_new_address_response.py +22 -0
  143. whitebit/deposit/types/create_new_address_response_account.py +27 -0
  144. whitebit/deposit/types/create_new_address_response_required.py +48 -0
  145. whitebit/deposit/types/create_new_address_response_required_flex_fee.py +42 -0
  146. whitebit/deposit/types/get_deposit_address_response.py +22 -0
  147. whitebit/deposit/types/get_deposit_address_response_account.py +27 -0
  148. whitebit/deposit/types/get_deposit_address_response_required.py +48 -0
  149. whitebit/deposit/types/get_deposit_address_response_required_flex_fee.py +42 -0
  150. whitebit/deposit/types/get_fiat_deposit_url_request_customer.py +61 -0
  151. whitebit/deposit/types/get_fiat_deposit_url_request_customer_address.py +56 -0
  152. whitebit/deposit/types/get_fiat_deposit_url_response.py +22 -0
  153. whitebit/deposit/types/refund_deposit_response.py +22 -0
  154. whitebit/environment.py +17 -0
  155. whitebit/errors/__init__.py +19 -0
  156. whitebit/errors/bad_request_error.py +10 -0
  157. whitebit/errors/internal_server_error.py +10 -0
  158. whitebit/errors/not_found_error.py +11 -0
  159. whitebit/errors/service_unavailable_error.py +10 -0
  160. whitebit/errors/unauthorized_error.py +10 -0
  161. whitebit/errors/unprocessable_entity_error.py +10 -0
  162. whitebit/fees/__init__.py +4 -0
  163. whitebit/fees/client.py +126 -0
  164. whitebit/fees/raw_client.py +144 -0
  165. whitebit/jwt/__init__.py +7 -0
  166. whitebit/jwt/client.py +224 -0
  167. whitebit/jwt/raw_client.py +389 -0
  168. whitebit/jwt/types/__init__.py +9 -0
  169. whitebit/jwt/types/get_web_socket_token_response.py +22 -0
  170. whitebit/jwt/types/issue_jwt_token_response.py +20 -0
  171. whitebit/jwt/types/issue_jwt_token_response_data.py +27 -0
  172. whitebit/main_account/__init__.py +7 -0
  173. whitebit/main_account/client.py +380 -0
  174. whitebit/main_account/raw_client.py +493 -0
  175. whitebit/main_account/types/__init__.py +8 -0
  176. whitebit/main_account/types/get_deposit_withdraw_history_response.py +26 -0
  177. whitebit/main_account/types/get_main_balance_response_value.py +22 -0
  178. whitebit/market_fee/__init__.py +7 -0
  179. whitebit/market_fee/client.py +193 -0
  180. whitebit/market_fee/raw_client.py +267 -0
  181. whitebit/market_fee/types/__init__.py +8 -0
  182. whitebit/market_fee/types/get_all_market_fees_response.py +43 -0
  183. whitebit/market_fee/types/get_market_fee_response.py +38 -0
  184. whitebit/mining_pool/__init__.py +67 -0
  185. whitebit/mining_pool/client.py +1083 -0
  186. whitebit/mining_pool/raw_client.py +1695 -0
  187. whitebit/mining_pool/types/__init__.py +69 -0
  188. whitebit/mining_pool/types/create_mining_account_response.py +20 -0
  189. whitebit/mining_pool/types/create_mining_account_response_data.py +31 -0
  190. whitebit/mining_pool/types/create_mining_watcher_link_request_live_until.py +5 -0
  191. whitebit/mining_pool/types/create_mining_watcher_link_request_permissions_item.py +7 -0
  192. whitebit/mining_pool/types/create_mining_watcher_link_response.py +20 -0
  193. whitebit/mining_pool/types/create_mining_watcher_link_response_data.py +24 -0
  194. whitebit/mining_pool/types/get_mining_accounts_response.py +20 -0
  195. whitebit/mining_pool/types/get_mining_accounts_response_data_item.py +31 -0
  196. whitebit/mining_pool/types/get_mining_hashrate_request_interval.py +5 -0
  197. whitebit/mining_pool/types/get_mining_hashrate_response.py +20 -0
  198. whitebit/mining_pool/types/get_mining_hashrate_response_data.py +21 -0
  199. whitebit/mining_pool/types/get_mining_hashrate_response_data_hashrate_item.py +20 -0
  200. whitebit/mining_pool/types/get_mining_miner_info_response.py +20 -0
  201. whitebit/mining_pool/types/get_mining_miner_info_response_data.py +25 -0
  202. whitebit/mining_pool/types/get_mining_miner_info_response_data_stratum_item.py +22 -0
  203. whitebit/mining_pool/types/get_mining_payout_destination_response.py +36 -0
  204. whitebit/mining_pool/types/get_mining_payout_destination_response_payout_destination.py +7 -0
  205. whitebit/mining_pool/types/get_mining_rewards_response.py +22 -0
  206. whitebit/mining_pool/types/get_mining_worker_hashrate_request_interval.py +5 -0
  207. whitebit/mining_pool/types/get_mining_worker_hashrate_response.py +20 -0
  208. whitebit/mining_pool/types/get_mining_worker_hashrate_response_data.py +20 -0
  209. whitebit/mining_pool/types/get_mining_worker_hashrate_response_data_hashrates_item.py +23 -0
  210. whitebit/mining_pool/types/get_mining_worker_names_response.py +22 -0
  211. whitebit/mining_pool/types/get_mining_worker_names_response_data.py +19 -0
  212. whitebit/mining_pool/types/list_mining_watcher_links_response.py +20 -0
  213. whitebit/mining_pool/types/list_mining_watcher_links_response_data_item.py +27 -0
  214. whitebit/mining_pool/types/set_mining_payout_destination_request_destination.py +7 -0
  215. whitebit/mining_pool/types/set_mining_payout_destination_response.py +27 -0
  216. whitebit/mining_pool/types/set_mining_payout_destination_response_payout_destination.py +7 -0
  217. whitebit/public_api_v4/__init__.py +37 -0
  218. whitebit/public_api_v4/client.py +1096 -0
  219. whitebit/public_api_v4/raw_client.py +1398 -0
  220. whitebit/public_api_v4/types/__init__.py +37 -0
  221. whitebit/public_api_v4/types/get_api_v4public_funding_history_market_response_item.py +52 -0
  222. whitebit/public_api_v4/types/get_api_v4public_futures_response.py +22 -0
  223. whitebit/public_api_v4/types/get_api_v4public_markets_response_item.py +110 -0
  224. whitebit/public_api_v4/types/get_api_v4public_markets_response_item_type.py +5 -0
  225. whitebit/public_api_v4/types/get_api_v4public_mining_pool_response.py +20 -0
  226. whitebit/public_api_v4/types/get_api_v4public_mining_pool_response_data.py +39 -0
  227. whitebit/public_api_v4/types/get_api_v4public_mining_pool_response_data_blocks_item.py +22 -0
  228. whitebit/public_api_v4/types/get_api_v4public_mining_pool_response_data_last7days_hash_rate_item.py +20 -0
  229. whitebit/public_api_v4/types/get_api_v4public_platform_status_response.py +22 -0
  230. whitebit/public_api_v4/types/get_api_v4public_ticker_response_value.py +56 -0
  231. whitebit/public_api_v4/types/get_api_v4public_time_response.py +22 -0
  232. whitebit/public_api_v4/types/get_api_v4public_trades_market_request_type.py +5 -0
  233. whitebit/public_api_v4/types/get_api_v4public_trades_market_response_item.py +57 -0
  234. whitebit/public_api_v4/types/get_api_v4public_trades_market_response_item_type.py +5 -0
  235. whitebit/raw_client.py +637 -0
  236. whitebit/spot_trading/__init__.py +47 -0
  237. whitebit/spot_trading/client.py +4143 -0
  238. whitebit/spot_trading/raw_client.py +5628 -0
  239. whitebit/spot_trading/types/__init__.py +45 -0
  240. whitebit/spot_trading/types/cancel_all_orders_request_type_item.py +5 -0
  241. whitebit/spot_trading/types/get_executed_order_history_response_value_item.py +62 -0
  242. whitebit/spot_trading/types/get_executed_order_history_response_value_item_side.py +5 -0
  243. whitebit/spot_trading/types/get_kill_switch_status_response_item.py +44 -0
  244. whitebit/spot_trading/types/get_kill_switch_status_response_item_types_item.py +5 -0
  245. whitebit/spot_trading/types/get_order_deals_response.py +33 -0
  246. whitebit/spot_trading/types/get_order_deals_response_records_item.py +80 -0
  247. whitebit/spot_trading/types/get_order_history_response_value_item.py +131 -0
  248. whitebit/spot_trading/types/get_order_history_response_value_item_side.py +5 -0
  249. whitebit/spot_trading/types/limit_order_request_side.py +5 -0
  250. whitebit/spot_trading/types/limit_order_request_stp.py +5 -0
  251. whitebit/spot_trading/types/set_kill_switch_request_types_item.py +5 -0
  252. whitebit/spot_trading/types/set_kill_switch_response.py +44 -0
  253. whitebit/spot_trading/types/set_kill_switch_response_types_item.py +5 -0
  254. whitebit/spot_trading/types/stop_limit_order_request_side.py +5 -0
  255. whitebit/spot_trading/types/stop_limit_order_request_stp.py +5 -0
  256. whitebit/spot_trading/types/stop_market_order_request_side.py +5 -0
  257. whitebit/spot_trading/types/stop_market_order_request_stp.py +5 -0
  258. whitebit/spot_trading/types/trade_account_balance_response_value.py +27 -0
  259. whitebit/sub_account/__init__.py +25 -0
  260. whitebit/sub_account/client.py +892 -0
  261. whitebit/sub_account/raw_client.py +1399 -0
  262. whitebit/sub_account/types/__init__.py +23 -0
  263. whitebit/sub_account/types/create_sub_account_request_permissions.py +29 -0
  264. whitebit/sub_account/types/edit_sub_account_request_permissions.py +29 -0
  265. whitebit/sub_account/types/get_sub_account_balances_response_value_item.py +21 -0
  266. whitebit/sub_account/types/get_sub_account_transfer_history_request_direction.py +5 -0
  267. whitebit/sub_account/types/get_sub_account_transfer_history_response.py +22 -0
  268. whitebit/sub_account/types/list_sub_accounts_response.py +22 -0
  269. whitebit/sub_account/types/sub_account_transfer_request_direction.py +5 -0
  270. whitebit/sub_account/types/sub_account_transfer_response.py +26 -0
  271. whitebit/sub_account_api_keys/__init__.py +19 -0
  272. whitebit/sub_account_api_keys/client.py +754 -0
  273. whitebit/sub_account_api_keys/raw_client.py +1183 -0
  274. whitebit/sub_account_api_keys/types/__init__.py +17 -0
  275. whitebit/sub_account_api_keys/types/create_sub_account_api_key_ip_address_response.py +19 -0
  276. whitebit/sub_account_api_keys/types/delete_sub_account_api_key_ip_address_response.py +19 -0
  277. whitebit/sub_account_api_keys/types/edit_sub_account_api_key_request_urls_item.py +20 -0
  278. whitebit/sub_account_api_keys/types/list_sub_account_api_key_ip_addresses_response.py +19 -0
  279. whitebit/sub_account_api_keys/types/list_sub_account_api_keys_response.py +22 -0
  280. whitebit/transfer/__init__.py +15 -0
  281. whitebit/transfer/client.py +220 -0
  282. whitebit/transfer/raw_client.py +276 -0
  283. whitebit/transfer/types/__init__.py +13 -0
  284. whitebit/transfer/types/transfer_between_balances_request_from.py +5 -0
  285. whitebit/transfer/types/transfer_between_balances_request_method.py +7 -0
  286. whitebit/transfer/types/transfer_between_balances_request_to.py +5 -0
  287. whitebit/types/__init__.py +311 -0
  288. whitebit/types/asset.py +106 -0
  289. whitebit/types/asset_limits.py +33 -0
  290. whitebit/types/asset_limits_deposit_value.py +20 -0
  291. whitebit/types/asset_limits_withdraw_value.py +20 -0
  292. whitebit/types/asset_memo.py +24 -0
  293. whitebit/types/asset_networks.py +36 -0
  294. whitebit/types/asset_providers.py +24 -0
  295. whitebit/types/authorize_request.py +32 -0
  296. whitebit/types/authorize_response.py +29 -0
  297. whitebit/types/authorize_response_result.py +22 -0
  298. whitebit/types/bad_request_error_body.py +20 -0
  299. whitebit/types/balance_margin_request.py +32 -0
  300. whitebit/types/balance_margin_response.py +33 -0
  301. whitebit/types/balance_margin_response_result_value.py +37 -0
  302. whitebit/types/balance_margin_subscribe.py +32 -0
  303. whitebit/types/balance_margin_update.py +33 -0
  304. whitebit/types/balance_margin_update_params_item.py +48 -0
  305. whitebit/types/balance_spot_request.py +32 -0
  306. whitebit/types/balance_spot_response.py +33 -0
  307. whitebit/types/balance_spot_response_result_value.py +27 -0
  308. whitebit/types/balance_spot_subscribe.py +32 -0
  309. whitebit/types/balance_spot_update.py +33 -0
  310. whitebit/types/balance_spot_update_params_item_value.py +27 -0
  311. whitebit/types/base_request.py +22 -0
  312. whitebit/types/base_response.py +24 -0
  313. whitebit/types/book_ticker_subscribe.py +29 -0
  314. whitebit/types/book_ticker_update.py +26 -0
  315. whitebit/types/book_ticker_update_data.py +5 -0
  316. whitebit/types/borrows_events_subscribe.py +32 -0
  317. whitebit/types/borrows_events_update.py +34 -0
  318. whitebit/types/borrows_subscribe.py +32 -0
  319. whitebit/types/borrows_update.py +30 -0
  320. whitebit/types/borrows_update_params.py +25 -0
  321. whitebit/types/borrows_update_params_records_item.py +47 -0
  322. whitebit/types/bulk_limit_order_response.py +7 -0
  323. whitebit/types/bulk_limit_order_response_item.py +22 -0
  324. whitebit/types/bulk_order_item.py +42 -0
  325. whitebit/types/bulk_order_item_side.py +5 -0
  326. whitebit/types/candle.py +5 -0
  327. whitebit/types/candles_request.py +36 -0
  328. whitebit/types/candles_response.py +26 -0
  329. whitebit/types/candles_subscribe.py +34 -0
  330. whitebit/types/candles_update.py +26 -0
  331. whitebit/types/code_history.py +47 -0
  332. whitebit/types/code_info.py +47 -0
  333. whitebit/types/convert_confirm_response.py +33 -0
  334. whitebit/types/convert_estimate_request_direction.py +5 -0
  335. whitebit/types/convert_estimate_response.py +56 -0
  336. whitebit/types/convert_history_response.py +34 -0
  337. whitebit/types/convert_history_response_records_item.py +45 -0
  338. whitebit/types/convert_history_response_records_item_path_item.py +23 -0
  339. whitebit/types/credit_line.py +28 -0
  340. whitebit/types/deals_request.py +35 -0
  341. whitebit/types/deals_response.py +29 -0
  342. whitebit/types/deals_response_result.py +30 -0
  343. whitebit/types/deals_response_result_records_item.py +82 -0
  344. whitebit/types/deals_subscribe.py +32 -0
  345. whitebit/types/deals_update.py +43 -0
  346. whitebit/types/depth_level.py +5 -0
  347. whitebit/types/depth_request.py +35 -0
  348. whitebit/types/depth_response.py +22 -0
  349. whitebit/types/depth_subscribe.py +32 -0
  350. whitebit/types/depth_update.py +31 -0
  351. whitebit/types/depth_update_data.py +40 -0
  352. whitebit/types/error.py +21 -0
  353. whitebit/types/error_inner.py +21 -0
  354. whitebit/types/error_response.py +32 -0
  355. whitebit/types/error_v4.py +25 -0
  356. whitebit/types/executed_order_object.py +133 -0
  357. whitebit/types/executed_order_object_position_side.py +5 -0
  358. whitebit/types/executed_order_object_stp.py +5 -0
  359. whitebit/types/fee_details.py +23 -0
  360. whitebit/types/fee_details_flex.py +21 -0
  361. whitebit/types/fee_info.py +49 -0
  362. whitebit/types/fee_info_deposit.py +63 -0
  363. whitebit/types/fee_info_withdraw.py +63 -0
  364. whitebit/types/fixed_plan.py +79 -0
  365. whitebit/types/flex_investment.py +67 -0
  366. whitebit/types/flex_investment_history.py +64 -0
  367. whitebit/types/flex_plan.py +50 -0
  368. whitebit/types/futures_market.py +117 -0
  369. whitebit/types/interest_payment.py +48 -0
  370. whitebit/types/investment.py +64 -0
  371. whitebit/types/lastprice_request.py +29 -0
  372. whitebit/types/lastprice_response.py +25 -0
  373. whitebit/types/lastprice_subscribe.py +29 -0
  374. whitebit/types/lastprice_update.py +30 -0
  375. whitebit/types/margin_positions_events_subscribe.py +34 -0
  376. whitebit/types/margin_positions_events_update.py +34 -0
  377. whitebit/types/market_order_request.py +51 -0
  378. whitebit/types/market_order_request_side.py +5 -0
  379. whitebit/types/market_order_request_stp.py +5 -0
  380. whitebit/types/market_request.py +34 -0
  381. whitebit/types/market_response.py +22 -0
  382. whitebit/types/market_statistics.py +57 -0
  383. whitebit/types/market_subscribe.py +25 -0
  384. whitebit/types/market_today_request.py +29 -0
  385. whitebit/types/market_today_response.py +22 -0
  386. whitebit/types/market_today_statistics.py +47 -0
  387. whitebit/types/market_today_subscribe.py +25 -0
  388. whitebit/types/market_today_update.py +30 -0
  389. whitebit/types/market_update.py +30 -0
  390. whitebit/types/mining_reward.py +62 -0
  391. whitebit/types/not_found_error_body.py +20 -0
  392. whitebit/types/order_book.py +33 -0
  393. whitebit/types/order_object.py +118 -0
  394. whitebit/types/order_object_position_side.py +5 -0
  395. whitebit/types/order_object_stp.py +5 -0
  396. whitebit/types/order_response.py +123 -0
  397. whitebit/types/orderbook_response.py +37 -0
  398. whitebit/types/orders_executed_request.py +35 -0
  399. whitebit/types/orders_executed_response.py +29 -0
  400. whitebit/types/orders_executed_response_result.py +30 -0
  401. whitebit/types/orders_executed_subscribe.py +34 -0
  402. whitebit/types/orders_executed_update.py +33 -0
  403. whitebit/types/orders_pending_request.py +32 -0
  404. whitebit/types/orders_pending_response.py +29 -0
  405. whitebit/types/orders_pending_response_result.py +35 -0
  406. whitebit/types/orders_pending_subscribe.py +32 -0
  407. whitebit/types/orders_pending_update.py +32 -0
  408. whitebit/types/ping_request.py +25 -0
  409. whitebit/types/ping_response.py +21 -0
  410. whitebit/types/ping_response_result.py +5 -0
  411. whitebit/types/positions_subscribe.py +32 -0
  412. whitebit/types/positions_update.py +30 -0
  413. whitebit/types/positions_update_params.py +25 -0
  414. whitebit/types/positions_update_params_records_item.py +99 -0
  415. whitebit/types/positions_update_params_records_item_liq_stage.py +5 -0
  416. whitebit/types/positions_update_params_records_item_position_side.py +5 -0
  417. whitebit/types/provider_fee_details.py +28 -0
  418. whitebit/types/sub_account.py +63 -0
  419. whitebit/types/sub_account_api_key.py +84 -0
  420. whitebit/types/sub_account_api_key_access_endpoints_item.py +27 -0
  421. whitebit/types/sub_account_api_key_list.py +39 -0
  422. whitebit/types/sub_account_api_key_list_access_endpoints_item.py +20 -0
  423. whitebit/types/sub_account_kyc.py +37 -0
  424. whitebit/types/sub_account_permissions.py +37 -0
  425. whitebit/types/sub_account_transfer.py +53 -0
  426. whitebit/types/subscription_response.py +29 -0
  427. whitebit/types/subscription_response_result.py +22 -0
  428. whitebit/types/time_request.py +25 -0
  429. whitebit/types/time_response.py +23 -0
  430. whitebit/types/trade.py +48 -0
  431. whitebit/types/trade_type.py +5 -0
  432. whitebit/types/trades_request.py +35 -0
  433. whitebit/types/trades_response.py +22 -0
  434. whitebit/types/trades_subscribe.py +28 -0
  435. whitebit/types/trades_update.py +30 -0
  436. whitebit/types/transaction_history.py +108 -0
  437. whitebit/types/transaction_history_confirmations.py +31 -0
  438. whitebit/types/unprocessable_entity_error_body.py +20 -0
  439. whitebit/types/unsubscribe_request.py +32 -0
  440. whitebit/withdraw/__init__.py +11 -0
  441. whitebit/withdraw/client.py +496 -0
  442. whitebit/withdraw/raw_client.py +634 -0
  443. whitebit/withdraw/types/__init__.py +9 -0
  444. whitebit/withdraw/types/create_withdraw_request_beneficiary.py +74 -0
  445. whitebit/withdraw/types/create_withdraw_request_travel_rule.py +52 -0
  446. whitebit/withdraw/types/create_withdraw_request_travel_rule_type.py +5 -0
  447. whitebit_python_sdk-1.1.0.dist-info/METADATA +155 -0
  448. whitebit_python_sdk-1.1.0.dist-info/RECORD +451 -0
  449. whitebit_python_sdk-1.1.0.dist-info/WHEEL +5 -0
  450. whitebit_python_sdk-1.1.0.dist-info/licenses/LICENSE +20 -0
  451. whitebit_python_sdk-1.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1183 @@
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.pydantic_utilities import parse_obj_as
10
+ from ..core.request_options import RequestOptions
11
+ from ..core.serialization import convert_and_respect_annotation_metadata
12
+ from ..errors.bad_request_error import BadRequestError
13
+ from ..types.sub_account_api_key import SubAccountApiKey
14
+ from .types.create_sub_account_api_key_ip_address_response import CreateSubAccountApiKeyIpAddressResponse
15
+ from .types.delete_sub_account_api_key_ip_address_response import DeleteSubAccountApiKeyIpAddressResponse
16
+ from .types.edit_sub_account_api_key_request_urls_item import EditSubAccountApiKeyRequestUrlsItem
17
+ from .types.list_sub_account_api_key_ip_addresses_response import ListSubAccountApiKeyIpAddressesResponse
18
+ from .types.list_sub_account_api_keys_response import ListSubAccountApiKeysResponse
19
+
20
+ # this is used as the default value for optional parameters
21
+ OMIT = typing.cast(typing.Any, ...)
22
+
23
+
24
+ class RawSubAccountApiKeysClient:
25
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
26
+ self._client_wrapper = client_wrapper
27
+
28
+ def create_sub_account_api_key(
29
+ self,
30
+ *,
31
+ type: int,
32
+ sub_account_id: str,
33
+ title: typing.Optional[str] = OMIT,
34
+ request_options: typing.Optional[RequestOptions] = None,
35
+ ) -> HttpResponse[SubAccountApiKey]:
36
+ """
37
+ The endpoint creates a new API key for a [sub-account](/glossary#sub-account).
38
+
39
+ <Warning>
40
+ Rate limit: 1000 requests/10 sec.
41
+ </Warning>
42
+
43
+ <Note>
44
+ The API does not cache the response.
45
+ </Note>
46
+
47
+ Parameters
48
+ ----------
49
+ type : int
50
+ Type of API key (1 - info and trading; 2 - info, trading, deposits, withdraws)
51
+
52
+ sub_account_id : str
53
+ ID of the sub-account to create the API key for
54
+
55
+ title : typing.Optional[str]
56
+ Custom title/name for the API key
57
+
58
+ request_options : typing.Optional[RequestOptions]
59
+ Request-specific configuration.
60
+
61
+ Returns
62
+ -------
63
+ HttpResponse[SubAccountApiKey]
64
+ API key created successfully
65
+ """
66
+ _response = self._client_wrapper.httpx_client.request(
67
+ "api/v4/sub-account/api-key/create",
68
+ base_url=self._client_wrapper.get_environment().base,
69
+ method="POST",
70
+ json={
71
+ "type": type,
72
+ "subAccountId": sub_account_id,
73
+ "title": title,
74
+ },
75
+ headers={
76
+ "content-type": "application/json",
77
+ },
78
+ request_options=request_options,
79
+ omit=OMIT,
80
+ )
81
+ try:
82
+ if 200 <= _response.status_code < 300:
83
+ _data = typing.cast(
84
+ SubAccountApiKey,
85
+ parse_obj_as(
86
+ type_=SubAccountApiKey, # type: ignore
87
+ object_=_response.json(),
88
+ ),
89
+ )
90
+ return HttpResponse(response=_response, data=_data)
91
+ if _response.status_code == 400:
92
+ raise BadRequestError(
93
+ headers=dict(_response.headers),
94
+ body=typing.cast(
95
+ typing.Optional[typing.Any],
96
+ parse_obj_as(
97
+ type_=typing.Optional[typing.Any], # type: ignore
98
+ object_=_response.json(),
99
+ ),
100
+ ),
101
+ )
102
+ _response_json = _response.json()
103
+ except JSONDecodeError:
104
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
105
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
106
+
107
+ def edit_sub_account_api_key(
108
+ self,
109
+ *,
110
+ api_key_id: str,
111
+ title: str,
112
+ urls: typing.Sequence[EditSubAccountApiKeyRequestUrlsItem],
113
+ request_options: typing.Optional[RequestOptions] = None,
114
+ ) -> HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
115
+ """
116
+ The endpoint updates an existing [sub-account](/glossary#sub-account) API key.
117
+
118
+ <Warning>
119
+ Rate limit: 1000 requests/10 sec.
120
+ </Warning>
121
+
122
+ <Note>
123
+ The API does not cache the response.
124
+ </Note>
125
+
126
+ Parameters
127
+ ----------
128
+ api_key_id : str
129
+ ID of the API key to update
130
+
131
+ title : str
132
+ New title for the API key
133
+
134
+ urls : typing.Sequence[EditSubAccountApiKeyRequestUrlsItem]
135
+ Array of URL objects for API key restrictions
136
+
137
+ request_options : typing.Optional[RequestOptions]
138
+ Request-specific configuration.
139
+
140
+ Returns
141
+ -------
142
+ HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
143
+ API key updated successfully
144
+ """
145
+ _response = self._client_wrapper.httpx_client.request(
146
+ "api/v4/sub-account/api-key/edit",
147
+ base_url=self._client_wrapper.get_environment().base,
148
+ method="POST",
149
+ json={
150
+ "apiKeyId": api_key_id,
151
+ "title": title,
152
+ "urls": convert_and_respect_annotation_metadata(
153
+ object_=urls, annotation=typing.Sequence[EditSubAccountApiKeyRequestUrlsItem], direction="write"
154
+ ),
155
+ },
156
+ headers={
157
+ "content-type": "application/json",
158
+ },
159
+ request_options=request_options,
160
+ omit=OMIT,
161
+ )
162
+ try:
163
+ if 200 <= _response.status_code < 300:
164
+ _data = typing.cast(
165
+ typing.Dict[str, typing.Optional[typing.Any]],
166
+ parse_obj_as(
167
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
168
+ object_=_response.json(),
169
+ ),
170
+ )
171
+ return HttpResponse(response=_response, data=_data)
172
+ if _response.status_code == 400:
173
+ raise BadRequestError(
174
+ headers=dict(_response.headers),
175
+ body=typing.cast(
176
+ typing.Optional[typing.Any],
177
+ parse_obj_as(
178
+ type_=typing.Optional[typing.Any], # type: ignore
179
+ object_=_response.json(),
180
+ ),
181
+ ),
182
+ )
183
+ _response_json = _response.json()
184
+ except JSONDecodeError:
185
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
186
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
187
+
188
+ def delete_sub_account_api_key(
189
+ self, *, api_key_id: str, request_options: typing.Optional[RequestOptions] = None
190
+ ) -> HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
191
+ """
192
+ The endpoint deletes a [sub-account](/glossary#sub-account) API key.
193
+
194
+ <Warning>
195
+ Rate limit: 1000 requests/10 sec.
196
+ </Warning>
197
+
198
+ <Note>
199
+ The API does not cache the response.
200
+ </Note>
201
+
202
+ Parameters
203
+ ----------
204
+ api_key_id : str
205
+ ID of the API key to delete
206
+
207
+ request_options : typing.Optional[RequestOptions]
208
+ Request-specific configuration.
209
+
210
+ Returns
211
+ -------
212
+ HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
213
+ API key deleted successfully
214
+ """
215
+ _response = self._client_wrapper.httpx_client.request(
216
+ "api/v4/sub-account/api-key/delete",
217
+ base_url=self._client_wrapper.get_environment().base,
218
+ method="POST",
219
+ json={
220
+ "apiKeyId": api_key_id,
221
+ },
222
+ headers={
223
+ "content-type": "application/json",
224
+ },
225
+ request_options=request_options,
226
+ omit=OMIT,
227
+ )
228
+ try:
229
+ if 200 <= _response.status_code < 300:
230
+ _data = typing.cast(
231
+ typing.Dict[str, typing.Optional[typing.Any]],
232
+ parse_obj_as(
233
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
234
+ object_=_response.json(),
235
+ ),
236
+ )
237
+ return HttpResponse(response=_response, data=_data)
238
+ if _response.status_code == 400:
239
+ raise BadRequestError(
240
+ headers=dict(_response.headers),
241
+ body=typing.cast(
242
+ typing.Optional[typing.Any],
243
+ parse_obj_as(
244
+ type_=typing.Optional[typing.Any], # type: ignore
245
+ object_=_response.json(),
246
+ ),
247
+ ),
248
+ )
249
+ _response_json = _response.json()
250
+ except JSONDecodeError:
251
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
252
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
253
+
254
+ def list_sub_account_api_keys(
255
+ self,
256
+ *,
257
+ sub_account_id: typing.Optional[str] = OMIT,
258
+ limit: typing.Optional[int] = OMIT,
259
+ offset: typing.Optional[int] = OMIT,
260
+ request_options: typing.Optional[RequestOptions] = None,
261
+ ) -> HttpResponse[ListSubAccountApiKeysResponse]:
262
+ """
263
+ The endpoint retrieves a list of API keys for a [sub-account](/glossary#sub-account).
264
+ Note: For security reasons, the apiSecret field returns an empty string.
265
+
266
+ <Warning>
267
+ Rate limit: 1000 requests/10 sec.
268
+ </Warning>
269
+
270
+ <Note>
271
+ The API does not cache the response.
272
+ </Note>
273
+
274
+ Parameters
275
+ ----------
276
+ sub_account_id : typing.Optional[str]
277
+ ID of the sub-account to list API keys for
278
+
279
+ limit : typing.Optional[int]
280
+
281
+ offset : typing.Optional[int]
282
+
283
+ request_options : typing.Optional[RequestOptions]
284
+ Request-specific configuration.
285
+
286
+ Returns
287
+ -------
288
+ HttpResponse[ListSubAccountApiKeysResponse]
289
+ Successful response
290
+ """
291
+ _response = self._client_wrapper.httpx_client.request(
292
+ "api/v4/sub-account/api-key/list",
293
+ base_url=self._client_wrapper.get_environment().base,
294
+ method="POST",
295
+ json={
296
+ "subAccountId": sub_account_id,
297
+ "limit": limit,
298
+ "offset": offset,
299
+ },
300
+ headers={
301
+ "content-type": "application/json",
302
+ },
303
+ request_options=request_options,
304
+ omit=OMIT,
305
+ )
306
+ try:
307
+ if 200 <= _response.status_code < 300:
308
+ _data = typing.cast(
309
+ ListSubAccountApiKeysResponse,
310
+ parse_obj_as(
311
+ type_=ListSubAccountApiKeysResponse, # type: ignore
312
+ object_=_response.json(),
313
+ ),
314
+ )
315
+ return HttpResponse(response=_response, data=_data)
316
+ if _response.status_code == 400:
317
+ raise BadRequestError(
318
+ headers=dict(_response.headers),
319
+ body=typing.cast(
320
+ typing.Optional[typing.Any],
321
+ parse_obj_as(
322
+ type_=typing.Optional[typing.Any], # type: ignore
323
+ object_=_response.json(),
324
+ ),
325
+ ),
326
+ )
327
+ _response_json = _response.json()
328
+ except JSONDecodeError:
329
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
330
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
331
+
332
+ def reset_sub_account_api_key(
333
+ self, *, api_key_id: str, request_options: typing.Optional[RequestOptions] = None
334
+ ) -> HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
335
+ """
336
+ The endpoint resets (regenerates) an existing [sub-account](/glossary#sub-account) API key.
337
+
338
+ <Warning>
339
+ Rate limit: 1000 requests/10 sec.
340
+ </Warning>
341
+
342
+ <Note>
343
+ The API does not cache the response.
344
+ </Note>
345
+
346
+ Parameters
347
+ ----------
348
+ api_key_id : str
349
+ ID of the API key to reset
350
+
351
+ request_options : typing.Optional[RequestOptions]
352
+ Request-specific configuration.
353
+
354
+ Returns
355
+ -------
356
+ HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
357
+ API key reset successfully
358
+ """
359
+ _response = self._client_wrapper.httpx_client.request(
360
+ "api/v4/sub-account/api-key/reset",
361
+ base_url=self._client_wrapper.get_environment().base,
362
+ method="POST",
363
+ json={
364
+ "apiKeyId": api_key_id,
365
+ },
366
+ headers={
367
+ "content-type": "application/json",
368
+ },
369
+ request_options=request_options,
370
+ omit=OMIT,
371
+ )
372
+ try:
373
+ if 200 <= _response.status_code < 300:
374
+ _data = typing.cast(
375
+ typing.Dict[str, typing.Optional[typing.Any]],
376
+ parse_obj_as(
377
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
378
+ object_=_response.json(),
379
+ ),
380
+ )
381
+ return HttpResponse(response=_response, data=_data)
382
+ if _response.status_code == 400:
383
+ raise BadRequestError(
384
+ headers=dict(_response.headers),
385
+ body=typing.cast(
386
+ typing.Optional[typing.Any],
387
+ parse_obj_as(
388
+ type_=typing.Optional[typing.Any], # type: ignore
389
+ object_=_response.json(),
390
+ ),
391
+ ),
392
+ )
393
+ _response_json = _response.json()
394
+ except JSONDecodeError:
395
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
396
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
397
+
398
+ def list_sub_account_api_key_ip_addresses(
399
+ self, *, api_key_id: str, request_options: typing.Optional[RequestOptions] = None
400
+ ) -> HttpResponse[ListSubAccountApiKeyIpAddressesResponse]:
401
+ """
402
+ The endpoint retrieves the list of IP addresses allowed for a [sub-account](/glossary#sub-account) API key.
403
+
404
+ <Warning>
405
+ Rate limit: 1000 requests/10 sec.
406
+ </Warning>
407
+
408
+ <Note>
409
+ The API does not cache the response.
410
+ </Note>
411
+
412
+ Parameters
413
+ ----------
414
+ api_key_id : str
415
+ ID of the API key to list IP addresses for
416
+
417
+ request_options : typing.Optional[RequestOptions]
418
+ Request-specific configuration.
419
+
420
+ Returns
421
+ -------
422
+ HttpResponse[ListSubAccountApiKeyIpAddressesResponse]
423
+ Successful response
424
+ """
425
+ _response = self._client_wrapper.httpx_client.request(
426
+ "api/v4/sub-account/api-key/ip-address/list",
427
+ base_url=self._client_wrapper.get_environment().base,
428
+ method="POST",
429
+ json={
430
+ "apiKeyId": api_key_id,
431
+ },
432
+ headers={
433
+ "content-type": "application/json",
434
+ },
435
+ request_options=request_options,
436
+ omit=OMIT,
437
+ )
438
+ try:
439
+ if 200 <= _response.status_code < 300:
440
+ _data = typing.cast(
441
+ ListSubAccountApiKeyIpAddressesResponse,
442
+ parse_obj_as(
443
+ type_=ListSubAccountApiKeyIpAddressesResponse, # type: ignore
444
+ object_=_response.json(),
445
+ ),
446
+ )
447
+ return HttpResponse(response=_response, data=_data)
448
+ if _response.status_code == 400:
449
+ raise BadRequestError(
450
+ headers=dict(_response.headers),
451
+ body=typing.cast(
452
+ typing.Optional[typing.Any],
453
+ parse_obj_as(
454
+ type_=typing.Optional[typing.Any], # type: ignore
455
+ object_=_response.json(),
456
+ ),
457
+ ),
458
+ )
459
+ _response_json = _response.json()
460
+ except JSONDecodeError:
461
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
462
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
463
+
464
+ def create_sub_account_api_key_ip_address(
465
+ self, *, api_key_id: str, ip: str, request_options: typing.Optional[RequestOptions] = None
466
+ ) -> HttpResponse[CreateSubAccountApiKeyIpAddressResponse]:
467
+ """
468
+ The endpoint adds a new IP address to the allowed list for a [sub-account](/glossary#sub-account) API key.
469
+
470
+ <Warning>
471
+ Rate limit: 1000 requests/10 sec.
472
+ </Warning>
473
+
474
+ <Note>
475
+ The API does not cache the response.
476
+ </Note>
477
+
478
+ Parameters
479
+ ----------
480
+ api_key_id : str
481
+ ID of the API key to add IP address to
482
+
483
+ ip : str
484
+ IP address to add to allowed list
485
+
486
+ request_options : typing.Optional[RequestOptions]
487
+ Request-specific configuration.
488
+
489
+ Returns
490
+ -------
491
+ HttpResponse[CreateSubAccountApiKeyIpAddressResponse]
492
+ IP address added successfully
493
+ """
494
+ _response = self._client_wrapper.httpx_client.request(
495
+ "api/v4/sub-account/api-key/ip-address/create",
496
+ base_url=self._client_wrapper.get_environment().base,
497
+ method="POST",
498
+ json={
499
+ "apiKeyId": api_key_id,
500
+ "ip": ip,
501
+ },
502
+ headers={
503
+ "content-type": "application/json",
504
+ },
505
+ request_options=request_options,
506
+ omit=OMIT,
507
+ )
508
+ try:
509
+ if 200 <= _response.status_code < 300:
510
+ _data = typing.cast(
511
+ CreateSubAccountApiKeyIpAddressResponse,
512
+ parse_obj_as(
513
+ type_=CreateSubAccountApiKeyIpAddressResponse, # type: ignore
514
+ object_=_response.json(),
515
+ ),
516
+ )
517
+ return HttpResponse(response=_response, data=_data)
518
+ if _response.status_code == 400:
519
+ raise BadRequestError(
520
+ headers=dict(_response.headers),
521
+ body=typing.cast(
522
+ typing.Optional[typing.Any],
523
+ parse_obj_as(
524
+ type_=typing.Optional[typing.Any], # type: ignore
525
+ object_=_response.json(),
526
+ ),
527
+ ),
528
+ )
529
+ _response_json = _response.json()
530
+ except JSONDecodeError:
531
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
532
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
533
+
534
+ def delete_sub_account_api_key_ip_address(
535
+ self, *, api_key_id: str, ip: str, request_options: typing.Optional[RequestOptions] = None
536
+ ) -> HttpResponse[DeleteSubAccountApiKeyIpAddressResponse]:
537
+ """
538
+ The endpoint removes an IP address from the allowed list for a [sub-account](/glossary#sub-account) API key.
539
+
540
+ <Warning>
541
+ Rate limit: 1000 requests/10 sec.
542
+ </Warning>
543
+
544
+ <Note>
545
+ The API does not cache the response.
546
+ </Note>
547
+
548
+ Parameters
549
+ ----------
550
+ api_key_id : str
551
+ ID of the API key to remove IP address from
552
+
553
+ ip : str
554
+ IP address to remove from allowed list
555
+
556
+ request_options : typing.Optional[RequestOptions]
557
+ Request-specific configuration.
558
+
559
+ Returns
560
+ -------
561
+ HttpResponse[DeleteSubAccountApiKeyIpAddressResponse]
562
+ IP address removed successfully
563
+ """
564
+ _response = self._client_wrapper.httpx_client.request(
565
+ "api/v4/sub-account/api-key/ip-address/delete",
566
+ base_url=self._client_wrapper.get_environment().base,
567
+ method="POST",
568
+ json={
569
+ "apiKeyId": api_key_id,
570
+ "ip": ip,
571
+ },
572
+ headers={
573
+ "content-type": "application/json",
574
+ },
575
+ request_options=request_options,
576
+ omit=OMIT,
577
+ )
578
+ try:
579
+ if 200 <= _response.status_code < 300:
580
+ _data = typing.cast(
581
+ DeleteSubAccountApiKeyIpAddressResponse,
582
+ parse_obj_as(
583
+ type_=DeleteSubAccountApiKeyIpAddressResponse, # type: ignore
584
+ object_=_response.json(),
585
+ ),
586
+ )
587
+ return HttpResponse(response=_response, data=_data)
588
+ if _response.status_code == 400:
589
+ raise BadRequestError(
590
+ headers=dict(_response.headers),
591
+ body=typing.cast(
592
+ typing.Optional[typing.Any],
593
+ parse_obj_as(
594
+ type_=typing.Optional[typing.Any], # type: ignore
595
+ object_=_response.json(),
596
+ ),
597
+ ),
598
+ )
599
+ _response_json = _response.json()
600
+ except JSONDecodeError:
601
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
602
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
603
+
604
+
605
+ class AsyncRawSubAccountApiKeysClient:
606
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
607
+ self._client_wrapper = client_wrapper
608
+
609
+ async def create_sub_account_api_key(
610
+ self,
611
+ *,
612
+ type: int,
613
+ sub_account_id: str,
614
+ title: typing.Optional[str] = OMIT,
615
+ request_options: typing.Optional[RequestOptions] = None,
616
+ ) -> AsyncHttpResponse[SubAccountApiKey]:
617
+ """
618
+ The endpoint creates a new API key for a [sub-account](/glossary#sub-account).
619
+
620
+ <Warning>
621
+ Rate limit: 1000 requests/10 sec.
622
+ </Warning>
623
+
624
+ <Note>
625
+ The API does not cache the response.
626
+ </Note>
627
+
628
+ Parameters
629
+ ----------
630
+ type : int
631
+ Type of API key (1 - info and trading; 2 - info, trading, deposits, withdraws)
632
+
633
+ sub_account_id : str
634
+ ID of the sub-account to create the API key for
635
+
636
+ title : typing.Optional[str]
637
+ Custom title/name for the API key
638
+
639
+ request_options : typing.Optional[RequestOptions]
640
+ Request-specific configuration.
641
+
642
+ Returns
643
+ -------
644
+ AsyncHttpResponse[SubAccountApiKey]
645
+ API key created successfully
646
+ """
647
+ _response = await self._client_wrapper.httpx_client.request(
648
+ "api/v4/sub-account/api-key/create",
649
+ base_url=self._client_wrapper.get_environment().base,
650
+ method="POST",
651
+ json={
652
+ "type": type,
653
+ "subAccountId": sub_account_id,
654
+ "title": title,
655
+ },
656
+ headers={
657
+ "content-type": "application/json",
658
+ },
659
+ request_options=request_options,
660
+ omit=OMIT,
661
+ )
662
+ try:
663
+ if 200 <= _response.status_code < 300:
664
+ _data = typing.cast(
665
+ SubAccountApiKey,
666
+ parse_obj_as(
667
+ type_=SubAccountApiKey, # type: ignore
668
+ object_=_response.json(),
669
+ ),
670
+ )
671
+ return AsyncHttpResponse(response=_response, data=_data)
672
+ if _response.status_code == 400:
673
+ raise BadRequestError(
674
+ headers=dict(_response.headers),
675
+ body=typing.cast(
676
+ typing.Optional[typing.Any],
677
+ parse_obj_as(
678
+ type_=typing.Optional[typing.Any], # type: ignore
679
+ object_=_response.json(),
680
+ ),
681
+ ),
682
+ )
683
+ _response_json = _response.json()
684
+ except JSONDecodeError:
685
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
686
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
687
+
688
+ async def edit_sub_account_api_key(
689
+ self,
690
+ *,
691
+ api_key_id: str,
692
+ title: str,
693
+ urls: typing.Sequence[EditSubAccountApiKeyRequestUrlsItem],
694
+ request_options: typing.Optional[RequestOptions] = None,
695
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
696
+ """
697
+ The endpoint updates an existing [sub-account](/glossary#sub-account) API key.
698
+
699
+ <Warning>
700
+ Rate limit: 1000 requests/10 sec.
701
+ </Warning>
702
+
703
+ <Note>
704
+ The API does not cache the response.
705
+ </Note>
706
+
707
+ Parameters
708
+ ----------
709
+ api_key_id : str
710
+ ID of the API key to update
711
+
712
+ title : str
713
+ New title for the API key
714
+
715
+ urls : typing.Sequence[EditSubAccountApiKeyRequestUrlsItem]
716
+ Array of URL objects for API key restrictions
717
+
718
+ request_options : typing.Optional[RequestOptions]
719
+ Request-specific configuration.
720
+
721
+ Returns
722
+ -------
723
+ AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
724
+ API key updated successfully
725
+ """
726
+ _response = await self._client_wrapper.httpx_client.request(
727
+ "api/v4/sub-account/api-key/edit",
728
+ base_url=self._client_wrapper.get_environment().base,
729
+ method="POST",
730
+ json={
731
+ "apiKeyId": api_key_id,
732
+ "title": title,
733
+ "urls": convert_and_respect_annotation_metadata(
734
+ object_=urls, annotation=typing.Sequence[EditSubAccountApiKeyRequestUrlsItem], direction="write"
735
+ ),
736
+ },
737
+ headers={
738
+ "content-type": "application/json",
739
+ },
740
+ request_options=request_options,
741
+ omit=OMIT,
742
+ )
743
+ try:
744
+ if 200 <= _response.status_code < 300:
745
+ _data = typing.cast(
746
+ typing.Dict[str, typing.Optional[typing.Any]],
747
+ parse_obj_as(
748
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
749
+ object_=_response.json(),
750
+ ),
751
+ )
752
+ return AsyncHttpResponse(response=_response, data=_data)
753
+ if _response.status_code == 400:
754
+ raise BadRequestError(
755
+ headers=dict(_response.headers),
756
+ body=typing.cast(
757
+ typing.Optional[typing.Any],
758
+ parse_obj_as(
759
+ type_=typing.Optional[typing.Any], # type: ignore
760
+ object_=_response.json(),
761
+ ),
762
+ ),
763
+ )
764
+ _response_json = _response.json()
765
+ except JSONDecodeError:
766
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
767
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
768
+
769
+ async def delete_sub_account_api_key(
770
+ self, *, api_key_id: str, request_options: typing.Optional[RequestOptions] = None
771
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
772
+ """
773
+ The endpoint deletes a [sub-account](/glossary#sub-account) API key.
774
+
775
+ <Warning>
776
+ Rate limit: 1000 requests/10 sec.
777
+ </Warning>
778
+
779
+ <Note>
780
+ The API does not cache the response.
781
+ </Note>
782
+
783
+ Parameters
784
+ ----------
785
+ api_key_id : str
786
+ ID of the API key to delete
787
+
788
+ request_options : typing.Optional[RequestOptions]
789
+ Request-specific configuration.
790
+
791
+ Returns
792
+ -------
793
+ AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
794
+ API key deleted successfully
795
+ """
796
+ _response = await self._client_wrapper.httpx_client.request(
797
+ "api/v4/sub-account/api-key/delete",
798
+ base_url=self._client_wrapper.get_environment().base,
799
+ method="POST",
800
+ json={
801
+ "apiKeyId": api_key_id,
802
+ },
803
+ headers={
804
+ "content-type": "application/json",
805
+ },
806
+ request_options=request_options,
807
+ omit=OMIT,
808
+ )
809
+ try:
810
+ if 200 <= _response.status_code < 300:
811
+ _data = typing.cast(
812
+ typing.Dict[str, typing.Optional[typing.Any]],
813
+ parse_obj_as(
814
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
815
+ object_=_response.json(),
816
+ ),
817
+ )
818
+ return AsyncHttpResponse(response=_response, data=_data)
819
+ if _response.status_code == 400:
820
+ raise BadRequestError(
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
+ _response_json = _response.json()
831
+ except JSONDecodeError:
832
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
833
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
834
+
835
+ async def list_sub_account_api_keys(
836
+ self,
837
+ *,
838
+ sub_account_id: typing.Optional[str] = OMIT,
839
+ limit: typing.Optional[int] = OMIT,
840
+ offset: typing.Optional[int] = OMIT,
841
+ request_options: typing.Optional[RequestOptions] = None,
842
+ ) -> AsyncHttpResponse[ListSubAccountApiKeysResponse]:
843
+ """
844
+ The endpoint retrieves a list of API keys for a [sub-account](/glossary#sub-account).
845
+ Note: For security reasons, the apiSecret field returns an empty string.
846
+
847
+ <Warning>
848
+ Rate limit: 1000 requests/10 sec.
849
+ </Warning>
850
+
851
+ <Note>
852
+ The API does not cache the response.
853
+ </Note>
854
+
855
+ Parameters
856
+ ----------
857
+ sub_account_id : typing.Optional[str]
858
+ ID of the sub-account to list API keys for
859
+
860
+ limit : typing.Optional[int]
861
+
862
+ offset : typing.Optional[int]
863
+
864
+ request_options : typing.Optional[RequestOptions]
865
+ Request-specific configuration.
866
+
867
+ Returns
868
+ -------
869
+ AsyncHttpResponse[ListSubAccountApiKeysResponse]
870
+ Successful response
871
+ """
872
+ _response = await self._client_wrapper.httpx_client.request(
873
+ "api/v4/sub-account/api-key/list",
874
+ base_url=self._client_wrapper.get_environment().base,
875
+ method="POST",
876
+ json={
877
+ "subAccountId": sub_account_id,
878
+ "limit": limit,
879
+ "offset": offset,
880
+ },
881
+ headers={
882
+ "content-type": "application/json",
883
+ },
884
+ request_options=request_options,
885
+ omit=OMIT,
886
+ )
887
+ try:
888
+ if 200 <= _response.status_code < 300:
889
+ _data = typing.cast(
890
+ ListSubAccountApiKeysResponse,
891
+ parse_obj_as(
892
+ type_=ListSubAccountApiKeysResponse, # type: ignore
893
+ object_=_response.json(),
894
+ ),
895
+ )
896
+ return AsyncHttpResponse(response=_response, data=_data)
897
+ if _response.status_code == 400:
898
+ raise BadRequestError(
899
+ headers=dict(_response.headers),
900
+ body=typing.cast(
901
+ typing.Optional[typing.Any],
902
+ parse_obj_as(
903
+ type_=typing.Optional[typing.Any], # type: ignore
904
+ object_=_response.json(),
905
+ ),
906
+ ),
907
+ )
908
+ _response_json = _response.json()
909
+ except JSONDecodeError:
910
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
911
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
912
+
913
+ async def reset_sub_account_api_key(
914
+ self, *, api_key_id: str, request_options: typing.Optional[RequestOptions] = None
915
+ ) -> AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
916
+ """
917
+ The endpoint resets (regenerates) an existing [sub-account](/glossary#sub-account) API key.
918
+
919
+ <Warning>
920
+ Rate limit: 1000 requests/10 sec.
921
+ </Warning>
922
+
923
+ <Note>
924
+ The API does not cache the response.
925
+ </Note>
926
+
927
+ Parameters
928
+ ----------
929
+ api_key_id : str
930
+ ID of the API key to reset
931
+
932
+ request_options : typing.Optional[RequestOptions]
933
+ Request-specific configuration.
934
+
935
+ Returns
936
+ -------
937
+ AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
938
+ API key reset successfully
939
+ """
940
+ _response = await self._client_wrapper.httpx_client.request(
941
+ "api/v4/sub-account/api-key/reset",
942
+ base_url=self._client_wrapper.get_environment().base,
943
+ method="POST",
944
+ json={
945
+ "apiKeyId": api_key_id,
946
+ },
947
+ headers={
948
+ "content-type": "application/json",
949
+ },
950
+ request_options=request_options,
951
+ omit=OMIT,
952
+ )
953
+ try:
954
+ if 200 <= _response.status_code < 300:
955
+ _data = typing.cast(
956
+ typing.Dict[str, typing.Optional[typing.Any]],
957
+ parse_obj_as(
958
+ type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
959
+ object_=_response.json(),
960
+ ),
961
+ )
962
+ return AsyncHttpResponse(response=_response, data=_data)
963
+ if _response.status_code == 400:
964
+ raise BadRequestError(
965
+ headers=dict(_response.headers),
966
+ body=typing.cast(
967
+ typing.Optional[typing.Any],
968
+ parse_obj_as(
969
+ type_=typing.Optional[typing.Any], # type: ignore
970
+ object_=_response.json(),
971
+ ),
972
+ ),
973
+ )
974
+ _response_json = _response.json()
975
+ except JSONDecodeError:
976
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
977
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
978
+
979
+ async def list_sub_account_api_key_ip_addresses(
980
+ self, *, api_key_id: str, request_options: typing.Optional[RequestOptions] = None
981
+ ) -> AsyncHttpResponse[ListSubAccountApiKeyIpAddressesResponse]:
982
+ """
983
+ The endpoint retrieves the list of IP addresses allowed for a [sub-account](/glossary#sub-account) API key.
984
+
985
+ <Warning>
986
+ Rate limit: 1000 requests/10 sec.
987
+ </Warning>
988
+
989
+ <Note>
990
+ The API does not cache the response.
991
+ </Note>
992
+
993
+ Parameters
994
+ ----------
995
+ api_key_id : str
996
+ ID of the API key to list IP addresses for
997
+
998
+ request_options : typing.Optional[RequestOptions]
999
+ Request-specific configuration.
1000
+
1001
+ Returns
1002
+ -------
1003
+ AsyncHttpResponse[ListSubAccountApiKeyIpAddressesResponse]
1004
+ Successful response
1005
+ """
1006
+ _response = await self._client_wrapper.httpx_client.request(
1007
+ "api/v4/sub-account/api-key/ip-address/list",
1008
+ base_url=self._client_wrapper.get_environment().base,
1009
+ method="POST",
1010
+ json={
1011
+ "apiKeyId": api_key_id,
1012
+ },
1013
+ headers={
1014
+ "content-type": "application/json",
1015
+ },
1016
+ request_options=request_options,
1017
+ omit=OMIT,
1018
+ )
1019
+ try:
1020
+ if 200 <= _response.status_code < 300:
1021
+ _data = typing.cast(
1022
+ ListSubAccountApiKeyIpAddressesResponse,
1023
+ parse_obj_as(
1024
+ type_=ListSubAccountApiKeyIpAddressesResponse, # type: ignore
1025
+ object_=_response.json(),
1026
+ ),
1027
+ )
1028
+ return AsyncHttpResponse(response=_response, data=_data)
1029
+ if _response.status_code == 400:
1030
+ raise BadRequestError(
1031
+ headers=dict(_response.headers),
1032
+ body=typing.cast(
1033
+ typing.Optional[typing.Any],
1034
+ parse_obj_as(
1035
+ type_=typing.Optional[typing.Any], # type: ignore
1036
+ object_=_response.json(),
1037
+ ),
1038
+ ),
1039
+ )
1040
+ _response_json = _response.json()
1041
+ except JSONDecodeError:
1042
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1043
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1044
+
1045
+ async def create_sub_account_api_key_ip_address(
1046
+ self, *, api_key_id: str, ip: str, request_options: typing.Optional[RequestOptions] = None
1047
+ ) -> AsyncHttpResponse[CreateSubAccountApiKeyIpAddressResponse]:
1048
+ """
1049
+ The endpoint adds a new IP address to the allowed list for a [sub-account](/glossary#sub-account) API key.
1050
+
1051
+ <Warning>
1052
+ Rate limit: 1000 requests/10 sec.
1053
+ </Warning>
1054
+
1055
+ <Note>
1056
+ The API does not cache the response.
1057
+ </Note>
1058
+
1059
+ Parameters
1060
+ ----------
1061
+ api_key_id : str
1062
+ ID of the API key to add IP address to
1063
+
1064
+ ip : str
1065
+ IP address to add to allowed list
1066
+
1067
+ request_options : typing.Optional[RequestOptions]
1068
+ Request-specific configuration.
1069
+
1070
+ Returns
1071
+ -------
1072
+ AsyncHttpResponse[CreateSubAccountApiKeyIpAddressResponse]
1073
+ IP address added successfully
1074
+ """
1075
+ _response = await self._client_wrapper.httpx_client.request(
1076
+ "api/v4/sub-account/api-key/ip-address/create",
1077
+ base_url=self._client_wrapper.get_environment().base,
1078
+ method="POST",
1079
+ json={
1080
+ "apiKeyId": api_key_id,
1081
+ "ip": ip,
1082
+ },
1083
+ headers={
1084
+ "content-type": "application/json",
1085
+ },
1086
+ request_options=request_options,
1087
+ omit=OMIT,
1088
+ )
1089
+ try:
1090
+ if 200 <= _response.status_code < 300:
1091
+ _data = typing.cast(
1092
+ CreateSubAccountApiKeyIpAddressResponse,
1093
+ parse_obj_as(
1094
+ type_=CreateSubAccountApiKeyIpAddressResponse, # type: ignore
1095
+ object_=_response.json(),
1096
+ ),
1097
+ )
1098
+ return AsyncHttpResponse(response=_response, data=_data)
1099
+ if _response.status_code == 400:
1100
+ raise BadRequestError(
1101
+ headers=dict(_response.headers),
1102
+ body=typing.cast(
1103
+ typing.Optional[typing.Any],
1104
+ parse_obj_as(
1105
+ type_=typing.Optional[typing.Any], # type: ignore
1106
+ object_=_response.json(),
1107
+ ),
1108
+ ),
1109
+ )
1110
+ _response_json = _response.json()
1111
+ except JSONDecodeError:
1112
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1113
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1114
+
1115
+ async def delete_sub_account_api_key_ip_address(
1116
+ self, *, api_key_id: str, ip: str, request_options: typing.Optional[RequestOptions] = None
1117
+ ) -> AsyncHttpResponse[DeleteSubAccountApiKeyIpAddressResponse]:
1118
+ """
1119
+ The endpoint removes an IP address from the allowed list for a [sub-account](/glossary#sub-account) API key.
1120
+
1121
+ <Warning>
1122
+ Rate limit: 1000 requests/10 sec.
1123
+ </Warning>
1124
+
1125
+ <Note>
1126
+ The API does not cache the response.
1127
+ </Note>
1128
+
1129
+ Parameters
1130
+ ----------
1131
+ api_key_id : str
1132
+ ID of the API key to remove IP address from
1133
+
1134
+ ip : str
1135
+ IP address to remove from allowed list
1136
+
1137
+ request_options : typing.Optional[RequestOptions]
1138
+ Request-specific configuration.
1139
+
1140
+ Returns
1141
+ -------
1142
+ AsyncHttpResponse[DeleteSubAccountApiKeyIpAddressResponse]
1143
+ IP address removed successfully
1144
+ """
1145
+ _response = await self._client_wrapper.httpx_client.request(
1146
+ "api/v4/sub-account/api-key/ip-address/delete",
1147
+ base_url=self._client_wrapper.get_environment().base,
1148
+ method="POST",
1149
+ json={
1150
+ "apiKeyId": api_key_id,
1151
+ "ip": ip,
1152
+ },
1153
+ headers={
1154
+ "content-type": "application/json",
1155
+ },
1156
+ request_options=request_options,
1157
+ omit=OMIT,
1158
+ )
1159
+ try:
1160
+ if 200 <= _response.status_code < 300:
1161
+ _data = typing.cast(
1162
+ DeleteSubAccountApiKeyIpAddressResponse,
1163
+ parse_obj_as(
1164
+ type_=DeleteSubAccountApiKeyIpAddressResponse, # type: ignore
1165
+ object_=_response.json(),
1166
+ ),
1167
+ )
1168
+ return AsyncHttpResponse(response=_response, data=_data)
1169
+ if _response.status_code == 400:
1170
+ raise BadRequestError(
1171
+ headers=dict(_response.headers),
1172
+ body=typing.cast(
1173
+ typing.Optional[typing.Any],
1174
+ parse_obj_as(
1175
+ type_=typing.Optional[typing.Any], # type: ignore
1176
+ object_=_response.json(),
1177
+ ),
1178
+ ),
1179
+ )
1180
+ _response_json = _response.json()
1181
+ except JSONDecodeError:
1182
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1183
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)