# coding: utf-8
|
|
|
|
"""
|
|
Gate API v4
|
|
|
|
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
|
|
|
|
Contact: support@mail.gate.io
|
|
Generated by: https://openapi-generator.tech
|
|
"""
|
|
|
|
|
|
from __future__ import absolute_import
|
|
|
|
import re # noqa: F401
|
|
|
|
# python 2 and python 3 compatibility library
|
|
import six
|
|
|
|
from gate_api.api_client import ApiClient
|
|
from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401
|
|
|
|
|
|
class SubAccountApi(object):
|
|
"""NOTE: This class is auto generated by OpenAPI Generator
|
|
Ref: https://openapi-generator.tech
|
|
|
|
Do not edit the class manually.
|
|
"""
|
|
|
|
def __init__(self, api_client=None):
|
|
if api_client is None:
|
|
api_client = ApiClient()
|
|
self.api_client = api_client
|
|
|
|
def list_sub_accounts(self, **kwargs): # noqa: E501
|
|
"""List sub-accounts # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.list_sub_accounts(async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: list[gate_api.SubAccount]
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
kwargs['_return_http_data_only'] = True
|
|
return self.list_sub_accounts_with_http_info(**kwargs) # noqa: E501
|
|
|
|
def list_sub_accounts_with_http_info(self, **kwargs): # noqa: E501
|
|
"""List sub-accounts # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.list_sub_accounts_with_http_info(async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param _return_http_data_only: response data without head status code
|
|
and headers
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: tuple(list[gate_api.SubAccount], status_code(int), headers(HTTPHeaderDict))
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
|
|
local_var_params = locals()
|
|
|
|
all_params = []
|
|
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
|
|
|
|
for k, v in six.iteritems(local_var_params['kwargs']):
|
|
if k not in all_params:
|
|
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_sub_accounts" % k)
|
|
local_var_params[k] = v
|
|
del local_var_params['kwargs']
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
|
|
query_params = []
|
|
|
|
header_params = {}
|
|
|
|
form_params = []
|
|
local_var_files = {}
|
|
|
|
body_params = None
|
|
# HTTP header `Accept`
|
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
|
|
|
|
# Authentication setting
|
|
auth_settings = ['apiv4'] # noqa: E501
|
|
|
|
return self.api_client.call_api(
|
|
'/sub_accounts',
|
|
'GET',
|
|
path_params,
|
|
query_params,
|
|
header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
files=local_var_files,
|
|
response_type='list[SubAccount]', # noqa: E501
|
|
auth_settings=auth_settings,
|
|
async_req=local_var_params.get('async_req'),
|
|
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
|
_preload_content=local_var_params.get('_preload_content', True),
|
|
_request_timeout=local_var_params.get('_request_timeout'),
|
|
collection_formats=collection_formats,
|
|
)
|
|
|
|
def create_sub_accounts(self, sub_account, **kwargs): # noqa: E501
|
|
"""Create a new sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.create_sub_accounts(sub_account, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param SubAccount sub_account: (required)
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: gate_api.SubAccount
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
kwargs['_return_http_data_only'] = True
|
|
return self.create_sub_accounts_with_http_info(sub_account, **kwargs) # noqa: E501
|
|
|
|
def create_sub_accounts_with_http_info(self, sub_account, **kwargs): # noqa: E501
|
|
"""Create a new sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.create_sub_accounts_with_http_info(sub_account, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param SubAccount sub_account: (required)
|
|
:param _return_http_data_only: response data without head status code
|
|
and headers
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: tuple(gate_api.SubAccount, status_code(int), headers(HTTPHeaderDict))
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
|
|
local_var_params = locals()
|
|
|
|
all_params = ['sub_account']
|
|
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
|
|
|
|
for k, v in six.iteritems(local_var_params['kwargs']):
|
|
if k not in all_params:
|
|
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_sub_accounts" % k)
|
|
local_var_params[k] = v
|
|
del local_var_params['kwargs']
|
|
# verify the required parameter 'sub_account' is set
|
|
if self.api_client.client_side_validation and (
|
|
'sub_account' not in local_var_params or local_var_params['sub_account'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `sub_account` when calling `create_sub_accounts`"
|
|
) # noqa: E501
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
|
|
query_params = []
|
|
|
|
header_params = {}
|
|
|
|
form_params = []
|
|
local_var_files = {}
|
|
|
|
body_params = None
|
|
if 'sub_account' in local_var_params:
|
|
body_params = local_var_params['sub_account']
|
|
# HTTP header `Accept`
|
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
|
|
|
|
# HTTP header `Content-Type`
|
|
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
|
|
['application/json']
|
|
) # noqa: E501
|
|
|
|
# Authentication setting
|
|
auth_settings = ['apiv4'] # noqa: E501
|
|
|
|
return self.api_client.call_api(
|
|
'/sub_accounts',
|
|
'POST',
|
|
path_params,
|
|
query_params,
|
|
header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
files=local_var_files,
|
|
response_type='SubAccount', # noqa: E501
|
|
auth_settings=auth_settings,
|
|
async_req=local_var_params.get('async_req'),
|
|
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
|
_preload_content=local_var_params.get('_preload_content', True),
|
|
_request_timeout=local_var_params.get('_request_timeout'),
|
|
collection_formats=collection_formats,
|
|
)
|
|
|
|
def get_sub_account(self, user_id, **kwargs): # noqa: E501
|
|
"""Get the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.get_sub_account(user_id, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: gate_api.SubAccount
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
kwargs['_return_http_data_only'] = True
|
|
return self.get_sub_account_with_http_info(user_id, **kwargs) # noqa: E501
|
|
|
|
def get_sub_account_with_http_info(self, user_id, **kwargs): # noqa: E501
|
|
"""Get the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.get_sub_account_with_http_info(user_id, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param _return_http_data_only: response data without head status code
|
|
and headers
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: tuple(gate_api.SubAccount, status_code(int), headers(HTTPHeaderDict))
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
|
|
local_var_params = locals()
|
|
|
|
all_params = ['user_id']
|
|
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
|
|
|
|
for k, v in six.iteritems(local_var_params['kwargs']):
|
|
if k not in all_params:
|
|
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_sub_account" % k)
|
|
local_var_params[k] = v
|
|
del local_var_params['kwargs']
|
|
# verify the required parameter 'user_id' is set
|
|
if self.api_client.client_side_validation and (
|
|
'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError("Missing the required parameter `user_id` when calling `get_sub_account`") # noqa: E501
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'user_id' in local_var_params:
|
|
path_params['user_id'] = local_var_params['user_id'] # noqa: E501
|
|
|
|
query_params = []
|
|
|
|
header_params = {}
|
|
|
|
form_params = []
|
|
local_var_files = {}
|
|
|
|
body_params = None
|
|
# HTTP header `Accept`
|
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
|
|
|
|
# Authentication setting
|
|
auth_settings = ['apiv4'] # noqa: E501
|
|
|
|
return self.api_client.call_api(
|
|
'/sub_accounts/{user_id}',
|
|
'GET',
|
|
path_params,
|
|
query_params,
|
|
header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
files=local_var_files,
|
|
response_type='SubAccount', # noqa: E501
|
|
auth_settings=auth_settings,
|
|
async_req=local_var_params.get('async_req'),
|
|
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
|
_preload_content=local_var_params.get('_preload_content', True),
|
|
_request_timeout=local_var_params.get('_request_timeout'),
|
|
collection_formats=collection_formats,
|
|
)
|
|
|
|
def list_sub_account_keys(self, user_id, **kwargs): # noqa: E501
|
|
"""List all API Key of the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.list_sub_account_keys(user_id, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: list[gate_api.SubAccountKey]
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
kwargs['_return_http_data_only'] = True
|
|
return self.list_sub_account_keys_with_http_info(user_id, **kwargs) # noqa: E501
|
|
|
|
def list_sub_account_keys_with_http_info(self, user_id, **kwargs): # noqa: E501
|
|
"""List all API Key of the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.list_sub_account_keys_with_http_info(user_id, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param _return_http_data_only: response data without head status code
|
|
and headers
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: tuple(list[gate_api.SubAccountKey], status_code(int), headers(HTTPHeaderDict))
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
|
|
local_var_params = locals()
|
|
|
|
all_params = ['user_id']
|
|
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
|
|
|
|
for k, v in six.iteritems(local_var_params['kwargs']):
|
|
if k not in all_params:
|
|
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_sub_account_keys" % k)
|
|
local_var_params[k] = v
|
|
del local_var_params['kwargs']
|
|
# verify the required parameter 'user_id' is set
|
|
if self.api_client.client_side_validation and (
|
|
'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `user_id` when calling `list_sub_account_keys`"
|
|
) # noqa: E501
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'user_id' in local_var_params:
|
|
path_params['user_id'] = local_var_params['user_id'] # noqa: E501
|
|
|
|
query_params = []
|
|
|
|
header_params = {}
|
|
|
|
form_params = []
|
|
local_var_files = {}
|
|
|
|
body_params = None
|
|
# HTTP header `Accept`
|
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
|
|
|
|
# Authentication setting
|
|
auth_settings = ['apiv4'] # noqa: E501
|
|
|
|
return self.api_client.call_api(
|
|
'/sub_accounts/{user_id}/keys',
|
|
'GET',
|
|
path_params,
|
|
query_params,
|
|
header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
files=local_var_files,
|
|
response_type='list[SubAccountKey]', # noqa: E501
|
|
auth_settings=auth_settings,
|
|
async_req=local_var_params.get('async_req'),
|
|
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
|
_preload_content=local_var_params.get('_preload_content', True),
|
|
_request_timeout=local_var_params.get('_request_timeout'),
|
|
collection_formats=collection_formats,
|
|
)
|
|
|
|
def create_sub_account_keys(self, user_id, sub_account_key, **kwargs): # noqa: E501
|
|
"""Create API Key of the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.create_sub_account_keys(user_id, sub_account_key, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param SubAccountKey sub_account_key: (required)
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: list[gate_api.SubAccountKey]
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
kwargs['_return_http_data_only'] = True
|
|
return self.create_sub_account_keys_with_http_info(user_id, sub_account_key, **kwargs) # noqa: E501
|
|
|
|
def create_sub_account_keys_with_http_info(self, user_id, sub_account_key, **kwargs): # noqa: E501
|
|
"""Create API Key of the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.create_sub_account_keys_with_http_info(user_id, sub_account_key, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param SubAccountKey sub_account_key: (required)
|
|
:param _return_http_data_only: response data without head status code
|
|
and headers
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: tuple(list[gate_api.SubAccountKey], status_code(int), headers(HTTPHeaderDict))
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
|
|
local_var_params = locals()
|
|
|
|
all_params = ['user_id', 'sub_account_key']
|
|
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
|
|
|
|
for k, v in six.iteritems(local_var_params['kwargs']):
|
|
if k not in all_params:
|
|
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_sub_account_keys" % k)
|
|
local_var_params[k] = v
|
|
del local_var_params['kwargs']
|
|
# verify the required parameter 'user_id' is set
|
|
if self.api_client.client_side_validation and (
|
|
'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `user_id` when calling `create_sub_account_keys`"
|
|
) # noqa: E501
|
|
# verify the required parameter 'sub_account_key' is set
|
|
if self.api_client.client_side_validation and (
|
|
'sub_account_key' not in local_var_params or local_var_params['sub_account_key'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `sub_account_key` when calling `create_sub_account_keys`"
|
|
) # noqa: E501
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'user_id' in local_var_params:
|
|
path_params['user_id'] = local_var_params['user_id'] # noqa: E501
|
|
|
|
query_params = []
|
|
|
|
header_params = {}
|
|
|
|
form_params = []
|
|
local_var_files = {}
|
|
|
|
body_params = None
|
|
if 'sub_account_key' in local_var_params:
|
|
body_params = local_var_params['sub_account_key']
|
|
# HTTP header `Accept`
|
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
|
|
|
|
# HTTP header `Content-Type`
|
|
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
|
|
['application/json']
|
|
) # noqa: E501
|
|
|
|
# Authentication setting
|
|
auth_settings = ['apiv4'] # noqa: E501
|
|
|
|
return self.api_client.call_api(
|
|
'/sub_accounts/{user_id}/keys',
|
|
'POST',
|
|
path_params,
|
|
query_params,
|
|
header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
files=local_var_files,
|
|
response_type='list[SubAccountKey]', # noqa: E501
|
|
auth_settings=auth_settings,
|
|
async_req=local_var_params.get('async_req'),
|
|
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
|
_preload_content=local_var_params.get('_preload_content', True),
|
|
_request_timeout=local_var_params.get('_request_timeout'),
|
|
collection_formats=collection_formats,
|
|
)
|
|
|
|
def get_sub_account_key(self, user_id, key, **kwargs): # noqa: E501
|
|
"""Get the API Key of the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.get_sub_account_key(user_id, key, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param str key: The API Key of the sub-account (required)
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: gate_api.SubAccountKey
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
kwargs['_return_http_data_only'] = True
|
|
return self.get_sub_account_key_with_http_info(user_id, key, **kwargs) # noqa: E501
|
|
|
|
def get_sub_account_key_with_http_info(self, user_id, key, **kwargs): # noqa: E501
|
|
"""Get the API Key of the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.get_sub_account_key_with_http_info(user_id, key, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param str key: The API Key of the sub-account (required)
|
|
:param _return_http_data_only: response data without head status code
|
|
and headers
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: tuple(gate_api.SubAccountKey, status_code(int), headers(HTTPHeaderDict))
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
|
|
local_var_params = locals()
|
|
|
|
all_params = ['user_id', 'key']
|
|
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
|
|
|
|
for k, v in six.iteritems(local_var_params['kwargs']):
|
|
if k not in all_params:
|
|
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_sub_account_key" % k)
|
|
local_var_params[k] = v
|
|
del local_var_params['kwargs']
|
|
# verify the required parameter 'user_id' is set
|
|
if self.api_client.client_side_validation and (
|
|
'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `user_id` when calling `get_sub_account_key`"
|
|
) # noqa: E501
|
|
# verify the required parameter 'key' is set
|
|
if self.api_client.client_side_validation and (
|
|
'key' not in local_var_params or local_var_params['key'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError("Missing the required parameter `key` when calling `get_sub_account_key`") # noqa: E501
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'user_id' in local_var_params:
|
|
path_params['user_id'] = local_var_params['user_id'] # noqa: E501
|
|
if 'key' in local_var_params:
|
|
path_params['key'] = local_var_params['key'] # noqa: E501
|
|
|
|
query_params = []
|
|
|
|
header_params = {}
|
|
|
|
form_params = []
|
|
local_var_files = {}
|
|
|
|
body_params = None
|
|
# HTTP header `Accept`
|
|
header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
|
|
|
|
# Authentication setting
|
|
auth_settings = ['apiv4'] # noqa: E501
|
|
|
|
return self.api_client.call_api(
|
|
'/sub_accounts/{user_id}/keys/{key}',
|
|
'GET',
|
|
path_params,
|
|
query_params,
|
|
header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
files=local_var_files,
|
|
response_type='SubAccountKey', # noqa: E501
|
|
auth_settings=auth_settings,
|
|
async_req=local_var_params.get('async_req'),
|
|
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
|
_preload_content=local_var_params.get('_preload_content', True),
|
|
_request_timeout=local_var_params.get('_request_timeout'),
|
|
collection_formats=collection_formats,
|
|
)
|
|
|
|
def update_sub_account_keys(self, user_id, key, sub_account_key, **kwargs): # noqa: E501
|
|
"""Update API key of the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.update_sub_account_keys(user_id, key, sub_account_key, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param str key: The API Key of the sub-account (required)
|
|
:param SubAccountKey sub_account_key: (required)
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: None
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
kwargs['_return_http_data_only'] = True
|
|
return self.update_sub_account_keys_with_http_info(user_id, key, sub_account_key, **kwargs) # noqa: E501
|
|
|
|
def update_sub_account_keys_with_http_info(self, user_id, key, sub_account_key, **kwargs): # noqa: E501
|
|
"""Update API key of the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.update_sub_account_keys_with_http_info(user_id, key, sub_account_key, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param str key: The API Key of the sub-account (required)
|
|
:param SubAccountKey sub_account_key: (required)
|
|
:param _return_http_data_only: response data without head status code
|
|
and headers
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: None
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
|
|
local_var_params = locals()
|
|
|
|
all_params = ['user_id', 'key', 'sub_account_key']
|
|
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
|
|
|
|
for k, v in six.iteritems(local_var_params['kwargs']):
|
|
if k not in all_params:
|
|
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method update_sub_account_keys" % k)
|
|
local_var_params[k] = v
|
|
del local_var_params['kwargs']
|
|
# verify the required parameter 'user_id' is set
|
|
if self.api_client.client_side_validation and (
|
|
'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `user_id` when calling `update_sub_account_keys`"
|
|
) # noqa: E501
|
|
# verify the required parameter 'key' is set
|
|
if self.api_client.client_side_validation and (
|
|
'key' not in local_var_params or local_var_params['key'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `key` when calling `update_sub_account_keys`"
|
|
) # noqa: E501
|
|
# verify the required parameter 'sub_account_key' is set
|
|
if self.api_client.client_side_validation and (
|
|
'sub_account_key' not in local_var_params or local_var_params['sub_account_key'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `sub_account_key` when calling `update_sub_account_keys`"
|
|
) # noqa: E501
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'user_id' in local_var_params:
|
|
path_params['user_id'] = local_var_params['user_id'] # noqa: E501
|
|
if 'key' in local_var_params:
|
|
path_params['key'] = local_var_params['key'] # noqa: E501
|
|
|
|
query_params = []
|
|
|
|
header_params = {}
|
|
|
|
form_params = []
|
|
local_var_files = {}
|
|
|
|
body_params = None
|
|
if 'sub_account_key' in local_var_params:
|
|
body_params = local_var_params['sub_account_key']
|
|
# HTTP header `Content-Type`
|
|
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
|
|
['application/json']
|
|
) # noqa: E501
|
|
|
|
# Authentication setting
|
|
auth_settings = ['apiv4'] # noqa: E501
|
|
|
|
return self.api_client.call_api(
|
|
'/sub_accounts/{user_id}/keys/{key}',
|
|
'PUT',
|
|
path_params,
|
|
query_params,
|
|
header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
files=local_var_files,
|
|
response_type=None, # noqa: E501
|
|
auth_settings=auth_settings,
|
|
async_req=local_var_params.get('async_req'),
|
|
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
|
_preload_content=local_var_params.get('_preload_content', True),
|
|
_request_timeout=local_var_params.get('_request_timeout'),
|
|
collection_formats=collection_formats,
|
|
)
|
|
|
|
def delete_sub_account_keys(self, user_id, key, **kwargs): # noqa: E501
|
|
"""Delete API key of the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.delete_sub_account_keys(user_id, key, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param str key: The API Key of the sub-account (required)
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: None
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
kwargs['_return_http_data_only'] = True
|
|
return self.delete_sub_account_keys_with_http_info(user_id, key, **kwargs) # noqa: E501
|
|
|
|
def delete_sub_account_keys_with_http_info(self, user_id, key, **kwargs): # noqa: E501
|
|
"""Delete API key of the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.delete_sub_account_keys_with_http_info(user_id, key, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: Sub-account user id (required)
|
|
:param str key: The API Key of the sub-account (required)
|
|
:param _return_http_data_only: response data without head status code
|
|
and headers
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: None
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
|
|
local_var_params = locals()
|
|
|
|
all_params = ['user_id', 'key']
|
|
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
|
|
|
|
for k, v in six.iteritems(local_var_params['kwargs']):
|
|
if k not in all_params:
|
|
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method delete_sub_account_keys" % k)
|
|
local_var_params[k] = v
|
|
del local_var_params['kwargs']
|
|
# verify the required parameter 'user_id' is set
|
|
if self.api_client.client_side_validation and (
|
|
'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `user_id` when calling `delete_sub_account_keys`"
|
|
) # noqa: E501
|
|
# verify the required parameter 'key' is set
|
|
if self.api_client.client_side_validation and (
|
|
'key' not in local_var_params or local_var_params['key'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `key` when calling `delete_sub_account_keys`"
|
|
) # noqa: E501
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'user_id' in local_var_params:
|
|
path_params['user_id'] = local_var_params['user_id'] # noqa: E501
|
|
if 'key' in local_var_params:
|
|
path_params['key'] = local_var_params['key'] # noqa: E501
|
|
|
|
query_params = []
|
|
|
|
header_params = {}
|
|
|
|
form_params = []
|
|
local_var_files = {}
|
|
|
|
body_params = None
|
|
# Authentication setting
|
|
auth_settings = ['apiv4'] # noqa: E501
|
|
|
|
return self.api_client.call_api(
|
|
'/sub_accounts/{user_id}/keys/{key}',
|
|
'DELETE',
|
|
path_params,
|
|
query_params,
|
|
header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
files=local_var_files,
|
|
response_type=None, # noqa: E501
|
|
auth_settings=auth_settings,
|
|
async_req=local_var_params.get('async_req'),
|
|
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
|
_preload_content=local_var_params.get('_preload_content', True),
|
|
_request_timeout=local_var_params.get('_request_timeout'),
|
|
collection_formats=collection_formats,
|
|
)
|
|
|
|
def lock_sub_account(self, user_id, **kwargs): # noqa: E501
|
|
"""Lock the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.lock_sub_account(user_id, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: The user id of the sub-account (required)
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: None
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
kwargs['_return_http_data_only'] = True
|
|
return self.lock_sub_account_with_http_info(user_id, **kwargs) # noqa: E501
|
|
|
|
def lock_sub_account_with_http_info(self, user_id, **kwargs): # noqa: E501
|
|
"""Lock the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.lock_sub_account_with_http_info(user_id, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: The user id of the sub-account (required)
|
|
:param _return_http_data_only: response data without head status code
|
|
and headers
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: None
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
|
|
local_var_params = locals()
|
|
|
|
all_params = ['user_id']
|
|
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
|
|
|
|
for k, v in six.iteritems(local_var_params['kwargs']):
|
|
if k not in all_params:
|
|
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method lock_sub_account" % k)
|
|
local_var_params[k] = v
|
|
del local_var_params['kwargs']
|
|
# verify the required parameter 'user_id' is set
|
|
if self.api_client.client_side_validation and (
|
|
'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `user_id` when calling `lock_sub_account`"
|
|
) # noqa: E501
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'user_id' in local_var_params:
|
|
path_params['user_id'] = local_var_params['user_id'] # noqa: E501
|
|
|
|
query_params = []
|
|
|
|
header_params = {}
|
|
|
|
form_params = []
|
|
local_var_files = {}
|
|
|
|
body_params = None
|
|
# Authentication setting
|
|
auth_settings = ['apiv4'] # noqa: E501
|
|
|
|
return self.api_client.call_api(
|
|
'/sub_accounts/{user_id}/lock',
|
|
'POST',
|
|
path_params,
|
|
query_params,
|
|
header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
files=local_var_files,
|
|
response_type=None, # noqa: E501
|
|
auth_settings=auth_settings,
|
|
async_req=local_var_params.get('async_req'),
|
|
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
|
_preload_content=local_var_params.get('_preload_content', True),
|
|
_request_timeout=local_var_params.get('_request_timeout'),
|
|
collection_formats=collection_formats,
|
|
)
|
|
|
|
def unlock_sub_account(self, user_id, **kwargs): # noqa: E501
|
|
"""Unlock the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.unlock_sub_account(user_id, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: The user id of the sub-account (required)
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: None
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
kwargs['_return_http_data_only'] = True
|
|
return self.unlock_sub_account_with_http_info(user_id, **kwargs) # noqa: E501
|
|
|
|
def unlock_sub_account_with_http_info(self, user_id, **kwargs): # noqa: E501
|
|
"""Unlock the sub-account # noqa: E501
|
|
|
|
This method makes a synchronous HTTP request by default. To make an
|
|
asynchronous HTTP request, please pass async_req=True
|
|
>>> thread = api.unlock_sub_account_with_http_info(user_id, async_req=True)
|
|
>>> result = thread.get()
|
|
|
|
:param bool async_req: execute request asynchronously
|
|
:param int user_id: The user id of the sub-account (required)
|
|
:param _return_http_data_only: response data without head status code
|
|
and headers
|
|
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
be returned without reading/decoding response
|
|
data. Default is True.
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:rtype: None
|
|
:return: If the method is called asynchronously,
|
|
returns the request thread.
|
|
"""
|
|
|
|
local_var_params = locals()
|
|
|
|
all_params = ['user_id']
|
|
all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
|
|
|
|
for k, v in six.iteritems(local_var_params['kwargs']):
|
|
if k not in all_params:
|
|
raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method unlock_sub_account" % k)
|
|
local_var_params[k] = v
|
|
del local_var_params['kwargs']
|
|
# verify the required parameter 'user_id' is set
|
|
if self.api_client.client_side_validation and (
|
|
'user_id' not in local_var_params or local_var_params['user_id'] is None # noqa: E501
|
|
): # noqa: E501
|
|
raise ApiValueError(
|
|
"Missing the required parameter `user_id` when calling `unlock_sub_account`"
|
|
) # noqa: E501
|
|
|
|
collection_formats = {}
|
|
|
|
path_params = {}
|
|
if 'user_id' in local_var_params:
|
|
path_params['user_id'] = local_var_params['user_id'] # noqa: E501
|
|
|
|
query_params = []
|
|
|
|
header_params = {}
|
|
|
|
form_params = []
|
|
local_var_files = {}
|
|
|
|
body_params = None
|
|
# Authentication setting
|
|
auth_settings = ['apiv4'] # noqa: E501
|
|
|
|
return self.api_client.call_api(
|
|
'/sub_accounts/{user_id}/unlock',
|
|
'POST',
|
|
path_params,
|
|
query_params,
|
|
header_params,
|
|
body=body_params,
|
|
post_params=form_params,
|
|
files=local_var_files,
|
|
response_type=None, # noqa: E501
|
|
auth_settings=auth_settings,
|
|
async_req=local_var_params.get('async_req'),
|
|
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
|
|
_preload_content=local_var_params.get('_preload_content', True),
|
|
_request_timeout=local_var_params.get('_request_timeout'),
|
|
collection_formats=collection_formats,
|
|
)
|