天择加密量化开放框架下载
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1117 lines
51 KiB

1 year ago
  1. # coding: utf-8
  2. """
  3. Gate API v4
  4. Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501
  5. Contact: support@mail.gate.io
  6. Generated by: https://openapi-generator.tech
  7. """
  8. from __future__ import absolute_import
  9. import re # noqa: F401
  10. # python 2 and python 3 compatibility library
  11. import six
  12. from gate_api.api_client import ApiClient
  13. from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401
  14. class SubAccountApi(object):
  15. """NOTE: This class is auto generated by OpenAPI Generator
  16. Ref: https://openapi-generator.tech
  17. Do not edit the class manually.
  18. """
  19. def __init__(self, api_client=None):
  20. if api_client is None:
  21. api_client = ApiClient()
  22. self.api_client = api_client
  23. def list_sub_accounts(self, **kwargs): # noqa: E501
  24. """List sub-accounts # noqa: E501
  25. This method makes a synchronous HTTP request by default. To make an
  26. asynchronous HTTP request, please pass async_req=True
  27. >>> thread = api.list_sub_accounts(async_req=True)
  28. >>> result = thread.get()
  29. :param bool async_req: execute request asynchronously
  30. :param _preload_content: if False, the urllib3.HTTPResponse object will
  31. be returned without reading/decoding response
  32. data. Default is True.
  33. :param _request_timeout: timeout setting for this request. If one
  34. number provided, it will be total request
  35. timeout. It can also be a pair (tuple) of
  36. (connection, read) timeouts.
  37. :rtype: list[gate_api.SubAccount]
  38. :return: If the method is called asynchronously,
  39. returns the request thread.
  40. """
  41. kwargs['_return_http_data_only'] = True
  42. return self.list_sub_accounts_with_http_info(**kwargs) # noqa: E501
  43. def list_sub_accounts_with_http_info(self, **kwargs): # noqa: E501
  44. """List sub-accounts # noqa: E501
  45. This method makes a synchronous HTTP request by default. To make an
  46. asynchronous HTTP request, please pass async_req=True
  47. >>> thread = api.list_sub_accounts_with_http_info(async_req=True)
  48. >>> result = thread.get()
  49. :param bool async_req: execute request asynchronously
  50. :param _return_http_data_only: response data without head status code
  51. and headers
  52. :param _preload_content: if False, the urllib3.HTTPResponse object will
  53. be returned without reading/decoding response
  54. data. Default is True.
  55. :param _request_timeout: timeout setting for this request. If one
  56. number provided, it will be total request
  57. timeout. It can also be a pair (tuple) of
  58. (connection, read) timeouts.
  59. :rtype: tuple(list[gate_api.SubAccount], status_code(int), headers(HTTPHeaderDict))
  60. :return: If the method is called asynchronously,
  61. returns the request thread.
  62. """
  63. local_var_params = locals()
  64. all_params = []
  65. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  66. for k, v in six.iteritems(local_var_params['kwargs']):
  67. if k not in all_params:
  68. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_sub_accounts" % k)
  69. local_var_params[k] = v
  70. del local_var_params['kwargs']
  71. collection_formats = {}
  72. path_params = {}
  73. query_params = []
  74. header_params = {}
  75. form_params = []
  76. local_var_files = {}
  77. body_params = None
  78. # HTTP header `Accept`
  79. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  80. # Authentication setting
  81. auth_settings = ['apiv4'] # noqa: E501
  82. return self.api_client.call_api(
  83. '/sub_accounts',
  84. 'GET',
  85. path_params,
  86. query_params,
  87. header_params,
  88. body=body_params,
  89. post_params=form_params,
  90. files=local_var_files,
  91. response_type='list[SubAccount]', # noqa: E501
  92. auth_settings=auth_settings,
  93. async_req=local_var_params.get('async_req'),
  94. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  95. _preload_content=local_var_params.get('_preload_content', True),
  96. _request_timeout=local_var_params.get('_request_timeout'),
  97. collection_formats=collection_formats,
  98. )
  99. def create_sub_accounts(self, sub_account, **kwargs): # noqa: E501
  100. """Create a new sub-account # noqa: E501
  101. This method makes a synchronous HTTP request by default. To make an
  102. asynchronous HTTP request, please pass async_req=True
  103. >>> thread = api.create_sub_accounts(sub_account, async_req=True)
  104. >>> result = thread.get()
  105. :param bool async_req: execute request asynchronously
  106. :param SubAccount sub_account: (required)
  107. :param _preload_content: if False, the urllib3.HTTPResponse object will
  108. be returned without reading/decoding response
  109. data. Default is True.
  110. :param _request_timeout: timeout setting for this request. If one
  111. number provided, it will be total request
  112. timeout. It can also be a pair (tuple) of
  113. (connection, read) timeouts.
  114. :rtype: gate_api.SubAccount
  115. :return: If the method is called asynchronously,
  116. returns the request thread.
  117. """
  118. kwargs['_return_http_data_only'] = True
  119. return self.create_sub_accounts_with_http_info(sub_account, **kwargs) # noqa: E501
  120. def create_sub_accounts_with_http_info(self, sub_account, **kwargs): # noqa: E501
  121. """Create a new sub-account # noqa: E501
  122. This method makes a synchronous HTTP request by default. To make an
  123. asynchronous HTTP request, please pass async_req=True
  124. >>> thread = api.create_sub_accounts_with_http_info(sub_account, async_req=True)
  125. >>> result = thread.get()
  126. :param bool async_req: execute request asynchronously
  127. :param SubAccount sub_account: (required)
  128. :param _return_http_data_only: response data without head status code
  129. and headers
  130. :param _preload_content: if False, the urllib3.HTTPResponse object will
  131. be returned without reading/decoding response
  132. data. Default is True.
  133. :param _request_timeout: timeout setting for this request. If one
  134. number provided, it will be total request
  135. timeout. It can also be a pair (tuple) of
  136. (connection, read) timeouts.
  137. :rtype: tuple(gate_api.SubAccount, status_code(int), headers(HTTPHeaderDict))
  138. :return: If the method is called asynchronously,
  139. returns the request thread.
  140. """
  141. local_var_params = locals()
  142. all_params = ['sub_account']
  143. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  144. for k, v in six.iteritems(local_var_params['kwargs']):
  145. if k not in all_params:
  146. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_sub_accounts" % k)
  147. local_var_params[k] = v
  148. del local_var_params['kwargs']
  149. # verify the required parameter 'sub_account' is set
  150. if self.api_client.client_side_validation and (
  151. 'sub_account' not in local_var_params or local_var_params['sub_account'] is None # noqa: E501
  152. ): # noqa: E501
  153. raise ApiValueError(
  154. "Missing the required parameter `sub_account` when calling `create_sub_accounts`"
  155. ) # noqa: E501
  156. collection_formats = {}
  157. path_params = {}
  158. query_params = []
  159. header_params = {}
  160. form_params = []
  161. local_var_files = {}
  162. body_params = None
  163. if 'sub_account' in local_var_params:
  164. body_params = local_var_params['sub_account']
  165. # HTTP header `Accept`
  166. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  167. # HTTP header `Content-Type`
  168. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  169. ['application/json']
  170. ) # noqa: E501
  171. # Authentication setting
  172. auth_settings = ['apiv4'] # noqa: E501
  173. return self.api_client.call_api(
  174. '/sub_accounts',
  175. 'POST',
  176. path_params,
  177. query_params,
  178. header_params,
  179. body=body_params,
  180. post_params=form_params,
  181. files=local_var_files,
  182. response_type='SubAccount', # noqa: E501
  183. auth_settings=auth_settings,
  184. async_req=local_var_params.get('async_req'),
  185. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  186. _preload_content=local_var_params.get('_preload_content', True),
  187. _request_timeout=local_var_params.get('_request_timeout'),
  188. collection_formats=collection_formats,
  189. )
  190. def get_sub_account(self, user_id, **kwargs): # noqa: E501
  191. """Get the sub-account # noqa: E501
  192. This method makes a synchronous HTTP request by default. To make an
  193. asynchronous HTTP request, please pass async_req=True
  194. >>> thread = api.get_sub_account(user_id, async_req=True)
  195. >>> result = thread.get()
  196. :param bool async_req: execute request asynchronously
  197. :param int user_id: Sub-account user id (required)
  198. :param _preload_content: if False, the urllib3.HTTPResponse object will
  199. be returned without reading/decoding response
  200. data. Default is True.
  201. :param _request_timeout: timeout setting for this request. If one
  202. number provided, it will be total request
  203. timeout. It can also be a pair (tuple) of
  204. (connection, read) timeouts.
  205. :rtype: gate_api.SubAccount
  206. :return: If the method is called asynchronously,
  207. returns the request thread.
  208. """
  209. kwargs['_return_http_data_only'] = True
  210. return self.get_sub_account_with_http_info(user_id, **kwargs) # noqa: E501
  211. def get_sub_account_with_http_info(self, user_id, **kwargs): # noqa: E501
  212. """Get the sub-account # noqa: E501
  213. This method makes a synchronous HTTP request by default. To make an
  214. asynchronous HTTP request, please pass async_req=True
  215. >>> thread = api.get_sub_account_with_http_info(user_id, async_req=True)
  216. >>> result = thread.get()
  217. :param bool async_req: execute request asynchronously
  218. :param int user_id: Sub-account user id (required)
  219. :param _return_http_data_only: response data without head status code
  220. and headers
  221. :param _preload_content: if False, the urllib3.HTTPResponse object will
  222. be returned without reading/decoding response
  223. data. Default is True.
  224. :param _request_timeout: timeout setting for this request. If one
  225. number provided, it will be total request
  226. timeout. It can also be a pair (tuple) of
  227. (connection, read) timeouts.
  228. :rtype: tuple(gate_api.SubAccount, status_code(int), headers(HTTPHeaderDict))
  229. :return: If the method is called asynchronously,
  230. returns the request thread.
  231. """
  232. local_var_params = locals()
  233. all_params = ['user_id']
  234. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  235. for k, v in six.iteritems(local_var_params['kwargs']):
  236. if k not in all_params:
  237. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_sub_account" % k)
  238. local_var_params[k] = v
  239. del local_var_params['kwargs']
  240. # verify the required parameter 'user_id' is set
  241. if self.api_client.client_side_validation and (
  242. 'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
  243. ): # noqa: E501
  244. raise ApiValueError("Missing the required parameter `user_id` when calling `get_sub_account`") # noqa: E501
  245. collection_formats = {}
  246. path_params = {}
  247. if 'user_id' in local_var_params:
  248. path_params['user_id'] = local_var_params['user_id'] # noqa: E501
  249. query_params = []
  250. header_params = {}
  251. form_params = []
  252. local_var_files = {}
  253. body_params = None
  254. # HTTP header `Accept`
  255. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  256. # Authentication setting
  257. auth_settings = ['apiv4'] # noqa: E501
  258. return self.api_client.call_api(
  259. '/sub_accounts/{user_id}',
  260. 'GET',
  261. path_params,
  262. query_params,
  263. header_params,
  264. body=body_params,
  265. post_params=form_params,
  266. files=local_var_files,
  267. response_type='SubAccount', # noqa: E501
  268. auth_settings=auth_settings,
  269. async_req=local_var_params.get('async_req'),
  270. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  271. _preload_content=local_var_params.get('_preload_content', True),
  272. _request_timeout=local_var_params.get('_request_timeout'),
  273. collection_formats=collection_formats,
  274. )
  275. def list_sub_account_keys(self, user_id, **kwargs): # noqa: E501
  276. """List all API Key of the sub-account # noqa: E501
  277. This method makes a synchronous HTTP request by default. To make an
  278. asynchronous HTTP request, please pass async_req=True
  279. >>> thread = api.list_sub_account_keys(user_id, async_req=True)
  280. >>> result = thread.get()
  281. :param bool async_req: execute request asynchronously
  282. :param int user_id: Sub-account user id (required)
  283. :param _preload_content: if False, the urllib3.HTTPResponse object will
  284. be returned without reading/decoding response
  285. data. Default is True.
  286. :param _request_timeout: timeout setting for this request. If one
  287. number provided, it will be total request
  288. timeout. It can also be a pair (tuple) of
  289. (connection, read) timeouts.
  290. :rtype: list[gate_api.SubAccountKey]
  291. :return: If the method is called asynchronously,
  292. returns the request thread.
  293. """
  294. kwargs['_return_http_data_only'] = True
  295. return self.list_sub_account_keys_with_http_info(user_id, **kwargs) # noqa: E501
  296. def list_sub_account_keys_with_http_info(self, user_id, **kwargs): # noqa: E501
  297. """List all API Key of the sub-account # noqa: E501
  298. This method makes a synchronous HTTP request by default. To make an
  299. asynchronous HTTP request, please pass async_req=True
  300. >>> thread = api.list_sub_account_keys_with_http_info(user_id, async_req=True)
  301. >>> result = thread.get()
  302. :param bool async_req: execute request asynchronously
  303. :param int user_id: Sub-account user id (required)
  304. :param _return_http_data_only: response data without head status code
  305. and headers
  306. :param _preload_content: if False, the urllib3.HTTPResponse object will
  307. be returned without reading/decoding response
  308. data. Default is True.
  309. :param _request_timeout: timeout setting for this request. If one
  310. number provided, it will be total request
  311. timeout. It can also be a pair (tuple) of
  312. (connection, read) timeouts.
  313. :rtype: tuple(list[gate_api.SubAccountKey], status_code(int), headers(HTTPHeaderDict))
  314. :return: If the method is called asynchronously,
  315. returns the request thread.
  316. """
  317. local_var_params = locals()
  318. all_params = ['user_id']
  319. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  320. for k, v in six.iteritems(local_var_params['kwargs']):
  321. if k not in all_params:
  322. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_sub_account_keys" % k)
  323. local_var_params[k] = v
  324. del local_var_params['kwargs']
  325. # verify the required parameter 'user_id' is set
  326. if self.api_client.client_side_validation and (
  327. 'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
  328. ): # noqa: E501
  329. raise ApiValueError(
  330. "Missing the required parameter `user_id` when calling `list_sub_account_keys`"
  331. ) # noqa: E501
  332. collection_formats = {}
  333. path_params = {}
  334. if 'user_id' in local_var_params:
  335. path_params['user_id'] = local_var_params['user_id'] # noqa: E501
  336. query_params = []
  337. header_params = {}
  338. form_params = []
  339. local_var_files = {}
  340. body_params = None
  341. # HTTP header `Accept`
  342. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  343. # Authentication setting
  344. auth_settings = ['apiv4'] # noqa: E501
  345. return self.api_client.call_api(
  346. '/sub_accounts/{user_id}/keys',
  347. 'GET',
  348. path_params,
  349. query_params,
  350. header_params,
  351. body=body_params,
  352. post_params=form_params,
  353. files=local_var_files,
  354. response_type='list[SubAccountKey]', # noqa: E501
  355. auth_settings=auth_settings,
  356. async_req=local_var_params.get('async_req'),
  357. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  358. _preload_content=local_var_params.get('_preload_content', True),
  359. _request_timeout=local_var_params.get('_request_timeout'),
  360. collection_formats=collection_formats,
  361. )
  362. def create_sub_account_keys(self, user_id, sub_account_key, **kwargs): # noqa: E501
  363. """Create API Key of the sub-account # noqa: E501
  364. This method makes a synchronous HTTP request by default. To make an
  365. asynchronous HTTP request, please pass async_req=True
  366. >>> thread = api.create_sub_account_keys(user_id, sub_account_key, async_req=True)
  367. >>> result = thread.get()
  368. :param bool async_req: execute request asynchronously
  369. :param int user_id: Sub-account user id (required)
  370. :param SubAccountKey sub_account_key: (required)
  371. :param _preload_content: if False, the urllib3.HTTPResponse object will
  372. be returned without reading/decoding response
  373. data. Default is True.
  374. :param _request_timeout: timeout setting for this request. If one
  375. number provided, it will be total request
  376. timeout. It can also be a pair (tuple) of
  377. (connection, read) timeouts.
  378. :rtype: list[gate_api.SubAccountKey]
  379. :return: If the method is called asynchronously,
  380. returns the request thread.
  381. """
  382. kwargs['_return_http_data_only'] = True
  383. return self.create_sub_account_keys_with_http_info(user_id, sub_account_key, **kwargs) # noqa: E501
  384. def create_sub_account_keys_with_http_info(self, user_id, sub_account_key, **kwargs): # noqa: E501
  385. """Create API Key of the sub-account # noqa: E501
  386. This method makes a synchronous HTTP request by default. To make an
  387. asynchronous HTTP request, please pass async_req=True
  388. >>> thread = api.create_sub_account_keys_with_http_info(user_id, sub_account_key, async_req=True)
  389. >>> result = thread.get()
  390. :param bool async_req: execute request asynchronously
  391. :param int user_id: Sub-account user id (required)
  392. :param SubAccountKey sub_account_key: (required)
  393. :param _return_http_data_only: response data without head status code
  394. and headers
  395. :param _preload_content: if False, the urllib3.HTTPResponse object will
  396. be returned without reading/decoding response
  397. data. Default is True.
  398. :param _request_timeout: timeout setting for this request. If one
  399. number provided, it will be total request
  400. timeout. It can also be a pair (tuple) of
  401. (connection, read) timeouts.
  402. :rtype: tuple(list[gate_api.SubAccountKey], status_code(int), headers(HTTPHeaderDict))
  403. :return: If the method is called asynchronously,
  404. returns the request thread.
  405. """
  406. local_var_params = locals()
  407. all_params = ['user_id', 'sub_account_key']
  408. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  409. for k, v in six.iteritems(local_var_params['kwargs']):
  410. if k not in all_params:
  411. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_sub_account_keys" % k)
  412. local_var_params[k] = v
  413. del local_var_params['kwargs']
  414. # verify the required parameter 'user_id' is set
  415. if self.api_client.client_side_validation and (
  416. 'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
  417. ): # noqa: E501
  418. raise ApiValueError(
  419. "Missing the required parameter `user_id` when calling `create_sub_account_keys`"
  420. ) # noqa: E501
  421. # verify the required parameter 'sub_account_key' is set
  422. if self.api_client.client_side_validation and (
  423. 'sub_account_key' not in local_var_params or local_var_params['sub_account_key'] is None # noqa: E501
  424. ): # noqa: E501
  425. raise ApiValueError(
  426. "Missing the required parameter `sub_account_key` when calling `create_sub_account_keys`"
  427. ) # noqa: E501
  428. collection_formats = {}
  429. path_params = {}
  430. if 'user_id' in local_var_params:
  431. path_params['user_id'] = local_var_params['user_id'] # noqa: E501
  432. query_params = []
  433. header_params = {}
  434. form_params = []
  435. local_var_files = {}
  436. body_params = None
  437. if 'sub_account_key' in local_var_params:
  438. body_params = local_var_params['sub_account_key']
  439. # HTTP header `Accept`
  440. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  441. # HTTP header `Content-Type`
  442. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  443. ['application/json']
  444. ) # noqa: E501
  445. # Authentication setting
  446. auth_settings = ['apiv4'] # noqa: E501
  447. return self.api_client.call_api(
  448. '/sub_accounts/{user_id}/keys',
  449. 'POST',
  450. path_params,
  451. query_params,
  452. header_params,
  453. body=body_params,
  454. post_params=form_params,
  455. files=local_var_files,
  456. response_type='list[SubAccountKey]', # noqa: E501
  457. auth_settings=auth_settings,
  458. async_req=local_var_params.get('async_req'),
  459. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  460. _preload_content=local_var_params.get('_preload_content', True),
  461. _request_timeout=local_var_params.get('_request_timeout'),
  462. collection_formats=collection_formats,
  463. )
  464. def get_sub_account_key(self, user_id, key, **kwargs): # noqa: E501
  465. """Get the API Key of the sub-account # noqa: E501
  466. This method makes a synchronous HTTP request by default. To make an
  467. asynchronous HTTP request, please pass async_req=True
  468. >>> thread = api.get_sub_account_key(user_id, key, async_req=True)
  469. >>> result = thread.get()
  470. :param bool async_req: execute request asynchronously
  471. :param int user_id: Sub-account user id (required)
  472. :param str key: The API Key of the sub-account (required)
  473. :param _preload_content: if False, the urllib3.HTTPResponse object will
  474. be returned without reading/decoding response
  475. data. Default is True.
  476. :param _request_timeout: timeout setting for this request. If one
  477. number provided, it will be total request
  478. timeout. It can also be a pair (tuple) of
  479. (connection, read) timeouts.
  480. :rtype: gate_api.SubAccountKey
  481. :return: If the method is called asynchronously,
  482. returns the request thread.
  483. """
  484. kwargs['_return_http_data_only'] = True
  485. return self.get_sub_account_key_with_http_info(user_id, key, **kwargs) # noqa: E501
  486. def get_sub_account_key_with_http_info(self, user_id, key, **kwargs): # noqa: E501
  487. """Get the API Key of the sub-account # noqa: E501
  488. This method makes a synchronous HTTP request by default. To make an
  489. asynchronous HTTP request, please pass async_req=True
  490. >>> thread = api.get_sub_account_key_with_http_info(user_id, key, async_req=True)
  491. >>> result = thread.get()
  492. :param bool async_req: execute request asynchronously
  493. :param int user_id: Sub-account user id (required)
  494. :param str key: The API Key of the sub-account (required)
  495. :param _return_http_data_only: response data without head status code
  496. and headers
  497. :param _preload_content: if False, the urllib3.HTTPResponse object will
  498. be returned without reading/decoding response
  499. data. Default is True.
  500. :param _request_timeout: timeout setting for this request. If one
  501. number provided, it will be total request
  502. timeout. It can also be a pair (tuple) of
  503. (connection, read) timeouts.
  504. :rtype: tuple(gate_api.SubAccountKey, status_code(int), headers(HTTPHeaderDict))
  505. :return: If the method is called asynchronously,
  506. returns the request thread.
  507. """
  508. local_var_params = locals()
  509. all_params = ['user_id', 'key']
  510. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  511. for k, v in six.iteritems(local_var_params['kwargs']):
  512. if k not in all_params:
  513. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_sub_account_key" % k)
  514. local_var_params[k] = v
  515. del local_var_params['kwargs']
  516. # verify the required parameter 'user_id' is set
  517. if self.api_client.client_side_validation and (
  518. 'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
  519. ): # noqa: E501
  520. raise ApiValueError(
  521. "Missing the required parameter `user_id` when calling `get_sub_account_key`"
  522. ) # noqa: E501
  523. # verify the required parameter 'key' is set
  524. if self.api_client.client_side_validation and (
  525. 'key' not in local_var_params or local_var_params['key'] is None # noqa: E501
  526. ): # noqa: E501
  527. raise ApiValueError("Missing the required parameter `key` when calling `get_sub_account_key`") # noqa: E501
  528. collection_formats = {}
  529. path_params = {}
  530. if 'user_id' in local_var_params:
  531. path_params['user_id'] = local_var_params['user_id'] # noqa: E501
  532. if 'key' in local_var_params:
  533. path_params['key'] = local_var_params['key'] # noqa: E501
  534. query_params = []
  535. header_params = {}
  536. form_params = []
  537. local_var_files = {}
  538. body_params = None
  539. # HTTP header `Accept`
  540. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  541. # Authentication setting
  542. auth_settings = ['apiv4'] # noqa: E501
  543. return self.api_client.call_api(
  544. '/sub_accounts/{user_id}/keys/{key}',
  545. 'GET',
  546. path_params,
  547. query_params,
  548. header_params,
  549. body=body_params,
  550. post_params=form_params,
  551. files=local_var_files,
  552. response_type='SubAccountKey', # noqa: E501
  553. auth_settings=auth_settings,
  554. async_req=local_var_params.get('async_req'),
  555. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  556. _preload_content=local_var_params.get('_preload_content', True),
  557. _request_timeout=local_var_params.get('_request_timeout'),
  558. collection_formats=collection_formats,
  559. )
  560. def update_sub_account_keys(self, user_id, key, sub_account_key, **kwargs): # noqa: E501
  561. """Update API key of the sub-account # noqa: E501
  562. This method makes a synchronous HTTP request by default. To make an
  563. asynchronous HTTP request, please pass async_req=True
  564. >>> thread = api.update_sub_account_keys(user_id, key, sub_account_key, async_req=True)
  565. >>> result = thread.get()
  566. :param bool async_req: execute request asynchronously
  567. :param int user_id: Sub-account user id (required)
  568. :param str key: The API Key of the sub-account (required)
  569. :param SubAccountKey sub_account_key: (required)
  570. :param _preload_content: if False, the urllib3.HTTPResponse object will
  571. be returned without reading/decoding response
  572. data. Default is True.
  573. :param _request_timeout: timeout setting for this request. If one
  574. number provided, it will be total request
  575. timeout. It can also be a pair (tuple) of
  576. (connection, read) timeouts.
  577. :rtype: None
  578. :return: If the method is called asynchronously,
  579. returns the request thread.
  580. """
  581. kwargs['_return_http_data_only'] = True
  582. return self.update_sub_account_keys_with_http_info(user_id, key, sub_account_key, **kwargs) # noqa: E501
  583. def update_sub_account_keys_with_http_info(self, user_id, key, sub_account_key, **kwargs): # noqa: E501
  584. """Update API key of the sub-account # noqa: E501
  585. This method makes a synchronous HTTP request by default. To make an
  586. asynchronous HTTP request, please pass async_req=True
  587. >>> thread = api.update_sub_account_keys_with_http_info(user_id, key, sub_account_key, async_req=True)
  588. >>> result = thread.get()
  589. :param bool async_req: execute request asynchronously
  590. :param int user_id: Sub-account user id (required)
  591. :param str key: The API Key of the sub-account (required)
  592. :param SubAccountKey sub_account_key: (required)
  593. :param _return_http_data_only: response data without head status code
  594. and headers
  595. :param _preload_content: if False, the urllib3.HTTPResponse object will
  596. be returned without reading/decoding response
  597. data. Default is True.
  598. :param _request_timeout: timeout setting for this request. If one
  599. number provided, it will be total request
  600. timeout. It can also be a pair (tuple) of
  601. (connection, read) timeouts.
  602. :rtype: None
  603. :return: If the method is called asynchronously,
  604. returns the request thread.
  605. """
  606. local_var_params = locals()
  607. all_params = ['user_id', 'key', 'sub_account_key']
  608. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  609. for k, v in six.iteritems(local_var_params['kwargs']):
  610. if k not in all_params:
  611. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method update_sub_account_keys" % k)
  612. local_var_params[k] = v
  613. del local_var_params['kwargs']
  614. # verify the required parameter 'user_id' is set
  615. if self.api_client.client_side_validation and (
  616. 'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
  617. ): # noqa: E501
  618. raise ApiValueError(
  619. "Missing the required parameter `user_id` when calling `update_sub_account_keys`"
  620. ) # noqa: E501
  621. # verify the required parameter 'key' is set
  622. if self.api_client.client_side_validation and (
  623. 'key' not in local_var_params or local_var_params['key'] is None # noqa: E501
  624. ): # noqa: E501
  625. raise ApiValueError(
  626. "Missing the required parameter `key` when calling `update_sub_account_keys`"
  627. ) # noqa: E501
  628. # verify the required parameter 'sub_account_key' is set
  629. if self.api_client.client_side_validation and (
  630. 'sub_account_key' not in local_var_params or local_var_params['sub_account_key'] is None # noqa: E501
  631. ): # noqa: E501
  632. raise ApiValueError(
  633. "Missing the required parameter `sub_account_key` when calling `update_sub_account_keys`"
  634. ) # noqa: E501
  635. collection_formats = {}
  636. path_params = {}
  637. if 'user_id' in local_var_params:
  638. path_params['user_id'] = local_var_params['user_id'] # noqa: E501
  639. if 'key' in local_var_params:
  640. path_params['key'] = local_var_params['key'] # noqa: E501
  641. query_params = []
  642. header_params = {}
  643. form_params = []
  644. local_var_files = {}
  645. body_params = None
  646. if 'sub_account_key' in local_var_params:
  647. body_params = local_var_params['sub_account_key']
  648. # HTTP header `Content-Type`
  649. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  650. ['application/json']
  651. ) # noqa: E501
  652. # Authentication setting
  653. auth_settings = ['apiv4'] # noqa: E501
  654. return self.api_client.call_api(
  655. '/sub_accounts/{user_id}/keys/{key}',
  656. 'PUT',
  657. path_params,
  658. query_params,
  659. header_params,
  660. body=body_params,
  661. post_params=form_params,
  662. files=local_var_files,
  663. response_type=None, # noqa: E501
  664. auth_settings=auth_settings,
  665. async_req=local_var_params.get('async_req'),
  666. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  667. _preload_content=local_var_params.get('_preload_content', True),
  668. _request_timeout=local_var_params.get('_request_timeout'),
  669. collection_formats=collection_formats,
  670. )
  671. def delete_sub_account_keys(self, user_id, key, **kwargs): # noqa: E501
  672. """Delete API key of the sub-account # noqa: E501
  673. This method makes a synchronous HTTP request by default. To make an
  674. asynchronous HTTP request, please pass async_req=True
  675. >>> thread = api.delete_sub_account_keys(user_id, key, async_req=True)
  676. >>> result = thread.get()
  677. :param bool async_req: execute request asynchronously
  678. :param int user_id: Sub-account user id (required)
  679. :param str key: The API Key of the sub-account (required)
  680. :param _preload_content: if False, the urllib3.HTTPResponse object will
  681. be returned without reading/decoding response
  682. data. Default is True.
  683. :param _request_timeout: timeout setting for this request. If one
  684. number provided, it will be total request
  685. timeout. It can also be a pair (tuple) of
  686. (connection, read) timeouts.
  687. :rtype: None
  688. :return: If the method is called asynchronously,
  689. returns the request thread.
  690. """
  691. kwargs['_return_http_data_only'] = True
  692. return self.delete_sub_account_keys_with_http_info(user_id, key, **kwargs) # noqa: E501
  693. def delete_sub_account_keys_with_http_info(self, user_id, key, **kwargs): # noqa: E501
  694. """Delete API key of the sub-account # noqa: E501
  695. This method makes a synchronous HTTP request by default. To make an
  696. asynchronous HTTP request, please pass async_req=True
  697. >>> thread = api.delete_sub_account_keys_with_http_info(user_id, key, async_req=True)
  698. >>> result = thread.get()
  699. :param bool async_req: execute request asynchronously
  700. :param int user_id: Sub-account user id (required)
  701. :param str key: The API Key of the sub-account (required)
  702. :param _return_http_data_only: response data without head status code
  703. and headers
  704. :param _preload_content: if False, the urllib3.HTTPResponse object will
  705. be returned without reading/decoding response
  706. data. Default is True.
  707. :param _request_timeout: timeout setting for this request. If one
  708. number provided, it will be total request
  709. timeout. It can also be a pair (tuple) of
  710. (connection, read) timeouts.
  711. :rtype: None
  712. :return: If the method is called asynchronously,
  713. returns the request thread.
  714. """
  715. local_var_params = locals()
  716. all_params = ['user_id', 'key']
  717. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  718. for k, v in six.iteritems(local_var_params['kwargs']):
  719. if k not in all_params:
  720. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method delete_sub_account_keys" % k)
  721. local_var_params[k] = v
  722. del local_var_params['kwargs']
  723. # verify the required parameter 'user_id' is set
  724. if self.api_client.client_side_validation and (
  725. 'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
  726. ): # noqa: E501
  727. raise ApiValueError(
  728. "Missing the required parameter `user_id` when calling `delete_sub_account_keys`"
  729. ) # noqa: E501
  730. # verify the required parameter 'key' is set
  731. if self.api_client.client_side_validation and (
  732. 'key' not in local_var_params or local_var_params['key'] is None # noqa: E501
  733. ): # noqa: E501
  734. raise ApiValueError(
  735. "Missing the required parameter `key` when calling `delete_sub_account_keys`"
  736. ) # noqa: E501
  737. collection_formats = {}
  738. path_params = {}
  739. if 'user_id' in local_var_params:
  740. path_params['user_id'] = local_var_params['user_id'] # noqa: E501
  741. if 'key' in local_var_params:
  742. path_params['key'] = local_var_params['key'] # noqa: E501
  743. query_params = []
  744. header_params = {}
  745. form_params = []
  746. local_var_files = {}
  747. body_params = None
  748. # Authentication setting
  749. auth_settings = ['apiv4'] # noqa: E501
  750. return self.api_client.call_api(
  751. '/sub_accounts/{user_id}/keys/{key}',
  752. 'DELETE',
  753. path_params,
  754. query_params,
  755. header_params,
  756. body=body_params,
  757. post_params=form_params,
  758. files=local_var_files,
  759. response_type=None, # noqa: E501
  760. auth_settings=auth_settings,
  761. async_req=local_var_params.get('async_req'),
  762. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  763. _preload_content=local_var_params.get('_preload_content', True),
  764. _request_timeout=local_var_params.get('_request_timeout'),
  765. collection_formats=collection_formats,
  766. )
  767. def lock_sub_account(self, user_id, **kwargs): # noqa: E501
  768. """Lock the sub-account # noqa: E501
  769. This method makes a synchronous HTTP request by default. To make an
  770. asynchronous HTTP request, please pass async_req=True
  771. >>> thread = api.lock_sub_account(user_id, async_req=True)
  772. >>> result = thread.get()
  773. :param bool async_req: execute request asynchronously
  774. :param int user_id: The user id of the sub-account (required)
  775. :param _preload_content: if False, the urllib3.HTTPResponse object will
  776. be returned without reading/decoding response
  777. data. Default is True.
  778. :param _request_timeout: timeout setting for this request. If one
  779. number provided, it will be total request
  780. timeout. It can also be a pair (tuple) of
  781. (connection, read) timeouts.
  782. :rtype: None
  783. :return: If the method is called asynchronously,
  784. returns the request thread.
  785. """
  786. kwargs['_return_http_data_only'] = True
  787. return self.lock_sub_account_with_http_info(user_id, **kwargs) # noqa: E501
  788. def lock_sub_account_with_http_info(self, user_id, **kwargs): # noqa: E501
  789. """Lock the sub-account # noqa: E501
  790. This method makes a synchronous HTTP request by default. To make an
  791. asynchronous HTTP request, please pass async_req=True
  792. >>> thread = api.lock_sub_account_with_http_info(user_id, async_req=True)
  793. >>> result = thread.get()
  794. :param bool async_req: execute request asynchronously
  795. :param int user_id: The user id of the sub-account (required)
  796. :param _return_http_data_only: response data without head status code
  797. and headers
  798. :param _preload_content: if False, the urllib3.HTTPResponse object will
  799. be returned without reading/decoding response
  800. data. Default is True.
  801. :param _request_timeout: timeout setting for this request. If one
  802. number provided, it will be total request
  803. timeout. It can also be a pair (tuple) of
  804. (connection, read) timeouts.
  805. :rtype: None
  806. :return: If the method is called asynchronously,
  807. returns the request thread.
  808. """
  809. local_var_params = locals()
  810. all_params = ['user_id']
  811. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  812. for k, v in six.iteritems(local_var_params['kwargs']):
  813. if k not in all_params:
  814. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method lock_sub_account" % k)
  815. local_var_params[k] = v
  816. del local_var_params['kwargs']
  817. # verify the required parameter 'user_id' is set
  818. if self.api_client.client_side_validation and (
  819. 'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
  820. ): # noqa: E501
  821. raise ApiValueError(
  822. "Missing the required parameter `user_id` when calling `lock_sub_account`"
  823. ) # noqa: E501
  824. collection_formats = {}
  825. path_params = {}
  826. if 'user_id' in local_var_params:
  827. path_params['user_id'] = local_var_params['user_id'] # noqa: E501
  828. query_params = []
  829. header_params = {}
  830. form_params = []
  831. local_var_files = {}
  832. body_params = None
  833. # Authentication setting
  834. auth_settings = ['apiv4'] # noqa: E501
  835. return self.api_client.call_api(
  836. '/sub_accounts/{user_id}/lock',
  837. 'POST',
  838. path_params,
  839. query_params,
  840. header_params,
  841. body=body_params,
  842. post_params=form_params,
  843. files=local_var_files,
  844. response_type=None, # noqa: E501
  845. auth_settings=auth_settings,
  846. async_req=local_var_params.get('async_req'),
  847. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  848. _preload_content=local_var_params.get('_preload_content', True),
  849. _request_timeout=local_var_params.get('_request_timeout'),
  850. collection_formats=collection_formats,
  851. )
  852. def unlock_sub_account(self, user_id, **kwargs): # noqa: E501
  853. """Unlock the sub-account # noqa: E501
  854. This method makes a synchronous HTTP request by default. To make an
  855. asynchronous HTTP request, please pass async_req=True
  856. >>> thread = api.unlock_sub_account(user_id, async_req=True)
  857. >>> result = thread.get()
  858. :param bool async_req: execute request asynchronously
  859. :param int user_id: The user id of the sub-account (required)
  860. :param _preload_content: if False, the urllib3.HTTPResponse object will
  861. be returned without reading/decoding response
  862. data. Default is True.
  863. :param _request_timeout: timeout setting for this request. If one
  864. number provided, it will be total request
  865. timeout. It can also be a pair (tuple) of
  866. (connection, read) timeouts.
  867. :rtype: None
  868. :return: If the method is called asynchronously,
  869. returns the request thread.
  870. """
  871. kwargs['_return_http_data_only'] = True
  872. return self.unlock_sub_account_with_http_info(user_id, **kwargs) # noqa: E501
  873. def unlock_sub_account_with_http_info(self, user_id, **kwargs): # noqa: E501
  874. """Unlock the sub-account # noqa: E501
  875. This method makes a synchronous HTTP request by default. To make an
  876. asynchronous HTTP request, please pass async_req=True
  877. >>> thread = api.unlock_sub_account_with_http_info(user_id, async_req=True)
  878. >>> result = thread.get()
  879. :param bool async_req: execute request asynchronously
  880. :param int user_id: The user id of the sub-account (required)
  881. :param _return_http_data_only: response data without head status code
  882. and headers
  883. :param _preload_content: if False, the urllib3.HTTPResponse object will
  884. be returned without reading/decoding response
  885. data. Default is True.
  886. :param _request_timeout: timeout setting for this request. If one
  887. number provided, it will be total request
  888. timeout. It can also be a pair (tuple) of
  889. (connection, read) timeouts.
  890. :rtype: None
  891. :return: If the method is called asynchronously,
  892. returns the request thread.
  893. """
  894. local_var_params = locals()
  895. all_params = ['user_id']
  896. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  897. for k, v in six.iteritems(local_var_params['kwargs']):
  898. if k not in all_params:
  899. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method unlock_sub_account" % k)
  900. local_var_params[k] = v
  901. del local_var_params['kwargs']
  902. # verify the required parameter 'user_id' is set
  903. if self.api_client.client_side_validation and (
  904. 'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
  905. ): # noqa: E501
  906. raise ApiValueError(
  907. "Missing the required parameter `user_id` when calling `unlock_sub_account`"
  908. ) # noqa: E501
  909. collection_formats = {}
  910. path_params = {}
  911. if 'user_id' in local_var_params:
  912. path_params['user_id'] = local_var_params['user_id'] # noqa: E501
  913. query_params = []
  914. header_params = {}
  915. form_params = []
  916. local_var_files = {}
  917. body_params = None
  918. # Authentication setting
  919. auth_settings = ['apiv4'] # noqa: E501
  920. return self.api_client.call_api(
  921. '/sub_accounts/{user_id}/unlock',
  922. 'POST',
  923. path_params,
  924. query_params,
  925. header_params,
  926. body=body_params,
  927. post_params=form_params,
  928. files=local_var_files,
  929. response_type=None, # noqa: E501
  930. auth_settings=auth_settings,
  931. async_req=local_var_params.get('async_req'),
  932. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  933. _preload_content=local_var_params.get('_preload_content', True),
  934. _request_timeout=local_var_params.get('_request_timeout'),
  935. collection_formats=collection_formats,
  936. )