# coding: utf-8

"""
    Knetik Platform API Documentation latest 

    This is the spec for the Knetik API.  Use this in conjunction with the documentation found at https://knetikcloud.com.

    OpenAPI spec version: latest 
    Contact: support@knetik.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import sys
import os
import re

# python 2 and python 3 compatibility library
from six import iteritems

from ..api_client import ApiClient


class PaymentsWalletsApi(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def get_user_wallet(self, user_id, currency_code, **kwargs):
        """
        Returns the user's wallet for the given currency code
        <b>Permissions Needed:</b> WALLETS_ADMIN or owner
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_user_wallet(user_id, currency_code, async=True)
        >>> result = thread.get()

        :param async bool
        :param int user_id: The ID of the user for whom wallet is being retrieved (required)
        :param str currency_code: Currency code of the user's wallet (required)
        :return: SimpleWallet
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_user_wallet_with_http_info(user_id, currency_code, **kwargs)
        else:
            (data) = self.get_user_wallet_with_http_info(user_id, currency_code, **kwargs)
            return data

    def get_user_wallet_with_http_info(self, user_id, currency_code, **kwargs):
        """
        Returns the user's wallet for the given currency code
        <b>Permissions Needed:</b> WALLETS_ADMIN or owner
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_user_wallet_with_http_info(user_id, currency_code, async=True)
        >>> result = thread.get()

        :param async bool
        :param int user_id: The ID of the user for whom wallet is being retrieved (required)
        :param str currency_code: Currency code of the user's wallet (required)
        :return: SimpleWallet
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['user_id', 'currency_code']
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_user_wallet" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'user_id' is set
        if ('user_id' not in params) or (params['user_id'] is None):
            raise ValueError("Missing the required parameter `user_id` when calling `get_user_wallet`")
        # verify the required parameter 'currency_code' is set
        if ('currency_code' not in params) or (params['currency_code'] is None):
            raise ValueError("Missing the required parameter `currency_code` when calling `get_user_wallet`")


        collection_formats = {}

        path_params = {}
        if 'user_id' in params:
            path_params['user_id'] = params['user_id']
        if 'currency_code' in params:
            path_params['currency_code'] = params['currency_code']

        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'])

        # Authentication setting
        auth_settings = ['oauth2_client_credentials_grant', 'oauth2_password_grant']

        return self.api_client.call_api('/users/{user_id}/wallets/{currency_code}', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='SimpleWallet',
                                        auth_settings=auth_settings,
                                        async=params.get('async'),
                                        _return_http_data_only=params.get('_return_http_data_only'),
                                        _preload_content=params.get('_preload_content', True),
                                        _request_timeout=params.get('_request_timeout'),
                                        collection_formats=collection_formats)

    def get_user_wallet_transactions(self, user_id, currency_code, **kwargs):
        """
        Retrieve a user's wallet transactions
        <b>Permissions Needed:</b> WALLETS_ADMIN or owner
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_user_wallet_transactions(user_id, currency_code, async=True)
        >>> result = thread.get()

        :param async bool
        :param int user_id: The ID of the user for whom wallet transactions are being retrieved (required)
        :param str currency_code: Currency code of the user's wallet (required)
        :param str filter_type: Filter for transactions with specified type
        :param int filter_max_date: Filter for transactions from no earlier than the specified date as a unix timestamp in seconds
        :param int filter_min_date: Filter for transactions from no later than the specified date as a unix timestamp in seconds
        :param str filter_sign: Filter for transactions with amount with the given sign.  Allowable values: ('positive', 'negative')
        :param int size: The number of objects returned per page
        :param int page: The number of the page returned, starting with 1
        :param str order: A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]
        :return: PageResourceWalletTransactionResource
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_user_wallet_transactions_with_http_info(user_id, currency_code, **kwargs)
        else:
            (data) = self.get_user_wallet_transactions_with_http_info(user_id, currency_code, **kwargs)
            return data

    def get_user_wallet_transactions_with_http_info(self, user_id, currency_code, **kwargs):
        """
        Retrieve a user's wallet transactions
        <b>Permissions Needed:</b> WALLETS_ADMIN or owner
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_user_wallet_transactions_with_http_info(user_id, currency_code, async=True)
        >>> result = thread.get()

        :param async bool
        :param int user_id: The ID of the user for whom wallet transactions are being retrieved (required)
        :param str currency_code: Currency code of the user's wallet (required)
        :param str filter_type: Filter for transactions with specified type
        :param int filter_max_date: Filter for transactions from no earlier than the specified date as a unix timestamp in seconds
        :param int filter_min_date: Filter for transactions from no later than the specified date as a unix timestamp in seconds
        :param str filter_sign: Filter for transactions with amount with the given sign.  Allowable values: ('positive', 'negative')
        :param int size: The number of objects returned per page
        :param int page: The number of the page returned, starting with 1
        :param str order: A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]
        :return: PageResourceWalletTransactionResource
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['user_id', 'currency_code', 'filter_type', 'filter_max_date', 'filter_min_date', 'filter_sign', 'size', 'page', 'order']
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_user_wallet_transactions" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'user_id' is set
        if ('user_id' not in params) or (params['user_id'] is None):
            raise ValueError("Missing the required parameter `user_id` when calling `get_user_wallet_transactions`")
        # verify the required parameter 'currency_code' is set
        if ('currency_code' not in params) or (params['currency_code'] is None):
            raise ValueError("Missing the required parameter `currency_code` when calling `get_user_wallet_transactions`")


        collection_formats = {}

        path_params = {}
        if 'user_id' in params:
            path_params['user_id'] = params['user_id']
        if 'currency_code' in params:
            path_params['currency_code'] = params['currency_code']

        query_params = []
        if 'filter_type' in params:
            query_params.append(('filter_type', params['filter_type']))
        if 'filter_max_date' in params:
            query_params.append(('filter_max_date', params['filter_max_date']))
        if 'filter_min_date' in params:
            query_params.append(('filter_min_date', params['filter_min_date']))
        if 'filter_sign' in params:
            query_params.append(('filter_sign', params['filter_sign']))
        if 'size' in params:
            query_params.append(('size', params['size']))
        if 'page' in params:
            query_params.append(('page', params['page']))
        if 'order' in params:
            query_params.append(('order', params['order']))

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2_client_credentials_grant', 'oauth2_password_grant']

        return self.api_client.call_api('/users/{user_id}/wallets/{currency_code}/transactions', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='PageResourceWalletTransactionResource',
                                        auth_settings=auth_settings,
                                        async=params.get('async'),
                                        _return_http_data_only=params.get('_return_http_data_only'),
                                        _preload_content=params.get('_preload_content', True),
                                        _request_timeout=params.get('_request_timeout'),
                                        collection_formats=collection_formats)

    def get_user_wallets(self, user_id, **kwargs):
        """
        List all of a user's wallets
        <b>Permissions Needed:</b> WALLETS_ADMIN or owner
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_user_wallets(user_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int user_id: The ID of the user for whom wallets are being retrieved (required)
        :return: list[SimpleWallet]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_user_wallets_with_http_info(user_id, **kwargs)
        else:
            (data) = self.get_user_wallets_with_http_info(user_id, **kwargs)
            return data

    def get_user_wallets_with_http_info(self, user_id, **kwargs):
        """
        List all of a user's wallets
        <b>Permissions Needed:</b> WALLETS_ADMIN or owner
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_user_wallets_with_http_info(user_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int user_id: The ID of the user for whom wallets are being retrieved (required)
        :return: list[SimpleWallet]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['user_id']
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_user_wallets" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'user_id' is set
        if ('user_id' not in params) or (params['user_id'] is None):
            raise ValueError("Missing the required parameter `user_id` when calling `get_user_wallets`")


        collection_formats = {}

        path_params = {}
        if 'user_id' in params:
            path_params['user_id'] = params['user_id']

        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'])

        # Authentication setting
        auth_settings = ['oauth2_client_credentials_grant', 'oauth2_password_grant']

        return self.api_client.call_api('/users/{user_id}/wallets', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='list[SimpleWallet]',
                                        auth_settings=auth_settings,
                                        async=params.get('async'),
                                        _return_http_data_only=params.get('_return_http_data_only'),
                                        _preload_content=params.get('_preload_content', True),
                                        _request_timeout=params.get('_request_timeout'),
                                        collection_formats=collection_formats)

    def get_wallet_balances(self, **kwargs):
        """
        Retrieves a summation of wallet balances by currency code
        <b>Permissions Needed:</b> WALLETS_ADMIN
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_wallet_balances(async=True)
        >>> result = thread.get()

        :param async bool
        :return: PageResourceWalletTotalResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_wallet_balances_with_http_info(**kwargs)
        else:
            (data) = self.get_wallet_balances_with_http_info(**kwargs)
            return data

    def get_wallet_balances_with_http_info(self, **kwargs):
        """
        Retrieves a summation of wallet balances by currency code
        <b>Permissions Needed:</b> WALLETS_ADMIN
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_wallet_balances_with_http_info(async=True)
        >>> result = thread.get()

        :param async bool
        :return: PageResourceWalletTotalResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_wallet_balances" % key
                )
            params[key] = val
        del 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'])

        # Authentication setting
        auth_settings = ['oauth2_client_credentials_grant', 'oauth2_password_grant']

        return self.api_client.call_api('/wallets/totals', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='PageResourceWalletTotalResponse',
                                        auth_settings=auth_settings,
                                        async=params.get('async'),
                                        _return_http_data_only=params.get('_return_http_data_only'),
                                        _preload_content=params.get('_preload_content', True),
                                        _request_timeout=params.get('_request_timeout'),
                                        collection_formats=collection_formats)

    def get_wallet_transactions(self, **kwargs):
        """
        Retrieve wallet transactions across the system
        <b>Permissions Needed:</b> WALLETS_ADMIN
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_wallet_transactions(async=True)
        >>> result = thread.get()

        :param async bool
        :param int filter_invoice: Filter for transactions from a specific invoice
        :param str filter_type: Filter for transactions with specified type
        :param str filter_date: A comma separated string without spaces.  First value is the operator to search on, second value is the log start date, a unix timestamp in seconds. Can be repeated for a range, eg: GT,123,LT,456  Allowed operators: (GT, LT, EQ, GOE, LOE).
        :param str filter_sign: Filter for transactions with amount with the given sign
        :param int filter_user_id: Filter for transactions for specific userId
        :param str filter_username: Filter for transactions for specific username that start with the given string
        :param str filter_details: Filter for transactions for specific details that start with the given string
        :param str filter_currency_code: Filter for transactions for specific currency code
        :param int size: The number of objects returned per page
        :param int page: The number of the page returned, starting with 1
        :param str order: A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]
        :return: PageResourceWalletTransactionResource
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_wallet_transactions_with_http_info(**kwargs)
        else:
            (data) = self.get_wallet_transactions_with_http_info(**kwargs)
            return data

    def get_wallet_transactions_with_http_info(self, **kwargs):
        """
        Retrieve wallet transactions across the system
        <b>Permissions Needed:</b> WALLETS_ADMIN
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_wallet_transactions_with_http_info(async=True)
        >>> result = thread.get()

        :param async bool
        :param int filter_invoice: Filter for transactions from a specific invoice
        :param str filter_type: Filter for transactions with specified type
        :param str filter_date: A comma separated string without spaces.  First value is the operator to search on, second value is the log start date, a unix timestamp in seconds. Can be repeated for a range, eg: GT,123,LT,456  Allowed operators: (GT, LT, EQ, GOE, LOE).
        :param str filter_sign: Filter for transactions with amount with the given sign
        :param int filter_user_id: Filter for transactions for specific userId
        :param str filter_username: Filter for transactions for specific username that start with the given string
        :param str filter_details: Filter for transactions for specific details that start with the given string
        :param str filter_currency_code: Filter for transactions for specific currency code
        :param int size: The number of objects returned per page
        :param int page: The number of the page returned, starting with 1
        :param str order: A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]
        :return: PageResourceWalletTransactionResource
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['filter_invoice', 'filter_type', 'filter_date', 'filter_sign', 'filter_user_id', 'filter_username', 'filter_details', 'filter_currency_code', 'size', 'page', 'order']
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_wallet_transactions" % key
                )
            params[key] = val
        del params['kwargs']


        collection_formats = {}

        path_params = {}

        query_params = []
        if 'filter_invoice' in params:
            query_params.append(('filter_invoice', params['filter_invoice']))
        if 'filter_type' in params:
            query_params.append(('filter_type', params['filter_type']))
        if 'filter_date' in params:
            query_params.append(('filter_date', params['filter_date']))
        if 'filter_sign' in params:
            query_params.append(('filter_sign', params['filter_sign']))
        if 'filter_user_id' in params:
            query_params.append(('filter_user_id', params['filter_user_id']))
        if 'filter_username' in params:
            query_params.append(('filter_username', params['filter_username']))
        if 'filter_details' in params:
            query_params.append(('filter_details', params['filter_details']))
        if 'filter_currency_code' in params:
            query_params.append(('filter_currency_code', params['filter_currency_code']))
        if 'size' in params:
            query_params.append(('size', params['size']))
        if 'page' in params:
            query_params.append(('page', params['page']))
        if 'order' in params:
            query_params.append(('order', params['order']))

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2_client_credentials_grant', 'oauth2_password_grant']

        return self.api_client.call_api('/wallets/transactions', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='PageResourceWalletTransactionResource',
                                        auth_settings=auth_settings,
                                        async=params.get('async'),
                                        _return_http_data_only=params.get('_return_http_data_only'),
                                        _preload_content=params.get('_preload_content', True),
                                        _request_timeout=params.get('_request_timeout'),
                                        collection_formats=collection_formats)

    def get_wallets(self, **kwargs):
        """
        Retrieve a list of wallets across the system
        <b>Permissions Needed:</b> WALLETS_ADMIN
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_wallets(async=True)
        >>> result = thread.get()

        :param async bool
        :param int size: The number of objects returned per page
        :param int page: The number of the page returned, starting with 1
        :param str order: A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]
        :return: PageResourceSimpleWallet
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_wallets_with_http_info(**kwargs)
        else:
            (data) = self.get_wallets_with_http_info(**kwargs)
            return data

    def get_wallets_with_http_info(self, **kwargs):
        """
        Retrieve a list of wallets across the system
        <b>Permissions Needed:</b> WALLETS_ADMIN
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_wallets_with_http_info(async=True)
        >>> result = thread.get()

        :param async bool
        :param int size: The number of objects returned per page
        :param int page: The number of the page returned, starting with 1
        :param str order: A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC]
        :return: PageResourceSimpleWallet
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['size', 'page', 'order']
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_wallets" % key
                )
            params[key] = val
        del params['kwargs']


        collection_formats = {}

        path_params = {}

        query_params = []
        if 'size' in params:
            query_params.append(('size', params['size']))
        if 'page' in params:
            query_params.append(('page', params['page']))
        if 'order' in params:
            query_params.append(('order', params['order']))

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2_client_credentials_grant', 'oauth2_password_grant']

        return self.api_client.call_api('/wallets', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='PageResourceSimpleWallet',
                                        auth_settings=auth_settings,
                                        async=params.get('async'),
                                        _return_http_data_only=params.get('_return_http_data_only'),
                                        _preload_content=params.get('_preload_content', True),
                                        _request_timeout=params.get('_request_timeout'),
                                        collection_formats=collection_formats)

    def update_wallet_balance(self, user_id, currency_code, **kwargs):
        """
        Updates the balance for a user's wallet
        <b>Permissions Needed:</b> WALLETS_ADMIN
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.update_wallet_balance(user_id, currency_code, async=True)
        >>> result = thread.get()

        :param async bool
        :param int user_id: The ID of the user for whom wallet is being modified (required)
        :param str currency_code: Currency code of the user's wallet (required)
        :param WalletAlterRequest request: The requested balance modification to be made to the user's wallet
        :return: WalletTransactionResource
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.update_wallet_balance_with_http_info(user_id, currency_code, **kwargs)
        else:
            (data) = self.update_wallet_balance_with_http_info(user_id, currency_code, **kwargs)
            return data

    def update_wallet_balance_with_http_info(self, user_id, currency_code, **kwargs):
        """
        Updates the balance for a user's wallet
        <b>Permissions Needed:</b> WALLETS_ADMIN
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.update_wallet_balance_with_http_info(user_id, currency_code, async=True)
        >>> result = thread.get()

        :param async bool
        :param int user_id: The ID of the user for whom wallet is being modified (required)
        :param str currency_code: Currency code of the user's wallet (required)
        :param WalletAlterRequest request: The requested balance modification to be made to the user's wallet
        :return: WalletTransactionResource
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['user_id', 'currency_code', 'request']
        all_params.append('async')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_wallet_balance" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'user_id' is set
        if ('user_id' not in params) or (params['user_id'] is None):
            raise ValueError("Missing the required parameter `user_id` when calling `update_wallet_balance`")
        # verify the required parameter 'currency_code' is set
        if ('currency_code' not in params) or (params['currency_code'] is None):
            raise ValueError("Missing the required parameter `currency_code` when calling `update_wallet_balance`")


        collection_formats = {}

        path_params = {}
        if 'user_id' in params:
            path_params['user_id'] = params['user_id']
        if 'currency_code' in params:
            path_params['currency_code'] = params['currency_code']

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'request' in params:
            body_params = params['request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['oauth2_client_credentials_grant', 'oauth2_password_grant']

        return self.api_client.call_api('/users/{user_id}/wallets/{currency_code}/balance', 'PUT',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='WalletTransactionResource',
                                        auth_settings=auth_settings,
                                        async=params.get('async'),
                                        _return_http_data_only=params.get('_return_http_data_only'),
                                        _preload_content=params.get('_preload_content', True),
                                        _request_timeout=params.get('_request_timeout'),
                                        collection_formats=collection_formats)
